Einkaufslisten anzeigen, Datenbankeinbindung
This commit is contained in:
25
express-server/node_modules/pg-connection-string/.npmignore
generated
vendored
Normal file
25
express-server/node_modules/pg-connection-string/.npmignore
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directory
|
||||
# Deployed apps should consider commenting this line out:
|
||||
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
|
||||
node_modules
|
3
express-server/node_modules/pg-connection-string/.travis.yml
generated
vendored
Normal file
3
express-server/node_modules/pg-connection-string/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
21
express-server/node_modules/pg-connection-string/LICENSE
generated
vendored
Normal file
21
express-server/node_modules/pg-connection-string/LICENSE
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Iced Development
|
||||
|
||||
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.
|
18
express-server/node_modules/pg-connection-string/README.md
generated
vendored
Normal file
18
express-server/node_modules/pg-connection-string/README.md
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
pg-connection-string
|
||||
====================
|
||||
|
||||
[](https://travis-ci.org/iceddev/pg-connection-string)
|
||||
|
||||
Functions for dealing with a PostgresSQL connection string
|
||||
|
||||
`parse` method taken from [node-postgres](https://github.com/brianc/node-postgres.git)
|
||||
Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)
|
||||
MIT License
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var parse = require('pg-connection-string').parse;
|
||||
|
||||
var config = parse('postgres://someuser:somepassword@somehost:381/sometable')
|
||||
```
|
62
express-server/node_modules/pg-connection-string/index.js
generated
vendored
Normal file
62
express-server/node_modules/pg-connection-string/index.js
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
'use strict';
|
||||
|
||||
var url = require('url');
|
||||
|
||||
//Parse method copied from https://github.com/brianc/node-postgres
|
||||
//Copyright (c) 2010-2014 Brian Carlson (brian.m.carlson@gmail.com)
|
||||
//MIT License
|
||||
|
||||
//parses a connection string
|
||||
function parse(str) {
|
||||
var config;
|
||||
//unix socket
|
||||
if(str.charAt(0) === '/') {
|
||||
config = str.split(' ');
|
||||
return { host: config[0], database: config[1] };
|
||||
}
|
||||
// url parse expects spaces encoded as %20
|
||||
if(/ |%[^a-f0-9]|%[a-f0-9][^a-f0-9]/i.test(str)) {
|
||||
str = encodeURI(str).replace(/\%25(\d\d)/g, "%$1");
|
||||
}
|
||||
var result = url.parse(str, true);
|
||||
config = {};
|
||||
|
||||
if (result.query.application_name) {
|
||||
config.application_name = result.query.application_name;
|
||||
}
|
||||
if (result.query.fallback_application_name) {
|
||||
config.fallback_application_name = result.query.fallback_application_name;
|
||||
}
|
||||
|
||||
config.port = result.port;
|
||||
if(result.protocol == 'socket:') {
|
||||
config.host = decodeURI(result.pathname);
|
||||
config.database = result.query.db;
|
||||
config.client_encoding = result.query.encoding;
|
||||
return config;
|
||||
}
|
||||
config.host = result.hostname;
|
||||
|
||||
// result.pathname is not always guaranteed to have a '/' prefix (e.g. relative urls)
|
||||
// only strip the slash if it is present.
|
||||
var pathname = result.pathname;
|
||||
if (pathname && pathname.charAt(0) === '/') {
|
||||
pathname = result.pathname.slice(1) || null;
|
||||
}
|
||||
config.database = pathname && decodeURI(pathname);
|
||||
|
||||
var auth = (result.auth || ':').split(':');
|
||||
config.user = auth[0];
|
||||
config.password = auth.splice(1).join(':');
|
||||
|
||||
var ssl = result.query.ssl;
|
||||
if (ssl === 'true' || ssl === '1') {
|
||||
config.ssl = true;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
parse: parse
|
||||
};
|
58
express-server/node_modules/pg-connection-string/package.json
generated
vendored
Normal file
58
express-server/node_modules/pg-connection-string/package.json
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
{
|
||||
"_from": "pg-connection-string@0.1.3",
|
||||
"_id": "pg-connection-string@0.1.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-2hhHsglA5C7hSSvq9l1J2RskXfc=",
|
||||
"_location": "/pg-connection-string",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "pg-connection-string@0.1.3",
|
||||
"name": "pg-connection-string",
|
||||
"escapedName": "pg-connection-string",
|
||||
"rawSpec": "0.1.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.1.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/pg"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-0.1.3.tgz",
|
||||
"_shasum": "da1847b20940e42ee1492beaf65d49d91b245df7",
|
||||
"_spec": "pg-connection-string@0.1.3",
|
||||
"_where": "D:\\5CHITM\\Diplomarbeit\\smart-shopper\\SmartShopper\\express-server\\node_modules\\pg",
|
||||
"author": {
|
||||
"name": "Blaine Bublitz",
|
||||
"email": "blaine@iceddev.com",
|
||||
"url": "http://iceddev.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/iceddev/pg-connection-string/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {},
|
||||
"deprecated": false,
|
||||
"description": "Functions for dealing with a PostgresSQL connection string",
|
||||
"devDependencies": {
|
||||
"tap": "^0.4.11"
|
||||
},
|
||||
"homepage": "https://github.com/iceddev/pg-connection-string",
|
||||
"keywords": [
|
||||
"pg",
|
||||
"connection",
|
||||
"string",
|
||||
"parse"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "pg-connection-string",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/iceddev/pg-connection-string.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap ./test"
|
||||
},
|
||||
"version": "0.1.3"
|
||||
}
|
126
express-server/node_modules/pg-connection-string/test/parse.js
generated
vendored
Normal file
126
express-server/node_modules/pg-connection-string/test/parse.js
generated
vendored
Normal file
@ -0,0 +1,126 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tap').test;
|
||||
|
||||
var parse = require('../').parse;
|
||||
|
||||
test('using connection string in client constructor', function(t){
|
||||
var subject = parse('postgres://brian:pw@boom:381/lala');
|
||||
t.equal(subject.user,'brian');
|
||||
t.equal(subject.password, 'pw');
|
||||
t.equal(subject.host, 'boom');
|
||||
t.equal(subject.port, '381');
|
||||
t.equal(subject.database, 'lala');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('escape spaces if present', function(t){
|
||||
var subject = parse('postgres://localhost/post gres');
|
||||
t.equal(subject.database, 'post gres');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('do not double escape spaces', function(t){
|
||||
var subject = parse('postgres://localhost/post%20gres');
|
||||
t.equal(subject.database, 'post gres');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('initializing with unix domain socket', function(t){
|
||||
var subject = parse('/var/run/');
|
||||
t.equal(subject.host, '/var/run/');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('initializing with unix domain socket and a specific database, the simple way', function(t){
|
||||
var subject = parse('/var/run/ mydb');
|
||||
t.equal(subject.host, '/var/run/');
|
||||
t.equal(subject.database, 'mydb');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('initializing with unix domain socket, the health way', function(t){
|
||||
var subject = parse('socket:/some path/?db=my[db]&encoding=utf8');
|
||||
t.equal(subject.host, '/some path/');
|
||||
t.equal(subject.database, 'my[db]', 'must to be escaped and unescaped trough "my%5Bdb%5D"');
|
||||
t.equal(subject.client_encoding, 'utf8');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('initializing with unix domain socket, the escaped health way', function(t){
|
||||
var subject = parse('socket:/some%20path/?db=my%2Bdb&encoding=utf8');
|
||||
t.equal(subject.host, '/some path/');
|
||||
t.equal(subject.database, 'my+db');
|
||||
t.equal(subject.client_encoding, 'utf8');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('password contains < and/or > characters', function(t){
|
||||
var sourceConfig = {
|
||||
user:'brian',
|
||||
password: 'hello<ther>e',
|
||||
port: 5432,
|
||||
host: 'localhost',
|
||||
database: 'postgres'
|
||||
};
|
||||
var connectionString = 'postgres://' + sourceConfig.user + ':' + sourceConfig.password + '@' + sourceConfig.host + ':' + sourceConfig.port + '/' + sourceConfig.database;
|
||||
var subject = parse(connectionString);
|
||||
t.equal(subject.password, sourceConfig.password);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('password contains colons', function(t){
|
||||
var sourceConfig = {
|
||||
user:'brian',
|
||||
password: 'hello:pass:world',
|
||||
port: 5432,
|
||||
host: 'localhost',
|
||||
database: 'postgres'
|
||||
};
|
||||
var connectionString = 'postgres://' + sourceConfig.user + ':' + sourceConfig.password + '@' + sourceConfig.host + ':' + sourceConfig.port + '/' + sourceConfig.database;
|
||||
var subject = parse(connectionString);
|
||||
t.equal(subject.password, sourceConfig.password);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('username or password contains weird characters', function(t){
|
||||
var strang = 'pg://my f%irst name:is&%awesome!@localhost:9000';
|
||||
var subject = parse(strang);
|
||||
t.equal(subject.user, 'my f%irst name');
|
||||
t.equal(subject.password, 'is&%awesome!');
|
||||
t.equal(subject.host, 'localhost');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('url is properly encoded', function(t){
|
||||
var encoded = 'pg://bi%25na%25%25ry%20:s%40f%23@localhost/%20u%2520rl';
|
||||
var subject = parse(encoded);
|
||||
t.equal(subject.user, 'bi%na%%ry ');
|
||||
t.equal(subject.password, 's@f#');
|
||||
t.equal(subject.host, 'localhost');
|
||||
t.equal(subject.database, ' u%20rl');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('relative url sets database', function(t){
|
||||
var relative = 'different_db_on_default_host';
|
||||
var subject = parse(relative);
|
||||
t.equal(subject.database, 'different_db_on_default_host');
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('no pathname returns null database', function (t) {
|
||||
var subject = parse('pg://myhost');
|
||||
t.equal(subject.host, 'myhost');
|
||||
t.type(subject.database, 'null');
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('pathname of "/" returns null database', function (t) {
|
||||
var subject = parse('pg://myhost/');
|
||||
t.equal(subject.host, 'myhost');
|
||||
t.type(subject.database, 'null');
|
||||
|
||||
t.end();
|
||||
});
|
Reference in New Issue
Block a user