@databases/mysql-config
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -54,3 +54,2 @@ "use strict"; | ||
"MySqlConfig.connectionStringEnvironmentVariable should be string | ||
MySqlConfig value: | ||
@@ -57,0 +56,0 @@ { connectionStringEnvironmentVariable: 10, |
"use strict"; | ||
var __awaiter = undefined && undefined.__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) { | ||
@@ -20,5 +25,3 @@ function fulfilled(value) { | ||
function step(result) { | ||
result.done ? resolve(result.value) : new P(function (resolve) { | ||
resolve(result.value); | ||
}).then(fulfilled, rejected); | ||
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); | ||
} | ||
@@ -25,0 +28,0 @@ step((generator = generator.apply(thisArg, _arguments || [])).next()); |
@@ -0,2 +1,4 @@ | ||
import Ajv = require('ajv'); | ||
import MySqlConfig from './MySqlConfig'; | ||
export declare const ajv: Ajv.Ajv; | ||
export { MySqlConfig }; | ||
@@ -79,2 +81,3 @@ export declare const MySqlConfigSchema: { | ||
}; | ||
export declare type ValidateFunction<T> = ((data: unknown) => data is T) & Pick<Ajv.ValidateFunction, 'errors'>; | ||
export default function validate(value: unknown): MySqlConfig; |
"use strict"; | ||
// generated by typescript-json-validator | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const util_1 = require("util"); | ||
const Ajv = require("ajv"); | ||
const util_1 = require("util"); | ||
const ajv = new Ajv({ coerceTypes: false, allErrors: true, useDefaults: true }); | ||
exports.ajv = new Ajv({ | ||
allErrors: true, | ||
coerceTypes: false, | ||
format: 'fast', | ||
nullable: true, | ||
unicode: true, | ||
uniqueItems: true, | ||
useDefaults: true | ||
}); | ||
exports.ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json')); | ||
exports.MySqlConfigSchema = { | ||
@@ -84,9 +92,8 @@ $schema: 'http://json-schema.org/draft-07/schema#', | ||
}; | ||
ajv.addMetaSchema(require('ajv/lib/refs/json-schema-draft-06.json')); | ||
const validateSchema = ajv.compile(exports.MySqlConfigSchema); | ||
const rawValidateMySqlConfig = exports.ajv.compile(exports.MySqlConfigSchema); | ||
function validate(value) { | ||
if (validateSchema(value)) { | ||
if (rawValidateMySqlConfig(value)) { | ||
return value; | ||
} else { | ||
throw new Error((validateSchema.errors ? validateSchema.errors.map(error => `MySqlConfig${error.dataPath} ${error.message}`).join('\n') + '\nMySqlConfig value:\n\n' : null || 'Error validating MySqlConfig:\n\n') + util_1.inspect(value)); | ||
throw new Error(exports.ajv.errorsText(rawValidateMySqlConfig.errors, { dataVar: 'MySqlConfig' }) + '\n\n' + util_1.inspect(value)); | ||
} | ||
@@ -93,0 +100,0 @@ } |
@@ -1,5 +0,21 @@ | ||
Copyright (c) Forbes Lindesay | ||
# The MIT License (MIT) | ||
@databases is an Open Source project licensed under the terms of | ||
the GPLv3 license. Please see <http://www.gnu.org/licenses/gpl-3.0.html> | ||
for license text. | ||
Copyright (c) 2019 Forbes Lindesay | ||
> Permission is hereby granted, free of charge, to any person obtaining a copy | ||
> of this software and associated documentation files (the "Software"), to deal | ||
> in the Software without restriction, including without limitation the rights | ||
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
> copies of the Software, and to permit persons to whom the Software is | ||
> furnished to do so, subject to the following conditions: | ||
> | ||
> The above copyright notice and this permission notice shall be included in | ||
> all copies or substantial portions of the Software. | ||
> | ||
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
> SOFTWARE. |
{ | ||
"name": "@databases/mysql-config", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -21,6 +21,9 @@ "main": "./lib/index.js", | ||
"bugs": "https://github.com/ForbesLindesay/atdatabases/issues", | ||
"license": "GPL-3.0", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} | ||
}, | ||
"files": [ | ||
"lib/" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
1
80
18048
14
386