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

graphcool-yml

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphcool-yml - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

7

dist/Cluster.d.ts

@@ -6,5 +6,6 @@ import 'isomorphic-fetch';

local: boolean;
private clusterToken?;
constructor(name: string, baseUrl: string, token?: string, local?: boolean);
readonly token: string | undefined;
clusterSecret?: string;
private cachedToken?;
constructor(name: string, baseUrl: string, clusterSecret?: string, local?: boolean);
readonly token: string;
getApiEndpoint(serviceName: string, stage: string): string;

@@ -11,0 +12,0 @@ getWSEndpoint(serviceName: string, stage: string): string;

@@ -40,8 +40,9 @@ "use strict";

require("isomorphic-fetch");
var jwt = require("jsonwebtoken");
var Cluster = /** @class */ (function () {
function Cluster(name, baseUrl, token, local) {
function Cluster(name, baseUrl, clusterSecret, local) {
if (local === void 0) { local = true; }
this.name = name;
this.baseUrl = baseUrl;
this.clusterToken = token;
this.clusterSecret = clusterSecret;
this.local = local;

@@ -51,3 +52,17 @@ }

get: function () {
return this.clusterToken;
if (!this.clusterSecret) {
return '';
}
// public clusters just take the token
if (!this.local) {
return this.clusterSecret;
}
if (!this.cachedToken) {
var grants = [{ target: "*/*/*", action: '*' }];
this.cachedToken = jwt.sign({ grants: grants }, this.clusterSecret, {
expiresIn: '10 minutes',
algorithm: 'RS256',
});
}
return this.cachedToken;
},

@@ -54,0 +69,0 @@ enumerable: true,

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

Environment.prototype.addCluster = function (cluster) {
var existingClusterIndex = this.clusters.findIndex(function (c) { return c.name === cluster.name; });
if (existingClusterIndex > -1) {
this.clusters.splice(existingClusterIndex, 1);
}
this.clusters.push(cluster);

@@ -239,3 +243,3 @@ };

host: cluster.baseUrl,
clusterSecret: cluster.token,
clusterSecret: cluster.clusterSecret,
}, _a));

@@ -242,0 +246,0 @@ var _a;

{
"name": "graphcool-yml",
"version": "0.2.2",
"version": "0.3.0",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

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