@sellout/utils 0.0.1 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@sellout/utils",
3
- "version": "0.0.1",
3
+ "version": "0.0.5",
4
4
  "description": "Sellout.io utils",
5
5
  "scripts": {
6
+ "prepare": "npm run build",
6
7
  "build": "tsc --project .",
7
8
  "start": "nodemon --watch src -e json,js,ts -x \"npm run build\""
8
9
  },
@@ -13,8 +14,8 @@
13
14
  "author": "samheutmaker@gmail.com",
14
15
  "license": "MIT",
15
16
  "dependencies": {
16
- "@sellout/models": "^0.0.1",
17
- "@sellout/service": "^0.0.1",
17
+ "@sellout/models": "^0.0.5",
18
+ "@sellout/service": "^0.0.5",
18
19
  "json2csv": "^5.0.0",
19
20
  "moment-timezone": "^0.5.28",
20
21
  "request": "^2.88.2",
@@ -25,5 +26,5 @@
25
26
  "nodemon": "^2.0.2",
26
27
  "typescript": "^3.8.3"
27
28
  },
28
- "gitHead": "5f577126fcc59699bc5447b62f0ee56aa4b9759b"
29
+ "gitHead": "5af90cec2aeb461ce24ab03508bd8cb705de8ae3"
29
30
  }
@@ -1,9 +0,0 @@
1
- export default class MongoConnectionManager {
2
- connected: boolean;
3
- mongoConnectionString: string;
4
- isReplicaSet: boolean;
5
- private mongoose;
6
- private mongoConnectionStringInternal;
7
- constructor(mongoose: any, mongoConnectionString: string, username?: string, password?: string);
8
- connect(): Promise<void>;
9
- }
@@ -1,52 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const wait_1 = require("./wait");
13
- class MongoConnectionManager {
14
- constructor(mongoose, mongoConnectionString, username = '', password = '') {
15
- const parsed = new URL(mongoConnectionString);
16
- parsed.username = username;
17
- parsed.password = password;
18
- parsed.pathname = '/admin';
19
- this.connected = false;
20
- this.mongoConnectionStringInternal = parsed.toString();
21
- this.isReplicaSet = parsed.protocol === 'mongodb+srv:';
22
- // redact username/password from publicly available connection string
23
- parsed.username = '__user__';
24
- parsed.password = '__pass__';
25
- this.mongoConnectionString = parsed.toString();
26
- this.mongoose = mongoose;
27
- }
28
- connect() {
29
- return __awaiter(this, void 0, void 0, function* () {
30
- while (!this.connected) {
31
- console.log('Attempting to connect to Mongo...');
32
- this.mongoose.connect(this.mongoConnectionStringInternal, {
33
- ssl: false,
34
- useUnifiedTopology: true,
35
- useNewUrlParser: true,
36
- })
37
- .then(() => {
38
- this.connected = true;
39
- console.log(`Connected to MongoDB: ${this.mongoConnectionString}`);
40
- })
41
- .catch((e) => {
42
- console.error(`There was an error connecting to MongoDB: ${this.mongoConnectionString}`);
43
- console.error(e);
44
- });
45
- // wait five seconds before trying again
46
- yield wait_1.default(5000);
47
- }
48
- });
49
- }
50
- }
51
- exports.default = MongoConnectionManager;
52
- //# sourceMappingURL=MongoConnectionManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MongoConnectionManager.js","sourceRoot":"","sources":["../src/MongoConnectionManager.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,iCAA0B;AAE1B,MAAqB,sBAAsB;IAOzC,YAAY,QAAa,EAAE,qBAA6B,EAAE,WAAmB,EAAE,EAAE,WAAmB,EAAE;QACpG,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAE9C,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;Q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