igpapi — Instagram private API Simulator for Node.js (API reference) 4.19.0
    Preparing search index...

    Function decodeGraphqlResponse

    • Decode a GraphQL response body against schema. The body may carry several concatenated JSON documents (GraphQL incremental delivery — @defer/ @stream), so it is split and merged first; the requested root field may therefore arrive in a later patch, and the answer's errors survive the merge from whichever chunk carried them. A root field the server aliased is also put under its exact name before decoding, so a schema written against the field name reads it either way. The merged payload is then read by the one verdict graphqlMutationAccepted reads: the server's refusal — its errors beside no answer, an absent root field or a null one included — is raised as a GraphqlServerError, and a payload with neither the root field nor errors is a GraphqlRootFieldMissingError — either rather than letting a raw parse/shape failure surface as a TypeError downstream. A root field present with its value decodes, errors beside it included.

      Type Parameters

      • S extends Top

      Parameters

      • body: string
      • rootFieldName: string
      • schema: S

      Returns Effect<
          S["Type"],
          | ParseError
          | SchemaError
          | GraphqlRootFieldMissingError
          | GraphqlServerError,
          S["DecodingServices"],
      >