@dbpath/environments
Advanced tools
Comparing version 0.2.17 to 0.2.18
@@ -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); |
@@ -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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19901
349
+ Added@dbpath/config@0.2.18(transitive)
+ Added@dbpath/dal@0.2.18(transitive)
+ Added@dbpath/files@0.2.18(transitive)
+ Added@dbpath/fixtures@0.2.18(transitive)
+ Added@dbpath/mysql@0.2.18(transitive)
+ Added@dbpath/oracle@0.2.18(transitive)
+ Added@dbpath/postgres@0.2.18(transitive)
+ Added@dbpath/types@0.2.18(transitive)
+ Added@dbpath/utils@0.2.18(transitive)
- Removed@dbpath/config@0.2.17(transitive)
- Removed@dbpath/dal@0.2.17(transitive)
- Removed@dbpath/files@0.2.17(transitive)
- Removed@dbpath/fixtures@0.2.17(transitive)
- Removed@dbpath/mysql@0.2.17(transitive)
- Removed@dbpath/oracle@0.2.17(transitive)
- Removed@dbpath/postgres@0.2.17(transitive)
- Removed@dbpath/types@0.2.17(transitive)
- Removed@dbpath/utils@0.2.17(transitive)
Updated@dbpath/files@0.2.18
Updated@dbpath/mysql@0.2.18
Updated@dbpath/oracle@0.2.18
Updated@dbpath/postgres@0.2.18
Updated@dbpath/utils@0.2.18