Skip to content

Releases: equalogic/typeorm-relations-graphql

v3.0.0

11 Nov 00:44
66ff9b1
Compare
Choose a tag to compare

What's Changed

  • Return an empty RelationMap from buildForQuery if path not found by @sgarner in #882

⚠️ Breaking

If you try to map relations at a sub-path using buildForQuery() and that sub-path was not selected in the query submitted by a GraphQL client, an empty RelationMap will now be produced instead of throwing an error. The previous behavior was a bug, but we're treating it as a breaking change just to be safe.

Full Changelog: v2.0.2...v3.0.0

v2.0.2

20 Jul 01:15
bf53d1d
Compare
Choose a tag to compare

What's Changed

  • Use major version ranges for lib dependencies

Full Changelog: v2.0.1...v2.0.2

v2.0.1

04 May 05:35
Compare
Choose a tag to compare

What's Changed

  • Determine prop metadata type without using instanceof by @mucaho in #664

Dependencies

Read more

v2.0.0

04 Nov 05:02
914c185
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.2...v2.0.0

⚠️ BREAKING CHANGES

This release is only compatible with TypeORM v0.3.0 and newer. Support for TypeORM v0.2.x is dropped (but you can keep using typeorm-graphql-joiner@^1).

TypeORM v0.3.0 changed the way relations and data sources work. The relations option to findX() methods now expects an object instead of an array of strings (the array format is deprecated and will be removed in v0.4.0).

This has necessitated significant changes in this release to support the new object format. A relations object now looks like:

{
    profile: true,
    photos: true,
    videos: {
        videoAttributes: true,
    }
}

The library has been reworked to produce that kind of object, and to work with a TypeORM DataSource rather than a legacy TypeORM Connection. 🔌

A number of other changes and improvements have also been made:

  • Moved functions for inspecting GraphQLResolveInfo into a separate package, 📦 graphql-info-inspector
  • Created a new package 📦 typeorm-relations with functions for manipulating a TypeORM relations object
  • Renamed this package from typeorm-graphql-joiner to 📦 typeorm-relations-graphql
  • Renamed RelationMapper class to GraphRelationBuilder
  • Renamed method buildRelationListForQuery to buildForQuery
  • Renamed method buildRelationList to build

Migration Guide

If you were using typeorm-graphql-joiner with TypeORM v0.2.x before, and you're upgrading to TypeORM v0.3.x, you'll need to do the following:

  1. Remove dependency typeorm-graphql-joiner in your package.json

  2. Add dependency typeorm-relations-graphql in your package.json

  3. Replace code like:

    // OLD WAY
    import { RelationMapper } from 'typeorm-graphql-joiner';
    
    const relationMapper = new RelationMapper(connection);

    with:

    // NEW WAY
    import { GraphRelationBuilder } from 'typeorm-relations-graphql';
    
    const graphRelationBuilder = new GraphRelationBuilder(dataSource);
  4. Replace code like:

    // OLD WAY
    const relations = relationMapper.buildRelationListForQuery(Product, info);
    await productRepository.find({ relations: [...relations] });

    with:

    // NEW WAY
    const relationMap = graphRelationBuilder.buildForQuery(Product, info);
    await productRepository.find({ relations: relationMap.toFindOptionsRelations() });
  5. If you were using relationMapper.isFieldSelected() before, add graphql-info-inspector to your dependencies and use it like this:

    // NEW WAY
    import { isFieldSelected } from 'graphql-info-inspector';
    
    // In a Product resolver, for example:
    if (isFieldSelected('image.tags', info)) {
        // Client wants `product { image { tags { ... } } }`
    }
  6. If you need to manipulate the relations after mapping what's selected by the GraphQL query (for example, when there are relations that you always want to fetch for other reasons), previously you could just modify the resulting Set or Array of strings but now things are a little more complicated. However GraphRelationBuilder returns a RelationMap instance which makes this easy: 🔥

    const relationMap = graphRelationBuilder.buildForQuery(Product, info);
    
    // Always fetch product image relation
    relationMap.add('image');
    
    // Or, always fetch product image and tags
    relationMap.add({ image: { tags: true } });

    RelationMap is provided by 📦 typeorm-relations, read its docs to see what else you can do with it.

Additionally, make sure you're aware of TypeORM's own breaking changes when upgrading from v0.2.x to v0.3.0.

v1.0.2

07 Feb 05:30
e5f6abd
Compare
Choose a tag to compare

What's Changed

  • Update repository & author bcff5e9
  • fix: getNameFromNode not handling all possible node kinds eba73da

