New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

netlify-plugin-dm

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

netlify-plugin-dm - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

29

index.js

@@ -1,16 +0,33 @@

const { getRoutes } = require('./routes');
const { getRoutes, updateRoute } = require('./routes');
const fs = require('fs')
const yaml = require('js-yaml');
const { VGS_CLIENT_ID, VGS_CLIENT_SECRET, VGS_VAULT_ID} = process.env;
async function run() {
console.log('run');
const routes = await getRoutes('tntdx8oynfd');
console.log('routes', routes);
// const routes = await getRoutes('tntdx8oynfd');
// console.log('routes', routes);
}
function getRouteConfig(path = './vgs/routes.yaml') {
if (fs.existsSync(path)) {
return yaml.load(fs.readFileSync(path, 'utf8'));
} else {
return null;
}
}
module.exports = {
onPreBuild: async ({ constants }) => {
onPreBuild: async (params) => {
console.log("Hello world from onPreBuild event!")
console.log('constants', constants);
console.log('params', params);
await run();
// await run();
const routeConfig = getRouteConfig();
if(routeConfig) {
await updateRoute(VGS_VAULT_ID, routeConfig);
}
},
}
{
"name": "netlify-plugin-dm",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -8,2 +8,3 @@ "main": "index.js",

"axios": "^0.25.0",
"js-yaml": "^4.1.0",
"simple-oauth2": "^4.3.0"

@@ -10,0 +11,0 @@ },

@@ -25,3 +25,3 @@ const {

async function createInboundRoute(vaultApiUrl, tenantId, route, refreshToken) {
async function createRoute(vaultApiUrl, tenantId, route, refreshToken) {
const accessToken = await getAccessToken(refreshToken);

@@ -40,14 +40,18 @@

async function updateInboundRoute(vaultApiUrl, tenantId, route, refreshToken) {
const accessToken = await getAccessToken(refreshToken);
const url = `${vaultApiUrl}/rule-chains/${route.id}`;
async function updateRoute(tenantId, route) {
console.log('updateRoute', route.data)
const accessToken = await getAccessToken();
const url = `${vaultApiUrl}/rule-chains/${route.data[0].id}`;
const params = {
method: 'PUT',
headers: makeHeaders(accessToken, tenantId),
data: route,
data: route.data,
};
const response = await fetchJSONApi(url, params);
return response.data.data;
try {
const response = await fetchJSONApi(url, params);
return response.data.data;
} catch (error) {
console.log('updateRoute error', error);
}
}

@@ -57,4 +61,4 @@

getRoutes,
updateInboundRoute,
createInboundRoute,
updateRoute,
createRoute,
}
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