Skip to content

v0.28.0

Latest

Choose a tag to compare

@github-actions github-actions released this 01 Dec 12:37
42cf041

Minor Changes

  • #347 4b1748e Thanks @n1ru4l! - Add a skipSatisfiability option to composeSchemaContract. A contract only adds @inaccessible to an already composed graph, so when the same services composed successfully without the contract, the satisfiability check cannot find anything new. Skipping it cuts roughly 45% of the time spent composing each contract.

    const base = composeServices(services);
    
    if (!base.errors) {
      const contract = composeSchemaContract(services, filter, true, {
        skipSatisfiability: true,
      });
    }

    The @inaccessible rules that contracts can trigger (for example REFERENCED_INACCESSIBLE, REQUIRED_INACCESSIBLE and ONLY_INACCESSIBLE_CHILDREN) keep running.

  • #347 4b1748e Thanks @n1ru4l! - Add composeServicesWithContracts to compose a supergraph together with its schema contracts.

    Instead of composing all the subgraphs again for every contract, each contract is derived from the composed supergraph: the tag filter is applied to it, and only the rules about @inaccessible run, since those are the only ones a contract can fail. The results are the same as composeServices followed by composeSchemaContract for each contract, at a fraction of the time and memory.
    The document of a contract reuses the definitions it has in common with the supergraph's document, so each contract adds little memory, however many there are.

    const { supergraph, contracts } = composeServicesWithContracts(services, [
      { filter: { include: new Set(["public"]), exclude: new Set() } },
      {
        filter: { include: new Set(), exclude: new Set(["internal"]) },
        removeUnreachableTypes: false,
      },
    ]);

    When the subgraphs fail to compose, each contract is composed from the subgraphs, as before.