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

@goldstack/infra

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@goldstack/infra - npm Package Compare versions

Comparing version 0.1.40 to 0.1.41

52

dist/deploymentState.js

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

exports.readTerraformStateVariable = exports.writeDeploymentState = exports.writeDeploymentsState = exports.readDeploymentState = exports.getDeploymentState = exports.readDeploymentsState = exports.hasDeploymentsState = exports.validateDeploymentsState = void 0;
var utils_sh_1 = require("@goldstack/utils-sh");
var utils_config_1 = require("@goldstack/utils-config");
var fs_1 = __importDefault(require("fs"));
var deploymentsStateSchema_json_1 = __importDefault(require("./schemas/deploymentsStateSchema.json"));
var path_1 = __importDefault(require("path"));
var deploymentsStatePath = 'src/state/deployments.json';
exports.validateDeploymentsState = function (
const utils_sh_1 = require("@goldstack/utils-sh");
const utils_config_1 = require("@goldstack/utils-config");
const fs_1 = __importDefault(require("fs"));
const deploymentsStateSchema_json_1 = __importDefault(require("./schemas/deploymentsStateSchema.json"));
const path_1 = __importDefault(require("path"));
const deploymentsStatePath = 'src/state/deployments.json';
exports.validateDeploymentsState = (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
deploymentsState) {
deploymentsState) => {
return utils_config_1.validateConfig(deploymentsState, deploymentsStateSchema_json_1.default, {

@@ -21,6 +21,6 @@ errorMessage: 'Cannot validate deployments state.',

};
exports.hasDeploymentsState = function (packageDir) {
exports.hasDeploymentsState = (packageDir) => {
return fs_1.default.existsSync(packageDir + deploymentsStatePath);
};
exports.readDeploymentsState = function (packageDir, options) {
exports.readDeploymentsState = (packageDir, options) => {
if (!exports.hasDeploymentsState(packageDir)) {

@@ -30,9 +30,9 @@ if (options && options.createIfNotExist) {

}
throw new Error("Deployments state does not exist in " + path_1.default.resolve(packageDir + deploymentsStatePath) + ". Have you deployed this package yet?");
throw new Error(`Deployments state does not exist in ${path_1.default.resolve(packageDir + deploymentsStatePath)}. Have you deployed this package yet?`);
}
var data = JSON.parse(utils_sh_1.read(packageDir + deploymentsStatePath));
const data = JSON.parse(utils_sh_1.read(packageDir + deploymentsStatePath));
return exports.validateDeploymentsState(data);
};
exports.getDeploymentState = function (deploymentsState, deploymentName, options) {
var deploymentState = deploymentsState.find(function (deploymentState) { return deploymentState.name === deploymentName; });
exports.getDeploymentState = (deploymentsState, deploymentName, options) => {
const deploymentState = deploymentsState.find((deploymentState) => deploymentState.name === deploymentName);
if (!deploymentState) {

@@ -44,15 +44,15 @@ if (options && options.createIfNotExist) {

}
throw new Error("Deployment state not defined for deployment '" + deploymentName + "'. Did you already deploy this deployment?");
throw new Error(`Deployment state not defined for deployment '${deploymentName}'. Did you already deploy this deployment?`);
}
return deploymentState;
};
exports.readDeploymentState = function (packageDir, deploymentName, options) {
var deploymentsState = exports.readDeploymentsState(packageDir, options);
exports.readDeploymentState = (packageDir, deploymentName, options) => {
const deploymentsState = exports.readDeploymentsState(packageDir, options);
return exports.getDeploymentState(deploymentsState, deploymentName, options);
};
exports.writeDeploymentsState = function (packageDir, deploymentsState) {
exports.writeDeploymentsState = (packageDir, deploymentsState) => {
utils_sh_1.write(JSON.stringify(deploymentsState, null, 2), packageDir + deploymentsStatePath);
};
exports.writeDeploymentState = function (packageDir, deploymentState) {
var deploymentsState;
exports.writeDeploymentState = (packageDir, deploymentState) => {
let deploymentsState;
if (exports.hasDeploymentsState(packageDir)) {

@@ -64,3 +64,3 @@ deploymentsState = exports.readDeploymentsState(packageDir);

}
var idx = deploymentsState.findIndex(function (deployment) { return deployment.name === deploymentState.name; });
const idx = deploymentsState.findIndex((deployment) => deployment.name === deploymentState.name);
if (idx === -1) {

@@ -74,11 +74,11 @@ deploymentsState.push(deploymentState);

};
exports.readTerraformStateVariable = function (deploymentState, variableName
exports.readTerraformStateVariable = (deploymentState, variableName
// eslint-disable-next-line @typescript-eslint/no-explicit-any
) {
) => {
if (!deploymentState.terraform) {
throw new Error("Terraform configuration not defined in deployment state for " + deploymentState.name + ". Has this package been deployed?");
throw new Error(`Terraform configuration not defined in deployment state for ${deploymentState.name}. Has this package been deployed?`);
}
var tfVar = deploymentState.terraform[variableName];
const tfVar = deploymentState.terraform[variableName];
if (!tfVar) {
throw new Error("Terraform variable '" + variableName + "' not defined in deployment state.");
throw new Error(`Terraform variable '${variableName}' not defined in deployment state.`);
}

@@ -85,0 +85,0 @@ return tfVar.value;

{
"name": "@goldstack/infra",
"version": "0.1.40",
"version": "0.1.41",
"description": "Utilities for defining infrastructure",

@@ -17,3 +17,3 @@ "license": "MIT",

"coverage": "jest --collect-coverage --passWithNoTests --config=./jest.config.js",
"generate:schema": "ts-json-schema-generator --tsconfig tsconfig.generate.json --path './src/types/**/*' --type 'DeploymentsState' -o src/schemas/deploymentsStateSchema.json && ts-json-schema-generator --tsconfig tsconfig.generate.json --path './src/types/**/*' --type 'InfrastructureConfiguration' -o src/schemas/infrastructureConfigurationSchema.json",
"generate:schema": "ts-json-schema-generator --tsconfig tsconfig.generate.json --path './src/types/**/*' --type 'DeploymentsState' -o src/schemas/deploymentsStateSchema.json && ts-json-schema-generator --tsconfig tsconfig.generate.json --path './src/types/**/*' --type 'Deployment' -o src/schemas/infrastructureConfigurationSchema.json",
"prepublishOnly": "yarn run build",

@@ -25,5 +25,5 @@ "publish": "utils-git changed --exec \"yarn npm publish $@\"",

"dependencies": {
"@goldstack/utils-config": "0.1.37",
"@goldstack/utils-config": "0.1.38",
"@goldstack/utils-log": "0.1.36",
"@goldstack/utils-sh": "0.2.2"
"@goldstack/utils-sh": "0.2.3"
},

@@ -30,0 +30,0 @@ "devDependencies": {

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