@dbpath/environments
Advanced tools
Comparing version 0.3.16 to 0.3.17
export * from './src/environments'; | ||
export * from './src/environment.fixture'; | ||
export * from './src/prettyprint'; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Environment } from "./environments"; |
@@ -0,0 +0,0 @@ "use strict"; |
export {}; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -26,10 +26,11 @@ import { ErrorsAnd, NameAnd, NameAndValidator } from "@dbpath/utils"; | ||
export declare function sqlDialect(type: string): import("@dbpath/dal").DalDialect; | ||
export declare function dalFor(env: CommonEnvironment): Promise<ErrorsAnd<Dal>>; | ||
export declare function dalFor(env: CommonEnvironment, shortMessages?: boolean): Promise<ErrorsAnd<Dal>>; | ||
export interface EnvStatus { | ||
name: string; | ||
up: boolean; | ||
errors?: string[]; | ||
env: CleanEnvironment; | ||
} | ||
export declare function envIsUp(env: CleanEnvironment): Promise<boolean>; | ||
export declare function envIsUp(env: CleanEnvironment): Promise<ErrorsAnd<true>>; | ||
export declare function checkStatus(envs: NameAnd<CleanEnvironment>): Promise<NameAnd<EnvStatus>>; | ||
export declare function mapEnv<T>(e: CommonEnvironment, postGes: (e: PostgresEnv) => T, oracleFn: (e: OracleEnv) => T): T; |
@@ -138,3 +138,3 @@ "use strict"; | ||
exports.sqlDialect = sqlDialect; | ||
function dalFor(env) { | ||
function dalFor(env, shortMessages) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -148,3 +148,4 @@ try { | ||
catch (e) { | ||
return [`Could not get a dal for ${env.type}. Is it up? try 'dbpath admin status'`, e.message]; | ||
const msgs = shortMessages ? [] : [`Could not get a dal for ${env.type}. Is it up? try 'dbpath admin status'`]; | ||
return [...msgs, e.toString()]; | ||
} | ||
@@ -159,5 +160,5 @@ throw new Error(`Unknown environment type ${env.type}. Currently on postgres is supported. ${JSON.stringify(env)}`); | ||
try { | ||
let dal = yield dalFor(env); | ||
let dal = yield dalFor(env, true); | ||
if ((0, utils_1.hasErrors)(dal)) | ||
return false; | ||
return dal; | ||
try { | ||
@@ -173,3 +174,3 @@ const dialect = sqlDialect(env.type); | ||
catch (e) { | ||
return false; | ||
return [e.toString()]; | ||
} | ||
@@ -182,4 +183,6 @@ }); | ||
let result = {}; | ||
for (const [name, env] of Object.entries(envs)) | ||
result[name] = { name, env, up: yield envIsUp(env) }; | ||
for (const [name, env] of Object.entries(envs)) { | ||
let up = yield envIsUp(env); | ||
result[name] = up === true ? { name, env, up: up } : { name, env, up: false, errors: up }; | ||
} | ||
return result; | ||
@@ -186,0 +189,0 @@ }); |
@@ -0,0 +0,0 @@ import { ColumnDefn, NameAnd } from "@dbpath/utils"; |
@@ -26,2 +26,3 @@ "use strict"; | ||
"Connection": { dataFn: (t) => (0, environments_1.mapEnv)(t.env, e => '', e => e.connection) }, | ||
"Errors": { dataFn: (t) => (0, utils_1.safeArray)(t.errors).join(' ') }, | ||
}; | ||
@@ -28,0 +29,0 @@ function prettyPrintEnvironments(envs) { |
{ | ||
"name": "@dbpath/environments", | ||
"description": "", | ||
"version": "0.3.16", | ||
"version": "0.3.17", | ||
"main": "dist/index", | ||
@@ -20,7 +20,7 @@ "types": "dist/index", | ||
"dependencies": { | ||
"@dbpath/utils": "0.3.16", | ||
"@dbpath/files": "0.3.16", | ||
"@dbpath/postgres": "0.3.16", | ||
"@dbpath/mysql": "0.3.16", | ||
"@dbpath/oracle": "0.3.16" | ||
"@dbpath/utils": "0.3.17", | ||
"@dbpath/files": "0.3.17", | ||
"@dbpath/postgres": "0.3.17", | ||
"@dbpath/mysql": "0.3.17", | ||
"@dbpath/oracle": "0.3.17" | ||
}, | ||
@@ -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
368
20405
+ Added@dbpath/config@0.3.17(transitive)
+ Added@dbpath/dal@0.3.17(transitive)
+ Added@dbpath/files@0.3.17(transitive)
+ Added@dbpath/fixtures@0.3.17(transitive)
+ Added@dbpath/mysql@0.3.17(transitive)
+ Added@dbpath/oracle@0.3.17(transitive)
+ Added@dbpath/postgres@0.3.17(transitive)
+ Added@dbpath/types@0.3.17(transitive)
+ Added@dbpath/utils@0.3.17(transitive)
- Removed@dbpath/config@0.3.16(transitive)
- Removed@dbpath/dal@0.3.16(transitive)
- Removed@dbpath/files@0.3.16(transitive)
- Removed@dbpath/fixtures@0.3.16(transitive)
- Removed@dbpath/mysql@0.3.16(transitive)
- Removed@dbpath/oracle@0.3.16(transitive)
- Removed@dbpath/postgres@0.3.16(transitive)
- Removed@dbpath/types@0.3.16(transitive)
- Removed@dbpath/utils@0.3.16(transitive)
Updated@dbpath/files@0.3.17
Updated@dbpath/mysql@0.3.17
Updated@dbpath/oracle@0.3.17
Updated@dbpath/postgres@0.3.17
Updated@dbpath/utils@0.3.17