@tediousjs/connection-string
Advanced tools
Comparing version 0.3.0 to 0.4.0
# Changelog | ||
## v0.4.0 (2022-04-27) | ||
- Add LICENSE file (MIT) #17 | ||
- Improve library code / TS definitions #18 | ||
- Dependency updates | ||
## v0.3.0 (2021-01-21) | ||
- Allow parsed SQL connection strings to return unrecognised properties [#4] | ||
- Allow parsed SQL connection strings to return unrecognised properties #4 | ||
## v0.2.0 (2021-01-21) | ||
- Parsed query strings return lowercase keys [#3] | ||
- Parsed query strings return lowercase keys #3 | ||
@@ -11,0 +17,0 @@ ## v0.1.0 (2021-01-21) |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseSqlConnectionString = exports.parseConnectionString = void 0; | ||
const connection_string_1 = require("./parser/connection-string"); | ||
const connection_string_1 = __importDefault(require("./parser/connection-string")); | ||
exports.parseConnectionString = connection_string_1.default; | ||
const sql_connection_string_1 = require("./parser/sql-connection-string"); | ||
const sql_connection_string_1 = __importDefault(require("./parser/sql-connection-string")); | ||
exports.parseSqlConnectionString = sql_connection_string_1.default; | ||
//# sourceMappingURL=index.js.map |
@@ -135,1 +135,2 @@ "use strict"; | ||
exports.default = connectionStringParser; | ||
//# sourceMappingURL=connection-string.js.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SCHEMA = exports.SchemaTypes = void 0; | ||
const connection_string_1 = require("./connection-string"); | ||
const connection_string_1 = __importDefault(require("./connection-string")); | ||
var SchemaTypes; | ||
@@ -17,3 +20,3 @@ (function (SchemaTypes) { | ||
validator(val) { | ||
return val.length <= 128; | ||
return typeof val === 'string' && val.length <= 128; | ||
}, | ||
@@ -71,3 +74,3 @@ }, | ||
validator(val) { | ||
return val.length <= 128; | ||
return typeof val === 'string' && val.length <= 128; | ||
}, | ||
@@ -94,3 +97,3 @@ }, | ||
validator(val) { | ||
return val.length <= 128; | ||
return typeof val === 'string' && val.length <= 128; | ||
}, | ||
@@ -143,3 +146,3 @@ }, | ||
validator(val) { | ||
return val.length <= 128; | ||
return typeof val === 'string' && val.length <= 128; | ||
}, | ||
@@ -156,2 +159,5 @@ }, | ||
coerce(val) { | ||
if (typeof val !== 'string') { | ||
return null; | ||
} | ||
switch (val.toLowerCase()) { | ||
@@ -197,3 +203,3 @@ case 'alwaysblock': | ||
validator(val) { | ||
return val.length <= 128; | ||
return typeof val === 'string' && val.length <= 128; | ||
}, | ||
@@ -209,3 +215,3 @@ }, | ||
validator(val) { | ||
return val.length <= 128; | ||
return typeof val === 'string' && val.length <= 128; | ||
}, | ||
@@ -257,2 +263,3 @@ }, | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
function parseSqlConnectionString(connectionString, canonicalProps = false, allowUnknown = false, strict = false, schema = exports.SCHEMA) { | ||
@@ -273,3 +280,3 @@ const flattenedSchema = Object.entries(schema).reduce((flattened, [key, item]) => { | ||
}, {}); | ||
return Object.entries(connection_string_1.default(connectionString)).reduce((config, [prop, value]) => { | ||
return Object.entries((0, connection_string_1.default)(connectionString)).reduce((config, [prop, value]) => { | ||
if (!Object.prototype.hasOwnProperty.call(flattenedSchema, prop)) { | ||
@@ -291,1 +298,2 @@ return Object.assign(config, { | ||
exports.default = parseSqlConnectionString; | ||
//# sourceMappingURL=sql-connection-string.js.map |
{ | ||
"name": "@tediousjs/connection-string", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "SQL ConnectionString parser", | ||
@@ -16,8 +16,7 @@ "repository": { | ||
"scripts": { | ||
"prepare": "rm -rf lib && tsc", | ||
"prepare": "tsc", | ||
"build": "tsc", | ||
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"", | ||
"lint": "tslint -p tsconfig.json", | ||
"test": "mocha test/**/*", | ||
"test-pipeline": "mocha --forbid-only test/**/*" | ||
"lint": "eslint .", | ||
"test": "mocha -r ts-node/register test/**/*", | ||
"test:workflow": "npm run test --silent -- --forbid-only" | ||
}, | ||
@@ -38,6 +37,12 @@ "keywords": [ | ||
"devDependencies": { | ||
"@types/node": "^14.14.22", | ||
"@tsconfig/node10": "^1.0.8", | ||
"@types/chai": "^4.3.1", | ||
"@types/mocha": "^9.1.1", | ||
"@types/node": "^10.17.60", | ||
"@typescript-eslint/eslint-plugin": "^5.21.0", | ||
"@typescript-eslint/parser": "^5.21.0", | ||
"chai": "^4.2.0", | ||
"mocha": "^8.2.1", | ||
"prettier": "^2.2.1", | ||
"eslint": "^8.14.0", | ||
"mocha": "^9.2.2", | ||
"ts-node": "^10.7.0", | ||
"tslint": "^6.1.3", | ||
@@ -44,0 +49,0 @@ "tslint-config-prettier": "^1.18.0", |
@@ -5,3 +5,3 @@ # Connection String Parser | ||
The library also provides the ability to pares SQL Connection Strings. | ||
The library also provides the ability to parse SQL Connection Strings. | ||
@@ -39,3 +39,3 @@ # Usage | ||
There is a specific helper for parsing SQL connection strings and this comes with a value normaliser and validation. It also has an | ||
option to "canonicalise" the properties. For many properties in an SQL connections string, there are aliases, when canoncical properties | ||
option to "canonicalise" the properties. For many properties in an SQL connections string, there are aliases, when canonical properties | ||
are being used, these aliases will be returned as the canonical property. | ||
@@ -42,0 +42,0 @@ |
29358
10
13
432