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

@db-auto/environments

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@db-auto/environments - npm Package Compare versions

Comparing version 0.0.28 to 0.0.29

10

dist/src/environments.d.ts

@@ -1,2 +0,2 @@

import { ErrorsAnd, NameAnd, NameAndValidator } from "@db-auto/utils";
import { ColumnDefn, ErrorsAnd, NameAnd, NameAndValidator } from "@db-auto/utils";
import { PostgresEnv } from "@db-auto/postgres";

@@ -21,1 +21,9 @@ export type Environment = PostgresEnv;

export declare function dalFor(env: Environment): import("@db-auto/dal").Dal;
export interface EnvStatus {
name: string;
up: boolean;
env: CleanEnvironment;
}
export declare function envIsUp(env: CleanEnvironment): Promise<boolean>;
export declare function checkStatus(envs: NameAnd<CleanEnvironment>): Promise<NameAnd<EnvStatus>>;
export declare const statusColDefn: NameAnd<ColumnDefn<EnvStatus>>;

@@ -25,4 +25,13 @@ "use strict";

};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.dalFor = exports.sqlDialect = exports.environmentValidator = exports.cleanEnvironment = exports.currentEnvironment = exports.saveEnvName = exports.currentEnvName = void 0;
exports.statusColDefn = exports.checkStatus = exports.envIsUp = exports.dalFor = exports.sqlDialect = exports.environmentValidator = exports.cleanEnvironment = exports.currentEnvironment = exports.saveEnvName = exports.currentEnvName = void 0;
const utils_1 = require("@db-auto/utils");

@@ -108,1 +117,37 @@ const postgres_1 = require("@db-auto/postgres");

exports.dalFor = dalFor;
//TODO do in parallel
function envIsUp(env) {
return __awaiter(this, void 0, void 0, function* () {
let dal = dalFor(env);
try {
const dialect = sqlDialect(env.type);
yield dal.query(dialect.safeQuery);
return true;
}
catch (e) {
return false;
}
finally {
yield dal.close();
}
});
}
exports.envIsUp = envIsUp;
function checkStatus(envs) {
return __awaiter(this, void 0, void 0, function* () {
let result = {};
for (const [name, env] of Object.entries(envs))
result[name] = { name, env, up: yield envIsUp(env) };
return result;
});
}
exports.checkStatus = checkStatus;
exports.statusColDefn = {
"Environment": { dataFn: (t) => t.name },
"Type": { dataFn: (t) => t.env.type },
"Host": { dataFn: (t) => t.env.host },
"Port": { dataFn: (t) => t.env.port === undefined ? '' : t.env.port.toString() },
"Database": { dataFn: (t) => t.env.database },
"UserName": { dataFn: (t) => t.env.username },
"Up": { dataFn: (t) => t.up.toString() },
};

10

package.json
{
"name": "@db-auto/environments",
"description": "",
"version": "0.0.28",
"version": "0.0.29",
"main": "dist/index",

@@ -20,6 +20,6 @@ "types": "dist/index",

"dependencies": {
"@db-auto/utils": "0.0.28",
"@db-auto/postgres": "0.0.28",
"@db-auto/mysql": "0.0.28",
"@db-auto/oracle": "0.0.28"
"@db-auto/utils": "0.0.29",
"@db-auto/postgres": "0.0.29",
"@db-auto/mysql": "0.0.29",
"@db-auto/oracle": "0.0.29"
},

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

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