How to use the apollo-graphql.operationHash function in apollo-graphql

To help you get started, we’ve selected a few apollo-graphql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apollographql / apollo-tooling / packages / apollo / src / utils / getOperationManifestFromProject.ts View on Github external
([operationName, operationAST]) => {
      const printed = defaultOperationRegistrySignature(
        operationAST,
        operationName
      );

      return {
        signature: operationHash(printed),
        document: printed,
        // TODO: unused. Remove or repurpose this field altogether with op. registry 2.0 work.
        // For now, this field is non-nullable on the input type.
        metadata: {
          engineSignature: ""
        }
      };
    }
  );
github apollographql / apollo-tooling / packages / apollo / src / commands / client / push.ts View on Github external
const operationDefinition = document.definitions.find(
          ({ kind }) => kind === "OperationDefinition"
        );
        const relativePath =
          operationDefinition &&
          operationDefinition.loc &&
          relative(
            config.configURI ? config.configURI.fsPath : "",
            URI.parse(operationDefinition.loc.source.name).fsPath
          );
        const line =
          operationDefinition &&
          operationDefinition.loc &&
          operationDefinition.loc.source.locationOffset.line;
        return [
          operationHash(
            defaultOperationRegistrySignature(document, operationName)
          ),
          {
            operationName,
            document,
            file: line ? `${relativePath}:${line}` : relativePath || ""
          }
        ];
      }
    )