Full Changelog: v1.0.1...v1.0.2

v1.0.1

15 Apr 02:38
Compare
Choose a tag to compare

🐞 Fixed

  • #213 Handle FragmentSpread selections nested inside InlineFragment nodes 2a10e33

💅 Improved

🧰 Updated dependencies

  • Sync package-lock b7125d9
  • Update dependency eslint-plugin-promise to v5 f9a3e7d
  • Update dependency typescript to v4.2.4 29e085a
  • Update eslint to v4.21.0 b743f9b
  • Update dependency typeorm to v0.2.32 29c5bf4
  • Update eslint 0b57405
  • Update dependency husky to v6 fcbf8ea
  • Update dependency y18n to 4.0.1 [SECURITY] a776ab2
  • Update dependency @types/node to v14.14.37 24eb357
  • Update dependency @types/jest to v26.0.22 e537349
  • Update eslint to v4.19.0 c33dd10
  • Update dependency husky to v5.2.0 e4eb783
  • Update jest 506f668
  • Update eslint 60c58a8
  • Update dependency @types/node to v14.14.35 ad6a081
  • Update eslint to v4.17.0 38ed35a
  • Update dependency typescript to v4.2.3 60715a8
  • Update dependency ts-jest to v26.5.3 ef42998
  • Update dependency husky to v5.1.3 775969e
  • Update eslint 18de6d7
  • Update eslint 8487d56
  • Update dependency typescript to v4.2.2 0c35cb8
  • Update dependency ts-jest to v26.5.2 caea2de
  • Update dependency husky to v5.1.1 40d2c79
  • Update dependency eslint-config-prettier to v8 12c83de
  • Update dependency @types/node to v14.14.31 bbaf34f
  • Update dependency graphql-tools to v7.0.4 4e51287
  • Update eslint a022884
  • Update dependency sqlite3 to v5.0.2 54e8665
  • Update dependency @types/node to v14.14.28 f0aaec4
  • Update dependency np to v7.4.0 5d1eb2c
  • Update dependency typescript to v4.1.5 7331d75
  • Update dependency graphql-tools to v7.0.3 a755b4d
  • Update dependency ts-jest to v26.5.1 788318c
  • Update dependency husky to v5 813ab97
  • Update dependency typeorm to v0.2.31 ca4730f
  • Update dependency np to v7.3.0 a8d3907
  • Update dependency lint-staged to v10.5.4 ce7fb75
  • Update dependency @types/node to v14.14.25 10072af
  • Update eslint 86aa8ba
  • Update dependency ts-jest to v26.5.0 7e536ee
  • Update dependency graphql to v15.5.0 29fca5e
  • Update eslint to v4.14.1 44a70fd
  • Update dependency @types/node to v14.14.22 da4a39d
  • Update eslint 8258d51
  • Update dependency husky to v4.3.8 fbc91f2
  • Update dependency @types/node to v14.14.21 ba0d925
  • Update dependency typeorm to v0.2.30 737a25b
  • Update eslint to v4.13.0 6ad4581
  • Update dependency sqlite3 to v5.0.1 8839fa4
  • Update dependency @types/jest to v26.0.20 863cb60
  • Update dependency husky to v4.3.7 5adbc57
  • Update dependency @types/node to v14.14.20 c0cae04
  • Update eslint db09ab7
  • Update dependency np to v7.2.0 d9b08c1
  • Update eslint to v4.11.1 14b08cc
  • Update dependency np to v7.1.0 a3bf21c
  • Update dependency @types/node to v14.14.16 9718318
  • Update eslint c2906bd
  • Update dependency @types/node to v14.14.14 4022a15
  • Update eslint 9baa216
  • Update dependency husky to v4.3.6 26f8a93
  • Update actions/setup-node action to v2 30b147f
  • Update dependency typescript to v4.1.3 761a225
  • Update dependency @types/jest to v26.0.19 f3e83e3
  • Update eslint 6aafb95
  • Update dependency husky to v4.3.5 a4c8b0b
  • Update dependency eslint-config-prettier to v7 402fd08
  • Update dependency lint-staged to v10.5.3 f275184
  • Update dependency @types/jest to v26.0.16 f74f7c1
  • Update dependency prettier to v2.2.1 798f617
  • Update dependency graphql-tools to v7.0.2 60b36a0
  • Update eslint d8b7afe
  • Update dependency @types/node to v14.14.10 48cb264
  • Update dependency lint-staged to v10.5.2 0adaa8b
  • Update dependency prettier to v2.2.0 26fbd7e
  • Update dependency typescript to v4.1.2 b375a40
  • Update dependency @types/node to v14.14.9 813138c
  • Update eslint to v4.8.1 a9e652b
  • Update dependency @types/node to v14.14.7 3cca367
  • Update eslint 7c87d43
  • Update dependency ts-jest to v26.4.4 6c9a9ea
  • Update dependency jest to v26.6.3 58555ac
  • Update eslint to v4.6.1 01ed58c
  • Update dependency typeorm to v0.2.29 2367056
  • Update dependency lint-staged to v10.5.1 a4a785f
  • Update dependency np to v7 9fe2882
  • Update dependency @types/node to v14.14.6 2e51e15
  • Update dependency graphql to v15.4.0 fcf1ba5
  • Update eslint 846071f
  • Update dependency graphql-tools to v7 9254c79
  • Update dependency typescript to v4.0.5 a2977b5
  • Update dependency ts-jest to v26.4.3 9bf462a
  • Update dependency lint-staged to v10.5.0 efae821
  • Update jest 5a0f8a1
  • Update dependency lint-staged to v10.4.2 b9b5247
  • Update dependency @types/node to v14.11.10 bdcf144
  • Update eslint 8e8ef4e
  • Update dependency jest to v26.5.3 fffa920
  • Update dependency @types/node to v14.11.8 8e74c11
  • Update dependency jest to v26.5.2 edb853b
  • Update eslint to v4.4.0 1138abd
  • Update dependency typeorm to v0.2.28 bd330dc
  • Update dependency graphql-tools to v6.2.4 213aba9
  • Update dependency ts-jest to v26.4.1 6530b36
  • Update eslint 7773914

