interface resolver {
    use directive.{field-definition-directive};
    use error.{error};
    use headers.{headers};

    record field-output {
        // list in the same order as input.edges with data serialized in CBOR
        outputs: list<result<list<u8>, error>>
    }

    // for each input and each edges inside we return a result<list<u8>, error>,
    // serialized data with an error.
    resolve-field: func(
        headers: headers,
        subgraph-name: string,
        directive: field-definition-directive,
        inputs: list<list<u8>>
    ) -> result<field-output, error>;

    // This function generates a unique key for a GraphQL subscription.
    //
    // The key is used to share the same subscription between multiple clients.
    // The extension decides what makes a subscription unique. If the value is none,
    // then it is considered not unique and every subscriber gets their own subscription.
    subscription-key: func(
        headers: headers,
        subgraph-name: string,
        directive: field-definition-directive,
    ) -> result<option<list<u8>>, error>;

    // initializes a new subscription stream
    resolve-subscription: func(
        headers: headers,
        subgraph-name: string,
        directive: field-definition-directive,
    ) -> result<_, error>;

    // resolves the next item in a subscription stream. must be called after resolve-field-subscription
    resolve-next-subscription-item: func() -> result<option<field-output>, error>;
}
