@almatar/branding 0.1.2 → 0.1.3

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.
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.BrandIdentifier = void 0;
39
40
  var Boom = require("@hapi/boom");
40
41
  var BrandManager_1 = require("./BrandManager");
41
42
  var BrandIdentifier = /** @class */ (function () {
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.BrandManager = void 0;
39
40
  var AlmatarBranding_1 = require("./AlmatarBranding");
40
41
  var Storage_1 = require("./Storage");
41
42
  var PromiseRequest_1 = require("./request/PromiseRequest");
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmployeeBrandModel = void 0;
3
4
  var EmployeeBrandModel = /** @class */ (function () {
4
5
  function EmployeeBrandModel(init) {
5
6
  Object.assign(this, init);
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MongooseModel = void 0;
3
4
  var Storage_1 = require("../Storage");
4
5
  var MongooseModel = /** @class */ (function () {
5
6
  function MongooseModel(mongoose) {
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMongooseProviders = void 0;
3
4
  var MongooseModel_1 = require("../MongooseModel");
4
5
  function createMongooseProviders(connectionName, models) {
5
6
  if (models === void 0) { models = []; }
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.PromiseRequest = void 0;
39
40
  var request = require("request");
40
41
  var PromiseRequest = /** @class */ (function () {
41
42
  function PromiseRequest() {
@@ -1,4 +1,4 @@
1
1
  declare class TenantRequest {
2
- static request(options: any, callback: any): void;
2
+ static request(options: any, callback: any): Promise<any>;
3
3
  }
4
4
  export default TenantRequest;
@@ -1,19 +1,72 @@
1
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
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
2
38
  Object.defineProperty(exports, "__esModule", { value: true });
3
39
  var Storage_1 = require("../Storage");
4
- var request = require("request");
40
+ var node_fetch_1 = require("node-fetch");
5
41
  var TenantRequest = /** @class */ (function () {
6
42
  function TenantRequest() {
7
43
  }
8
44
  TenantRequest.request = function (options, callback) {
9
- var brand = Storage_1.default.getBrand();
10
- var employeeBrands = Storage_1.default.getEmployeeBrands();
11
- if (!options.headers) {
12
- options.headers = {};
13
- }
14
- options.headers['x-brand'] = brand;
15
- options.headers['x-employee-brands'] = (employeeBrands) ? employeeBrands.join(',') : null;
16
- request(options, callback);
45
+ return __awaiter(this, void 0, void 0, function () {
46
+ var brand, employeeBrands;
47
+ return __generator(this, function (_a) {
48
+ switch (_a.label) {
49
+ case 0:
50
+ brand = Storage_1.default.getBrand();
51
+ employeeBrands = Storage_1.default.getEmployeeBrands();
52
+ if (!options.reqObject.headers) {
53
+ options.reqObject.headers = {};
54
+ }
55
+ options.reqObject.headers['Content-Type'] = 'application/json';
56
+ options.reqObject.headers['x-brand'] = brand;
57
+ // tslint:disable-next-line:no-unused-expression
58
+ (employeeBrands) ? options.reqObject.headers['x-employee-brands'] = employeeBrands.join(',') : null;
59
+ return [4 /*yield*/, node_fetch_1.default(options.url, options.reqObject)
60
+ .then(function (res) {
61
+ return res.json();
62
+ })
63
+ .catch(function (e) {
64
+ return null;
65
+ })];
66
+ case 1: return [2 /*return*/, _a.sent()];
67
+ }
68
+ });
69
+ });
17
70
  };
18
71
  return TenantRequest;
19
72
  }());
package/package.json CHANGED
@@ -1,54 +1,56 @@
1
- {
2
- "name": "@almatar/branding",
3
- "version": "0.1.2",
4
- "description": "",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "files": [
8
- "lib/**/*"
9
- ],
10
- "scripts": {
11
- "build": "tsc",
12
- "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
13
- "lint": "tslint -p tsconfig.json",
14
- "test": "jest --config jestconfig.json",
15
- "prepare": "npm run build",
16
- "prepublishOnly": "npm test && npm run lint",
17
- "preversion": "npm run lint",
18
- "version": "npm run format && git add -A && git commit -m \"Setup Package\"",
19
- "postversion": "git push && git push --tags"
20
- },
21
- "pre-commit": [
22
- "lint"
23
- ],
24
- "dependencies": {
25
- "@hapi/boom": "^8.0.1",
26
- "@nestjs/common": "^6.8.2",
27
- "@nestjs/core": "^6.8.2",
28
- "@nestjs/mongoose": "^6.1.2",
29
- "@types/mongoose": "^5.5.19",
30
- "@types/request": "^2.48.3",
31
- "cls-hooked": "^4.2.2",
32
- "mongoose": "^5.7.3",
33
- "reflect-metadata": "^0.1.13",
34
- "request": "^2.88.0",
35
- "rxjs": "^6.5.3"
36
- },
37
- "author": "",
38
- "license": "ISC",
39
- "devDependencies": {
40
- "@babel/core": "^7.5.5",
41
- "@babel/preset-env": "^7.5.5",
42
- "@babel/register": "^7.5.5",
43
- "@types/jest": "^24.0.18",
44
- "@types/node": "^12.7.5",
45
- "jest": "^24.9.0",
46
- "pre-commit": "^1.2.2",
47
- "npm-watch": "^0.6.0",
48
- "prettier": "^1.18.2",
49
- "ts-jest": "^24.1.0",
50
- "tslint": "^5.20.0",
51
- "tslint-config-prettier": "^1.18.0",
52
- "typescript": "^3.6.3"
53
- }
54
- }
1
+ {
2
+ "name": "@almatar/branding",
3
+ "version": "0.1.3",
4
+ "description": "",
5
+ "main": "lib/index.js",
6
+ "types": "lib/index.d.ts",
7
+ "files": [
8
+ "lib/**/*"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
13
+ "lint": "tslint -p tsconfig.json",
14
+ "test": "jest --config jestconfig.json",
15
+ "prepare": "npm run build",
16
+ "prepublishOnly": "npm test && npm run lint",
17
+ "preversion": "npm run lint",
18
+ "version": "npm run format && git add -A && git commit -m \"Setup Package\"",
19
+ "postversion": "git push && git push --tags"
20
+ },
21
+ "pre-commit": [
22
+ "lint"
23
+ ],
24
+ "dependencies": {
25
+ "@hapi/boom": "^8.0.1",
26
+ "@nestjs/common": "^6.8.2",
27
+ "@nestjs/core": "^6.8.2",
28
+ "@nestjs/mongoose": "^6.1.2",
29
+ "@types/mongoose": "^5.5.19",
30
+ "@types/request": "^2.48.3",
31
+ "cls-hooked": "^4.2.2",
32
+ "mongoose": "^5.7.3",
33
+ "node-fetch": "^2.6.1",
34
+ "reflect-metadata": "^0.1.13",
35
+ "request": "^2.88.0",
36
+ "rxjs": "^6.5.3"
37
+ },
38
+ "author": "",
39
+ "license": "ISC",
40
+ "devDependencies": {
41
+ "@babel/core": "^7.5.5",
42
+ "@babel/preset-env": "^7.5.5",
43
+ "@babel/register": "^7.5.5",
44
+ "@types/jest": "^24.0.18",
45
+ "@types/node": "^12.7.5",
46
+ "@types/node-fetch": "^2.5.10",
47
+ "jest": "^24.9.0",
48
+ "npm-watch": "^0.6.0",
49
+ "pre-commit": "^1.2.2",
50
+ "prettier": "^1.18.2",
51
+ "ts-jest": "^24.1.0",
52
+ "tslint": "^5.20.0",
53
+ "tslint-config-prettier": "^1.18.0",
54
+ "typescript": "^3.6.3"
55
+ }
56
+ }
File without changes
@@ -1,4 +0,0 @@
1
- "use strict";
2
- test('My Greeter', function () {
3
- expect(true).toBe(true);
4
- });