Crate harmonizer[][src]

Harmonizer

This harmonizer offers the ability to invoke a bundled version of the JavaScript library, @apollo/federation, which composes multiple subgraphs into a supergraph.

The bundled version of the federation library that is included is a JavaScript Immediately Invoked Function Expression (IIFE) that is created by running the Rollup.js bundler on the @apollo/federation package.

When the harmonize function that this crate provides is called with a ServiceList (which is synonymous with the terminology and service list notion that exists within the JavaScript composition library), this crate uses deno_core to invoke the JavaScript within V8. This is ultimately accomplished using rusty_v8’s V8 bindings to V8.

While we intend for a future version of composition to be done natively within Rust, this allows us to provide a more stable transition using an already stable composition implementation while we work toward something else.

Structs

CompositionError

An error which occurred during JavaScript composition.

CompositionErrorExtensions

Mimicking the JavaScript-world from which this error comes, this represents the extensions property of a JavaScript GraphQLError from the [graphql-js] library. Such errors are created when errors have prevented successful composition, which is accomplished using errorWithCode. An example of this can be seen within the federation-js JavaScript library.

ServiceDefinition

The ServiceDefinition represents everything we need to know about a service (subgraph) for its GraphQL runtime responsibilities. It is not at all different from the notion of ServiceDefinition in TypeScript used in Apollo Gateway’s operation.

Functions

harmonize

The harmonize function receives a ServiceList and invokes JavaScript composition on it.

Type Definitions

ServiceList

An ordered stack of the services (subgraphs) that, when composed in order by the composition algorithm, will represent the supergraph.