Socket
Socket
Sign inDemoInstall

apollo-utilities

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apollo-utilities - npm Package Compare versions

Comparing version 0.1.1-1 to 0.2.0-alpha.2

src/__tests__/directives.ts

2

lib/getFromAST.d.ts
import { DocumentNode, OperationDefinitionNode, FragmentDefinitionNode } from 'graphql';
export declare function getMutationDefinition(doc: DocumentNode): OperationDefinitionNode;
export declare function checkDocument(doc: DocumentNode): void;
export declare function getOperationName(doc: DocumentNode): string | undefined;
export declare function getOperationName(doc: DocumentNode): string | null;
export declare function getFragmentDefinitions(doc: DocumentNode): FragmentDefinitionNode[];

@@ -6,0 +6,0 @@ export declare function getQueryDefinition(doc: DocumentNode): OperationDefinitionNode;

@@ -39,7 +39,7 @@ "use strict";

function getOperationName(doc) {
return doc.definitions
return (doc.definitions
.filter(function (definition) {
return definition.kind === 'OperationDefinition' && definition.name;
})
.map(function (x) { return x.name.value; })[0];
.map(function (x) { return x.name.value; })[0] || null);
}

@@ -46,0 +46,0 @@ exports.getOperationName = getOperationName;

{
"name": "apollo-utilities",
"version": "0.1.1-1",
"version": "0.2.0-alpha.2",
"description": "Utilities for working with GraphQL ASTs",

@@ -23,47 +23,39 @@ "author": "James Baxley <james@meteor.com>",

"scripts": {
"pretest": "npm run build",
"test": "npm run test-only --",
"posttest": "npm run lint",
"test-only": "mocha --reporter spec --full-trace dist/tests/tests.js",
"test-watch": "mocha --reporter spec --full-trace dist/tests/tests.js --watch",
"coverage": "istanbul cover ./node_modules/.bin/_mocha -- --reporter dot --full-trace dist/tests/tests.js",
"postcoverage": "remap-istanbul --input coverage/coverage.json --type lcovonly --output coverage/lcov.info",
"lint": "tslint --type-check -p tsconfig.json src/*.ts && tslint --type-check -p tsconfig.json tests/*.ts",
"prebuild": "npm run clean:dist",
"test": "jest",
"coverage": "jest --coverage",
"lint": "tslint --type-check -p tsconfig.json src/*.ts",
"prebuild": "npm run clean",
"build": "tsc -p .",
"postbuild": "cp -R ./dist/src/. ./lib",
"watch": "tsc -w -p .",
"clean": "npm run clean:dist && npm run clean:coverage",
"clean:dist": "rimraf dist/* && rimraf lib/*",
"clean:coverage": "rimraf coverage/*",
"clean": "rimraf lib/* && rimraf coverage/*",
"prepublishOnly": "npm run clean && npm run build",
"compile:browser": "browserify ./dist/src/index.js -o=./dist/index.js && npm run minify:browser",
"minify:browser": "uglifyjs -c -m -o ./dist/index.min.js -- ./dist/index.js",
"filesize": "npm run build && npm run compile:browser"
"build:browser":
"browserify ./lib/index.js -o=./lib/bundle.js && npm run minify:browser",
"minify:browser":
"uglifyjs -c -m -o ./lib/bundle.min.js -- ./lib/bundle.js",
"filesize": "npm run build && npm run build:browser"
},
"dependencies": {},
"devDependencies": {
"@types/chai": "^4.0.0",
"@types/chai-as-promised": "0.0.31",
"@types/graphql": "~0.9.0",
"@types/jest": "^20.0.7",
"@types/lodash": "^4.14.72",
"@types/mocha": "^2.2.31",
"@types/node": "^8.0.20",
"@types/sinon": "^2.3.2",
"browserify": "^14.4.0",
"chai": "^4.0.2",
"chai-as-promised": "^7.0.0",
"graphql": "^0.10.3",
"graphql-tag": "^2.4.2",
"istanbul": "^0.4.4",
"jest": "^20.0.4",
"lodash": "^4.17.4",
"mocha": "^3.2.0",
"remap-istanbul": "^0.9.0",
"rimraf": "^2.5.4",
"sinon": "^2.3.4",
"source-map-support": "^0.4.5",
"ts-jest": "^20.0.10",
"tslint": "^5.0.0",
"typescript": "^2.2.1",
"uglifyjs": "^2.4.11"
},
"jest": {
"transform": {
".(ts|tsx)": "<rootDir>/node_modules/ts-jest/preprocessor.js"
},
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
"moduleFileExtensions": ["ts", "tsx", "js", "json"]
}
}

@@ -62,9 +62,11 @@ import {

export function getOperationName(doc: DocumentNode): string | undefined {
return doc.definitions
.filter(
definition =>
definition.kind === 'OperationDefinition' && definition.name,
)
.map((x: OperationDefinitionNode) => x.name.value)[0];
export function getOperationName(doc: DocumentNode): string | null {
return (
doc.definitions
.filter(
definition =>
definition.kind === 'OperationDefinition' && definition.name,
)
.map((x: OperationDefinitionNode) => x.name.value)[0] || null
);
}

@@ -71,0 +73,0 @@

@@ -10,4 +10,4 @@ {

"declaration": true,
"rootDir": ".",
"outDir": "dist",
"rootDir": "./src",
"outDir": "lib",
"noImplicitAny": true,

@@ -18,3 +18,4 @@ "noUnusedParameters": false,

},
"include": ["src/**/*.ts", "tests/**/*.ts"]
"include": ["src/**/*.ts"],
"exclude": ["src/**/__tests__/*.ts"]
}

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

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