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

@dbpath/environments

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dbpath/environments - npm Package Compare versions

Comparing version 0.2.17 to 0.2.18

10

dist/src/environment.fixture.js

@@ -5,8 +5,10 @@ "use strict";

const environments_1 = require("./environments");
const envWithoutUsernamePassword = { type: 'postgres', host: 'localhost', port: 5432, 'database': 'postgres' };
const env = Object.assign(Object.assign({}, envWithoutUsernamePassword), { username: 'phil', password: 'phil' });
const postgressEnvWithoutUsernamePassword = { type: 'postgres', host: 'localhost', schema: 'public', port: 5432, 'database': 'postgres' };
const postgresEnv = Object.assign(Object.assign({}, postgressEnvWithoutUsernamePassword), { username: 'phil', password: 'phil' });
const oracle = { connection: "someConnect", schema: "someSchema", type: 'oracle', username: 'phil', password: 'phil' };
exports.environment = {
"dev": env,
"test": envWithoutUsernamePassword
"dev": postgresEnv,
"test": postgressEnvWithoutUsernamePassword,
"oracle": oracle,
};
exports.cleanEnv = (0, environments_1.cleanEnvironment)(process.env, exports.environment);

22

dist/src/environment.spec.js

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

describe("environment", () => {
it("should validate", () => {
it("should validate postgress", () => {
expect((0, environments_1.environmentValidator)("prefix")(environment_fixture_1.environment.dev)).toEqual([]);
expect((0, environments_1.environmentValidator)("prefix")(environment_fixture_1.environment.test)).toEqual([]);
expect((0, environments_1.environmentValidator)("prefix")({ type: 'postgres' })).toEqual([
"prefix.schema is undefined",
"prefix.port is undefined",

@@ -16,5 +17,12 @@ "prefix.host is undefined",

expect((0, environments_1.environmentValidator)("prefix")(Object.assign(Object.assign({}, environment_fixture_1.environment), { "type": "theUnknownOne" }))).toEqual([
"Unknown environment type theUnknownOne. Currently on postgres is supported. {\"dev\":{\"type\":\"postgres\",\"host\":\"localhost\",\"port\":5432,\"database\":\"postgres\",\"username\":\"phil\",\"password\":\"phil\"},\"test\":{\"type\":\"postgres\",\"host\":\"localhost\",\"port\":5432,\"database\":\"postgres\"},\"type\":\"theUnknownOne\"}"
"Unknown environment type theUnknownOne. Currently only postgres and oracle are supported. {\"dev\":{\"type\":\"postgres\",\"host\":\"localhost\",\"schema\":\"public\",\"port\":5432,\"database\":\"postgres\",\"username\":\"phil\",\"password\":\"phil\"},\"test\":{\"type\":\"postgres\",\"host\":\"localhost\",\"schema\":\"public\",\"port\":5432,\"database\":\"postgres\"},\"oracle\":{\"connection\":\"someConnect\",\"schema\":\"someSchema\",\"type\":\"oracle\",\"username\":\"phil\",\"password\":\"phil\"},\"type\":\"theUnknownOne\"}"
]);
});
it("should validate oracle", () => {
expect((0, environments_1.environmentValidator)("prefix")(environment_fixture_1.environment.oracle)).toEqual([]);
expect((0, environments_1.environmentValidator)("prefix")({ type: 'oracle' })).toEqual([
"prefix.schema is undefined",
"prefix.connection is undefined"
]);
});
});

@@ -30,5 +38,14 @@ describe("cleanEnv", () => {

"port": 5432,
"schema": "public",
"type": "postgres",
"username": "phil"
},
"oracle": {
"connection": "someConnect",
"name": "oracle",
"password": "phil",
"schema": "someSchema",
"type": "oracle",
"username": "phil"
},
"test": {

@@ -40,2 +57,3 @@ "database": "postgres",

"port": 5432,
"schema": "public",
"type": "postgres",

@@ -42,0 +60,0 @@ "username": "testUser"

@@ -6,3 +6,3 @@ import { ErrorsAnd, NameAnd, NameAndValidator } from "@dbpath/utils";

export declare const dbPathDir = ".dbpath";
export type Environment = PostgresEnv;
export type Environment = PostgresEnv | OracleEnv;
export declare const stateFileName = "dbpath.state.json";

@@ -9,0 +9,0 @@ export declare function currentEnvName(cwd: string, marker: string, env: string | undefined, cleanE: NameAnd<CleanEnvironment>): ErrorsAnd<string>;

@@ -118,3 +118,5 @@ "use strict";

return (0, postgres_1.postgresEnvValidator)(name)(env);
return [`Unknown environment type ${env.type}. Currently on postgres is supported. ${JSON.stringify(env)}`];
if (env.type === 'oracle')
return (0, oracle_1.oracleEnvValidator)(name)(env);
return [`Unknown environment type ${env.type}. Currently only postgres and oracle are supported. ${JSON.stringify(env)}`];
};

@@ -121,0 +123,0 @@ exports.environmentValidator = environmentValidator;

{
"name": "@dbpath/environments",
"description": "",
"version": "0.2.17",
"version": "0.2.18",
"main": "dist/index",

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

"dependencies": {
"@dbpath/utils": "0.2.17",
"@dbpath/files": "0.2.17",
"@dbpath/postgres": "0.2.17",
"@dbpath/mysql": "0.2.17",
"@dbpath/oracle": "0.2.17"
"@dbpath/utils": "0.2.18",
"@dbpath/files": "0.2.18",
"@dbpath/postgres": "0.2.18",
"@dbpath/mysql": "0.2.18",
"@dbpath/oracle": "0.2.18"
},

@@ -27,0 +27,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