Socket
Socket
Sign inDemoInstall

graphql-config

Package Overview
Dependencies
Maintainers
4
Versions
319
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-config - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

15

lib/__tests__/endpoint-extension/string-refs.js

@@ -44,3 +44,4 @@ "use strict";

ava_1.default.beforeEach(function () {
endpoints = _1.getGraphQLProjectConfig().endpointsExtension;
endpoints = _1.getGraphQLProjectConfig(__dirname)
.endpointsExtension;
});

@@ -59,3 +60,5 @@ ava_1.default('getEndpointsMap', function (t) { return __awaiter(_this, void 0, void 0, function () {

return __generator(this, function (_a) {
t.deepEqual(endpoints.getEnvVarsForEndpoint('default'), { TEST_ENDPOINT_URL: null });
t.deepEqual(endpoints.getEnvVarsForEndpoint('default'), {
TEST_ENDPOINT_URL: null,
});
return [2 /*return*/];

@@ -69,3 +72,5 @@ });

process.env['TEST_ENDPOINT_URL'] = testURL;
t.deepEqual(endpoints.getEnvVarsForEndpoint('default'), { TEST_ENDPOINT_URL: testURL });
t.deepEqual(endpoints.getEnvVarsForEndpoint('default'), {
TEST_ENDPOINT_URL: testURL,
});
delete process.env['TEST_ENDPOINT_URL'];

@@ -88,3 +93,5 @@ return [2 /*return*/];

t.notThrows(function () {
return endpoints.getEndpoint('default', { TEST_ENDPOINT_URL: 'http://127.0.0.1:33333' }).resolveSchema();
return endpoints
.getEndpoint('default', { TEST_ENDPOINT_URL: 'http://127.0.0.1:33333' })
.resolveSchema();
});

@@ -91,0 +98,0 @@ return [2 /*return*/];

@@ -47,3 +47,3 @@ "use strict";

case 0:
config = _1.getGraphQLProjectConfig();
config = _1.getGraphQLProjectConfig(__dirname);
return [4 /*yield*/, config.resolveIntrospection()];

@@ -50,0 +50,0 @@ case 1:

@@ -21,3 +21,3 @@ "use strict";

}
var ConfigNotFoundError = (function (_super) {
var ConfigNotFoundError = /** @class */ (function (_super) {
__extends(ConfigNotFoundError, _super);

@@ -24,0 +24,0 @@ function ConfigNotFoundError(message) {

@@ -29,3 +29,2 @@ import { GraphQLClient } from 'graphql-request';

getRawEndpointsMap(): GraphQLConfigEnpointsMap;
private getRawEndpoint(endpointName?);
getEnvVarsForEndpoint(endpointName: string): {

@@ -37,2 +36,3 @@ [name: string]: string | null;

}): GraphQLEndpoint;
private getRawEndpoint(endpointName?);
}

@@ -39,0 +39,0 @@ export declare class GraphQLEndpoint {

@@ -49,3 +49,3 @@ "use strict";

var resolveRefString_1 = require("./resolveRefString");
var GraphQLEndpointsExtension = (function () {
var GraphQLEndpointsExtension = /** @class */ (function () {
function GraphQLEndpointsExtension(endpointConfig, configPath) {

@@ -68,2 +68,16 @@ this.raw = endpointConfig;

};
GraphQLEndpointsExtension.prototype.getEnvVarsForEndpoint = function (endpointName) {
return resolveRefString_1.getUsedEnvs(this.getRawEndpoint(endpointName));
};
GraphQLEndpointsExtension.prototype.getEndpoint = function (endpointName, env) {
if (env === void 0) { env = process.env; }
var endpoint = this.getRawEndpoint(endpointName);
try {
return new GraphQLEndpoint(resolveRefString_1.resolveEnvsInValues(endpoint, env));
}
catch (e) {
e.message = this.configPath + ": " + e.message;
throw e;
}
};
GraphQLEndpointsExtension.prototype.getRawEndpoint = function (endpointName) {

@@ -78,3 +92,3 @@ if (endpointName === void 0) { endpointName = process.env.GRAPHQL_CONFIG_ENDPOINT_NAME; }

else {
throw new Error("You have to specify endpoint name or define GRAPHQL_CONFIG_ENDPOINT_NAME enviroment variable");
throw new Error('You have to specify endpoint name or define GRAPHQL_CONFIG_ENDPOINT_NAME enviroment variable');
}

@@ -88,24 +102,11 @@ }

if (!endpoint.url) {
throw new Error(this.configPath + ": \"url\" is required but is not specified for \"" + endpointName + "\" endpoint");
throw new Error(this
.configPath + ": \"url\" is required but is not specified for \"" + endpointName + "\" endpoint");
}
return endpoint;
};
GraphQLEndpointsExtension.prototype.getEnvVarsForEndpoint = function (endpointName) {
return resolveRefString_1.getUsedEnvs(this.getRawEndpoint(endpointName));
};
GraphQLEndpointsExtension.prototype.getEndpoint = function (endpointName, env) {
if (env === void 0) { env = process.env; }
var endpoint = this.getRawEndpoint(endpointName);
try {
return new GraphQLEndpoint(resolveRefString_1.resolveEnvsInValues(endpoint, env));
}
catch (e) {
e.message = this.configPath + ": " + e.message;
throw e;
}
};
return GraphQLEndpointsExtension;
}());
exports.GraphQLEndpointsExtension = GraphQLEndpointsExtension;
var GraphQLEndpoint = (function () {
var GraphQLEndpoint = /** @class */ (function () {
function GraphQLEndpoint(resolvedConfig) {

@@ -112,0 +113,0 @@ Object.assign(this, resolvedConfig);

export declare const GRAPHQL_CONFIG_NAME = ".graphqlconfig";
export declare const GRAPHQL_CONFIG_YAML_NAME = ".graphqlconfig.yaml";
export declare const GRAPHQL_CONFIG_YML_NAME = ".graphqlconfig.yaml";
export declare function findGraphQLConfigFile(filePath: string): string;

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

exports.GRAPHQL_CONFIG_YAML_NAME = '.graphqlconfig.yaml';
exports.GRAPHQL_CONFIG_YML_NAME = '.graphqlconfig.yaml';
function isRootDir(path) {

@@ -15,3 +16,4 @@ return path_1.dirname(path) === path;

if (filePath.endsWith(exports.GRAPHQL_CONFIG_NAME) ||
filePath.endsWith(exports.GRAPHQL_CONFIG_YAML_NAME)) {
filePath.endsWith(exports.GRAPHQL_CONFIG_YAML_NAME) ||
filePath.endsWith(exports.GRAPHQL_CONFIG_YML_NAME)) {
return filePath;

@@ -28,2 +30,5 @@ }

}
if (fs_1.existsSync(configPath + '.yml')) {
return configPath + '.yml';
}
currentDir = path_1.dirname(currentDir);

@@ -30,0 +35,0 @@ }

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

var GraphQLProjectConfig_1 = require("./GraphQLProjectConfig");
var GraphQLConfig = (function () {
var GraphQLConfig = /** @class */ (function () {
function GraphQLConfig(config, configPath) {

@@ -9,0 +9,0 @@ utils_1.validateConfig(config);

@@ -54,3 +54,3 @@ "use strict";

*/
var GraphQLProjectConfig = (function () {
var GraphQLProjectConfig = /** @class */ (function () {
function GraphQLProjectConfig(config, configPath, projectName) {

@@ -57,0 +57,0 @@ utils_1.validateConfig(config);

@@ -55,3 +55,3 @@ "use strict";

var rawConfig = fs_1.readFileSync(configPath, 'utf-8');
if (configPath.endsWith('.yaml')) {
if (configPath.endsWith('.yaml') || configPath.endsWith('.yml')) {
config = yaml.safeLoad(rawConfig);

@@ -58,0 +58,0 @@ }

{
"name": "graphql-config",
"version": "1.0.7",
"version": "1.0.8",
"description": "The easiest way to configure your development environment with your GraphQL schema (supported by most tools, editors & IDEs)",

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

"build": "npm run clean && tsc",
"copy-test-assets": "cpx \"src/**/{.graphqlconfig,.graphqlconfig.yaml,*.json}\" lib",
"copy-test-assets": "cpx \"src/**/{.graphqlconfig,.graphqlconfig.yml,.graphqlconfig.yaml,*.json}\" lib",
"test-only": "npm run build && npm run copy-test-assets && ava --verbose lib/__tests__/**/*.js --serial",

@@ -51,21 +51,21 @@ "test": "tslint src/**/*.ts && npm run test-only"

"devDependencies": {
"@types/graphql": "^0.11.4",
"@types/node": "^8.0.31",
"@types/graphql": "^0.11.6",
"@types/node": "^8.0.53",
"@types/node-fetch": "1.6.7",
"ava": "^0.22.0",
"babel-polyfill": "^6.16.0",
"ava": "^0.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"cpx": "^1.5.0",
"tslint": "^5.7.0",
"tslint-config-standard": "^6.0.1",
"typescript": "^2.1.0-dev.20160805"
"tslint": "^5.8.0",
"tslint-config-standard": "^7.0.0",
"typescript": "^2.6.1"
},
"dependencies": {
"graphql": "^0.11.6",
"graphql-request": "^1.2.0",
"js-yaml": "^3.9.0",
"graphql": "^0.11.7",
"graphql-request": "^1.4.0",
"js-yaml": "^3.10.0",
"minimatch": "^3.0.4",
"rimraf": "^2.6.1"
"rimraf": "^2.6.2"
}
}
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