v1.0.0...v1.0.1

v1.0.0

25 Sep 19:16
Compare
Choose a tag to compare
  • Rename npm package to remove org scope bd2cfb7
  • Feature: Enable building relation list for an entity at arbitrary path in query #105
  • Add MIT license file 3749a3f
  • Better documentation fe434c4
  • Update dependency typeorm to v0.2.26 d7c5822

v0.3.1...v1.0.0

Fix deeply embedded entity relations not mapping

21 Aug 03:42
Compare
Choose a tag to compare
  • Merge pull request #74 from madscience/fix-embedded-relations 1dc43ce
  • Fix deeply embedded entity relations not mapping d07e696

v0.3.0...v0.3.1

Support Inline Fragments, Embedded Entities

21 Aug 02:43
Compare
Choose a tag to compare
  • Merge pull request #73 from madscience/embedded-entity 147eee3
  • Enable mapping relations on embedded entities b3e5cf3
  • Return Country from test data 772cc61
  • Add test for nested entities af710e6
  • Add Country, Address test entities/data aaf5dd5
  • Don’t import from typeorm/index 8257f53
  • Merge pull request #63 from madscience/renovate/major-eslint 72c7a93
  • Fix lint ce32319
  • Update eslintrc, enable import order rules 5ae3c52
  • Install eslint-import-resolver-typescript 239729e
  • Fix lint 38fb4ce
  • Update eslint d961c41
  • Merge pull request #72 from madscience/inline-fragments bd22a05
  • Look through inline fragments to find selections c155b22
  • Manually map image sizes in resolver 80b1592
  • Return a Set, not array, to prevent duplicates 7495998
  • Support parsing selection sets w/ inline fragments f391aea
  • Add test for inline fragments 2154132
  • Add videos, MediaTypeUnion to test data/schema 128040f
  • Update dependency @types/node to v14.6.0 7a4fac3
  • Unarchive node_modules during publish job b70e006
  • Correct NPM publishing token secret name 328656a
  • Update jest 9854668
  • Add cleanup workflow to remove old artifacts 219d416
  • Update dependency graphql-tools to v6.0.18 4ffbd00
  • Update dependency np to v6.4.0 2006bd0
  • Update dependency @types/jest to v26.0.9 18b463e
  • Update dependency graphql-tools to v6.0.16 51234e3
  • Update jest 7b17ff1
  • Update dependency @types/node to v14.0.27 c777615
  • Update jest cf7339f
  • Update dependency @types/node to v14.0.26 f18955a
  • Pin dependencies 7b91143
  • Delete Dependabot config 6e8b86f
  • Merge pull request #46 from madscience/renovate/configure 026d94c
  • Update renovate.json 99e7f2a
  • Add renovate.json 506ab04
  • Merge pull request #58 from madscience/github-actions 7d35e7a
  • Generate barrels before build f140b0c
  • Remove jest-junit 5658c3a
  • Remove CircleCI config 28ba1b6
  • Add workflows fb79740
  • Bump jest-junit from 11.0.1 to 11.1.0 8002598
  • Bump @types/jest from 26.0.6 to 26.0.7 4a6673d
  • Bump @types/jest from 26.0.5 to 26.0.6 fa5cf8b
  • Bump graphql-tools from 6.0.14 to 6.0.15 115fbb4
  • Bump @types/jest from 26.0.4 to 26.0.5 28239f2
  • Bump typescript from 3.9.6 to 3.9.7 273574c
  • Bump graphql-tools from 6.0.13 to 6.0.14 436b808
  • [Security] Bump lodash from 4.17.15 to 4.17.19 b5bb707
  • Bump graphql-tools from 6.0.12 to 6.0.13 5621564
  • Bump np from 6.3.1 to 6.3.2 3204705
  • Bump np from 6.3.0 to 6.3.1 ca81653
  • Bump @types/jest from 26.0.3 to 26.0.4 f01fa7e
  • Bump graphql from 15.2.0 to 15.3.0 0da651f
  • Bump np from 6.2.5 to 6.3.0 c1eb5ba
  • Bump graphql-tools from 6.0.11 to 6.0.12 c32ba56
  • Bump typescript from 3.9.5 to 3.9.6 bc3a1dd
  • Bump ts-jest from 25.3.1 to 25.5.1 bb7d3bd
  • Bump sqlite3 from 4.1.1 to 5.0.0 01333c9
  • Bump graphql from 15.1.0 to 15.2.0 bac6ee9
  • Bump np from 6.2.4 to 6.2.5 6fcdccd
  • Bump eslint-plugin-import from 2.21.2 to 2.22.0 5920bd2
  • Bump graphql-tools from 6.0.10 to 6.0.11 5c349b4
  • Bump @types/jest from 26.0.0 to 26.0.3 9a4844d
  • Bump jest-junit from 10.0.0 to 11.0.1 fc605a9
  • Bump lint-staged from 10.2.10 to 10.2.11 d4ccf7d
  • Bump graphql-tools from 6.0.9 to 6.0.10 56316a4
  • Bump eslint-plugin-prettier from 3.1.2 to 3.1.4 d77b681
  • Bump lint-staged from 10.2.9 to 10.2.10 917e026
  • Bump eslint-plugin-import from 2.21.1 to 2.21.2 bf98aa4
  • Bump @types/jest from 25.2.3 to 26.0.0 7590b07
  • Bump graphql-tools from 6.0.7 to 6.0.9 16cd5df
  • Bump graphql from 15.0.0 to 15.1.0 5ddb6d3
  • Bump np from 6.2.3 to 6.2.4 8d22ed4
  • Bump eslint-plugin-import from 2.20.2 to 2.21.1 0168d3e
  • Bump typescript from 3.9.3 to 3.9.5 d443e8b
  • Bump lint-staged from 10.2.8 to 10.2.9 e04bb3b
  • Bump graphql-tools from 6.0.6 to 6.0.7 9776b81
  • Bump lint-staged from 10.2.7 to 10.2.8 d6ce897
  • Bump graphql-tools from 6.0.5 to 6.0.6 3844ca5
  • Bump @types/node from 14.0.7 to 14.0.8 32284e5
  • Bump @types/node from 14.0.6 to 14.0.7 f090225
  • Bump @types/jest from 25.2.1 to 25.2.3 023f547
  • Bump @typescript-eslint/eslint-plugin from 2.26.0 to 2.34.0 ef2cfee
  • Bump jest from 25.2.7 to 25.5.4 5a2d8e9
  • Bump eslint-config-prettier from 6.10.1 to 6.11.0 a53eab6
  • Bump prettier from 2.0.2 to 2.0.5 2a1ae6e
  • Bump @types/node from 12.12.30 to 14.0.6 648d531
  • Bump typeorm from 0.2.24 to 0.2.25 6bdaf1c
  • Bump typescript from 3.8.3 to 3.9.3 9ba4003
  • Bump @typescript-eslint/parser from 2.26.0 to 2.34.0 b7a0140

v0.2.2...v0.3.0

Fix deprecated import from graphql-tools

01 Jun 03:33
Compare
Choose a tag to compare
  • Fix deprecated import from graphql-tools fc5f4a4

v0.2.1...v0.2.2