Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apollo-graphql

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-graphql - npm Package Compare versions

Comparing version 0.6.1 to 0.9.0

lib/utilities/createHash.d.ts

26

lib/index.js
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultEngineReportingSignature = exports.operationHash = exports.operationRegistrySignature = exports.defaultUsageReportingSignature = exports.defaultOperationRegistrySignature = void 0;
var operationId_1 = require("./operationId");
exports.defaultOperationRegistrySignature = operationId_1.defaultOperationRegistrySignature;
exports.defaultUsageReportingSignature = operationId_1.defaultUsageReportingSignature;
exports.operationRegistrySignature = operationId_1.operationRegistrySignature;
exports.operationHash = operationId_1.operationHash;
exports.defaultEngineReportingSignature = operationId_1.defaultUsageReportingSignature;
__export(require("./schema"));
Object.defineProperty(exports, "defaultOperationRegistrySignature", { enumerable: true, get: function () { return operationId_1.defaultOperationRegistrySignature; } });
Object.defineProperty(exports, "defaultUsageReportingSignature", { enumerable: true, get: function () { return operationId_1.defaultUsageReportingSignature; } });
Object.defineProperty(exports, "operationRegistrySignature", { enumerable: true, get: function () { return operationId_1.operationRegistrySignature; } });
Object.defineProperty(exports, "operationHash", { enumerable: true, get: function () { return operationId_1.operationHash; } });
Object.defineProperty(exports, "defaultEngineReportingSignature", { enumerable: true, get: function () { return operationId_1.defaultUsageReportingSignature; } });
__exportStar(require("./schema"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const apollo_env_1 = require("apollo-env");
exports.operationHash = exports.defaultOperationRegistrySignature = exports.operationRegistrySignature = exports.defaultUsageReportingSignature = void 0;
const transforms_1 = require("./transforms");
const createHash_1 = require("./utilities/createHash");
function defaultUsageReportingSignature(ast, operationName) {

@@ -26,3 +27,3 @@ return transforms_1.printWithReducedWhitespace(transforms_1.sortAST(transforms_1.removeAliases(transforms_1.hideLiterals(transforms_1.dropUnusedDefinitions(ast, operationName)))));

function operationHash(operation) {
return apollo_env_1.createHash("sha256")
return createHash_1.createHash("sha256")
.update(operation)

@@ -29,0 +30,0 @@ .digest("hex");

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.addResolversToSchema = exports.buildSchemaFromSDL = exports.modulesFromSDL = void 0;
const graphql_1 = require("graphql");

@@ -8,4 +12,5 @@ const validate_1 = require("graphql/validation/validate");

const specifiedRules_1 = require("graphql/validation/specifiedRules");
const flat_1 = __importDefault(require("core-js-pure/features/array/flat"));
const validation_1 = require("graphql/validation");
const apollo_env_1 = require("apollo-env");
const mapValues_1 = require("../utilities/mapValues");
const skippedSDLRules = [

@@ -102,3 +107,3 @@ validation_1.KnownTypeNamesRule,

definitions: [
...Object.values(definitionsMap).flat(),
...flat_1.default(Object.values(definitionsMap)),
...missingTypeDefinitions,

@@ -112,3 +117,3 @@ ...directiveDefinitions

kind: graphql_1.Kind.DOCUMENT,
definitions: Object.values(extensionsMap).flat()
definitions: flat_1.default(Object.values(extensionsMap))
}, {

@@ -120,6 +125,5 @@ assumeValidSDL: true

operationTypeMap = {};
const operationTypes = [...schemaDefinitions, ...schemaExtensions]
const operationTypes = flat_1.default([...schemaDefinitions, ...schemaExtensions]
.map(node => node.operationTypes)
.filter(apollo_env_1.isNotNullOrUndefined)
.flat();
.filter(isNotNullOrUndefined));
for (const { operation, type } of operationTypes) {

@@ -136,3 +140,3 @@ operationTypeMap[operation] = type.name.value;

}
schema = new graphql_1.GraphQLSchema(Object.assign(Object.assign({}, schema.toConfig()), apollo_env_1.mapValues(operationTypeMap, typeName => typeName
schema = new graphql_1.GraphQLSchema(Object.assign(Object.assign({}, schema.toConfig()), mapValues_1.mapValues(operationTypeMap, typeName => typeName
? schema.getType(typeName)

@@ -210,2 +214,5 @@ : undefined)));

exports.addResolversToSchema = addResolversToSchema;
function isNotNullOrUndefined(value) {
return value !== null && typeof value !== "undefined";
}
//# sourceMappingURL=buildSchemaFromSDL.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GraphQLSchemaValidationError = void 0;
class GraphQLSchemaValidationError extends Error {

@@ -4,0 +5,0 @@ constructor(errors) {

"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./buildSchemaFromSDL"));
__export(require("./GraphQLSchemaValidationError"));
__export(require("./transformSchema"));
__exportStar(require("./buildSchemaFromSDL"), exports);
__exportStar(require("./GraphQLSchemaValidationError"), exports);
__exportStar(require("./transformSchema"), exports);
__exportStar(require("./resolverMap"), exports);
__exportStar(require("./resolveObject"), exports);
//# sourceMappingURL=index.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transformSchema = void 0;
const graphql_1 = require("graphql");
const apollo_env_1 = require("apollo-env");
const mapValues_1 = require("../utilities/mapValues");
function transformSchema(schema, transformType) {

@@ -54,9 +55,9 @@ const typeMap = Object.create(null);

function replaceFields(fieldsMap) {
return apollo_env_1.mapValues(fieldsMap, field => (Object.assign(Object.assign({}, field), { type: replaceType(field.type), args: field.args ? replaceArgs(field.args) : undefined })));
return mapValues_1.mapValues(fieldsMap, field => (Object.assign(Object.assign({}, field), { type: replaceType(field.type), args: field.args ? replaceArgs(field.args) : undefined })));
}
function replaceInputFields(fieldsMap) {
return apollo_env_1.mapValues(fieldsMap, field => (Object.assign(Object.assign({}, field), { type: replaceType(field.type) })));
return mapValues_1.mapValues(fieldsMap, field => (Object.assign(Object.assign({}, field), { type: replaceType(field.type) })));
}
function replaceArgs(args) {
return apollo_env_1.mapValues(args, arg => (Object.assign(Object.assign({}, arg), { type: replaceType(arg.type) })));
return mapValues_1.mapValues(args, arg => (Object.assign(Object.assign({}, arg), { type: replaceType(arg.type) })));
}

@@ -63,0 +64,0 @@ }

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.printWithReducedWhitespace = exports.removeAliases = exports.sortAST = exports.dropUnusedDefinitions = exports.hideStringAndNumericLiterals = exports.hideLiterals = void 0;
const visitor_1 = require("graphql/language/visitor");

@@ -8,0 +9,0 @@ const printer_1 = require("graphql/language/printer");

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isDocumentNode = exports.isNode = void 0;
const graphql_1 = require("graphql");

@@ -4,0 +5,0 @@ function isNode(maybeNode) {

{
"name": "apollo-graphql",
"version": "0.6.1",
"version": "0.9.0",
"description": "Apollo GraphQL utility library",

@@ -14,3 +14,3 @@ "main": "lib/index.js",

"dependencies": {
"apollo-env": "^0.6.6",
"core-js-pure": "^3.10.2",
"lodash.sortby": "^4.7.0"

@@ -47,3 +47,3 @@ },

},
"gitHead": "3c073ffd5297c5c8db188184e99ad2cb3d50ebcc"
"gitHead": "6fc550b6f8ddfbfb0c8455f0831bc8fbad33c716"
}

@@ -56,3 +56,2 @@ // In Apollo Studio, we want to group requests making the same query together,

import { DocumentNode } from "graphql";
import { createHash } from "apollo-env";
import {

@@ -66,2 +65,3 @@ printWithReducedWhitespace,

} from "./transforms";
import { createHash } from "./utilities/createHash";

@@ -68,0 +68,0 @@ // The usage reporting signature function consists of removing extra whitespace,

@@ -28,2 +28,8 @@ import {

import { specifiedSDLRules } from "graphql/validation/specifiedRules";
// TODO(Node.js 10): When we deprecate Node.js 10, remove this and switch
// to using `Array.prototype.flat`. When doing this, deleting the hand-rolled
// types in `./packages/apollo-gateway/src/types/` that go with it.
import flat from "core-js-pure/features/array/flat";
import {

@@ -34,3 +40,3 @@ KnownTypeNamesRule,

} from "graphql/validation";
import { mapValues, isNotNullOrUndefined } from "apollo-env";
import { mapValues } from "../utilities/mapValues";

@@ -161,3 +167,3 @@ export interface GraphQLSchemaModule {

definitions: [
...Object.values(definitionsMap).flat(),
...flat(Object.values(definitionsMap)),
...missingTypeDefinitions,

@@ -176,3 +182,3 @@ ...directiveDefinitions

kind: Kind.DOCUMENT,
definitions: Object.values(extensionsMap).flat()
definitions: flat(Object.values(extensionsMap))
},

@@ -189,6 +195,7 @@ {

const operationTypes = [...schemaDefinitions, ...schemaExtensions]
.map(node => node.operationTypes)
.filter(isNotNullOrUndefined)
.flat();
const operationTypes = flat(
[...schemaDefinitions, ...schemaExtensions]
.map(node => node.operationTypes)
.filter(isNotNullOrUndefined)
);

@@ -303,1 +310,5 @@ for (const { operation, type } of operationTypes) {

}
function isNotNullOrUndefined<T>(value: T | null | undefined): value is T {
return value !== null && typeof value !== "undefined";
}

@@ -24,3 +24,3 @@ import {

} from "graphql";
import { mapValues } from "apollo-env";
import { mapValues } from "../utilities/mapValues";

@@ -27,0 +27,0 @@ type TypeTransformer = (

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc