skyeye-svc-common-utils 1.0.3 → 1.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.
Files changed (115) hide show
  1. package/package.json +1 -1
  2. package/src/utils/authentication/role.ts +5 -1
  3. package/src/utils/commonUtils/appUtils.ts +10 -1
  4. package/src/utils/middleware/overwriteConst.ts +16 -3
  5. package/dist/index.d.ts +0 -24
  6. package/dist/index.js +0 -38
  7. package/dist/index.js.map +0 -1
  8. package/dist/interfaces/apiResponse.d.ts +0 -7
  9. package/dist/interfaces/apiResponse.js +0 -3
  10. package/dist/interfaces/apiResponse.js.map +0 -1
  11. package/dist/interfaces/index.d.ts +0 -6
  12. package/dist/interfaces/index.js +0 -10
  13. package/dist/interfaces/index.js.map +0 -1
  14. package/dist/interfaces/pagination.d.ts +0 -6
  15. package/dist/interfaces/pagination.js +0 -12
  16. package/dist/interfaces/pagination.js.map +0 -1
  17. package/dist/interfaces/serviceResponse.d.ts +0 -8
  18. package/dist/interfaces/serviceResponse.js +0 -3
  19. package/dist/interfaces/serviceResponse.js.map +0 -1
  20. package/dist/interfaces/subcriptionFeaturePermissionModel.d.ts +0 -8
  21. package/dist/interfaces/subcriptionFeaturePermissionModel.js +0 -14
  22. package/dist/interfaces/subcriptionFeaturePermissionModel.js.map +0 -1
  23. package/dist/interfaces/userInfo.d.ts +0 -17
  24. package/dist/interfaces/userInfo.js +0 -21
  25. package/dist/interfaces/userInfo.js.map +0 -1
  26. package/dist/lib/azure/azureBlobStorage.d.ts +0 -4
  27. package/dist/lib/azure/azureBlobStorage.js +0 -135
  28. package/dist/lib/azure/azureBlobStorage.js.map +0 -1
  29. package/dist/lib/azure/azureKeyVault.d.ts +0 -1
  30. package/dist/lib/azure/azureKeyVault.js +0 -27
  31. package/dist/lib/azure/azureKeyVault.js.map +0 -1
  32. package/dist/lib/azure/azureServiceBusQueue.d.ts +0 -1
  33. package/dist/lib/azure/azureServiceBusQueue.js +0 -42
  34. package/dist/lib/azure/azureServiceBusQueue.js.map +0 -1
  35. package/dist/lib/azure/azureStorageQueue.d.ts +0 -1
  36. package/dist/lib/azure/azureStorageQueue.js +0 -26
  37. package/dist/lib/azure/azureStorageQueue.js.map +0 -1
  38. package/dist/lib/azure/azureTableStorage.d.ts +0 -4
  39. package/dist/lib/azure/azureTableStorage.js +0 -66
  40. package/dist/lib/azure/azureTableStorage.js.map +0 -1
  41. package/dist/lib/httpClient.d.ts +0 -1
  42. package/dist/lib/httpClient.js +0 -32
  43. package/dist/lib/httpClient.js.map +0 -1
  44. package/dist/lib/redisClient.d.ts +0 -45
  45. package/dist/lib/redisClient.js +0 -148
  46. package/dist/lib/redisClient.js.map +0 -1
  47. package/dist/lib/sendGridClient.d.ts +0 -22
  48. package/dist/lib/sendGridClient.js +0 -55
  49. package/dist/lib/sendGridClient.js.map +0 -1
  50. package/dist/models/baseControllerParameter.d.ts +0 -8
  51. package/dist/models/baseControllerParameter.js +0 -9
  52. package/dist/models/baseControllerParameter.js.map +0 -1
  53. package/dist/models/index.d.ts +0 -2
  54. package/dist/models/index.js +0 -6
  55. package/dist/models/index.js.map +0 -1
  56. package/dist/utils/appConfig.d.ts +0 -32
  57. package/dist/utils/appConfig.js +0 -44
  58. package/dist/utils/appConfig.js.map +0 -1
  59. package/dist/utils/appConst.d.ts +0 -113
  60. package/dist/utils/appConst.js +0 -137
  61. package/dist/utils/appConst.js.map +0 -1
  62. package/dist/utils/authentication/auth.d.ts +0 -2
  63. package/dist/utils/authentication/auth.js +0 -144
  64. package/dist/utils/authentication/auth.js.map +0 -1
  65. package/dist/utils/authentication/role.d.ts +0 -7
  66. package/dist/utils/authentication/role.js +0 -133
  67. package/dist/utils/authentication/role.js.map +0 -1
  68. package/dist/utils/baseClass/baseController.d.ts +0 -12
  69. package/dist/utils/baseClass/baseController.js +0 -176
  70. package/dist/utils/baseClass/baseController.js.map +0 -1
  71. package/dist/utils/baseClass/baseService.d.ts +0 -7
  72. package/dist/utils/baseClass/baseService.js +0 -11
  73. package/dist/utils/baseClass/baseService.js.map +0 -1
  74. package/dist/utils/commonUtils/appUtils.d.ts +0 -10
  75. package/dist/utils/commonUtils/appUtils.js +0 -128
  76. package/dist/utils/commonUtils/appUtils.js.map +0 -1
  77. package/dist/utils/commonUtils/cronUtils.d.ts +0 -9
  78. package/dist/utils/commonUtils/cronUtils.js +0 -32
  79. package/dist/utils/commonUtils/cronUtils.js.map +0 -1
  80. package/dist/utils/commonUtils/index.d.ts +0 -5
  81. package/dist/utils/commonUtils/index.js +0 -18
  82. package/dist/utils/commonUtils/index.js.map +0 -1
  83. package/dist/utils/commonUtils/jwtUtils.d.ts +0 -3
  84. package/dist/utils/commonUtils/jwtUtils.js +0 -75
  85. package/dist/utils/commonUtils/jwtUtils.js.map +0 -1
  86. package/dist/utils/commonUtils/responseUtils.d.ts +0 -7
  87. package/dist/utils/commonUtils/responseUtils.js +0 -66
  88. package/dist/utils/commonUtils/responseUtils.js.map +0 -1
  89. package/dist/utils/commonUtils/validation.d.ts +0 -6
  90. package/dist/utils/commonUtils/validation.js +0 -92
  91. package/dist/utils/commonUtils/validation.js.map +0 -1
  92. package/dist/utils/documentation/swagger.d.ts +0 -1
  93. package/dist/utils/documentation/swagger.js +0 -37
  94. package/dist/utils/documentation/swagger.js.map +0 -1
  95. package/dist/utils/logger/logger.d.ts +0 -1
  96. package/dist/utils/logger/logger.js +0 -29
  97. package/dist/utils/logger/logger.js.map +0 -1
  98. package/dist/utils/logger/morganLogger.d.ts +0 -4
  99. package/dist/utils/logger/morganLogger.js +0 -27
  100. package/dist/utils/logger/morganLogger.js.map +0 -1
  101. package/dist/utils/middleware/handleError.d.ts +0 -2
  102. package/dist/utils/middleware/handleError.js +0 -12
  103. package/dist/utils/middleware/handleError.js.map +0 -1
  104. package/dist/utils/middleware/isPublicUser.d.ts +0 -2
  105. package/dist/utils/middleware/isPublicUser.js +0 -35
  106. package/dist/utils/middleware/isPublicUser.js.map +0 -1
  107. package/dist/utils/middleware/overwriteConst.d.ts +0 -1
  108. package/dist/utils/middleware/overwriteConst.js +0 -71
  109. package/dist/utils/middleware/overwriteConst.js.map +0 -1
  110. package/dist/utils/middleware/startdbConnection.d.ts +0 -1
  111. package/dist/utils/middleware/startdbConnection.js +0 -28
  112. package/dist/utils/middleware/startdbConnection.js.map +0 -1
  113. package/dist/utils/monitoring/apm.d.ts +0 -6
  114. package/dist/utils/monitoring/apm.js +0 -95
  115. package/dist/utils/monitoring/apm.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skyeye-svc-common-utils",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -136,7 +136,11 @@ export const roles = [
136
136
  PermissionCodeConst.NERL_CORRECTION_POST_RETRIEVE,
137
137
  PermissionCodeConst.NERL_CORRECTION_POST_DELETE,
138
138
 
139
- PermissionCodeConst.APIM_GET_ROOT
139
+ PermissionCodeConst.APIM_GET_ROOT,
140
+ PermissionCodeConst.APIM_RENEW_KEY,
141
+ PermissionCodeConst.APIM_SUBSCRIPTION_CREATE,
142
+ PermissionCodeConst.APIM_SUBSCRIPTION_LIST,
143
+ PermissionCodeConst.APIM_SUBSCRIPTION_UPDATESTATUS
140
144
  ]
141
145
  }
142
146
  ]
@@ -1,7 +1,9 @@
1
1
  import { logger } from '../logger/logger';
2
2
  import { ServiceResponse, Pagination, UserInfo } from '../../interfaces';
3
- import { commonAppConst } from '../../utils/appConst';
3
+ import { commonAppConst, jsonContentTypeHeaders } from '../../utils/appConst';
4
4
  import { allApplicationFeatures, ApplicationFeature, commonAppConst as sCommonAppConst, Feature } from 'skyeye-common-const';
5
+ import { httpRequest } from '../../lib/httpClient';
6
+ import { generateJWT } from './jwtUtils';
5
7
 
6
8
  export async function mappingToModel(input: any, output: any) {
7
9
  if (input !== undefined && input !== null) {
@@ -97,4 +99,11 @@ export async function userInfoToFeatureListByName(userInfo: UserInfo, featureNam
97
99
  } catch (err) {
98
100
  logger.error(err);
99
101
  }
102
+ }
103
+
104
+ export async function sendInternalHttpRequest(userInfo:UserInfo, method: string, url : string, data: any = null,) {
105
+ let headers:any = jsonContentTypeHeaders();
106
+ let token: string = `${commonAppConst.httpHeader.BEARER} ${await generateJWT(userInfo)}`;
107
+ headers[commonAppConst.httpHeader.AUTHORIZATION] = token;
108
+ return httpRequest(method, url, data, headers)
100
109
  }
@@ -2,10 +2,10 @@ import { logger } from '../logger/logger';
2
2
  import { downloadFile } from '../../lib/azure/azureBlobStorage';
3
3
  import { newsCategoryConst, updateNewsConst, newsCategorySourceMapping, reportsCategorySourceMapping,
4
4
  transcriptsCategorySourceMapping, exchangeFilingsCategorySourceMapping, pressReleaseSourceMapping,
5
- dataMiningSourceMapping, webContentSourceMapping, NewsSource,
5
+ dataMiningSourceMapping, webContentSourceMapping, NewsSource, newsConst,
6
6
  contentApplicationFeature, lockedContentApplicationFeature, Feature, commonAppConst } from 'skyeye-common-const';
7
7
 
8
- export async function overwriteConst(containerName: string, blobName: string, connectionKey: string): Promise<string> {
8
+ export async function overwriteConst(containerName: string, blobName: string, connectionKey: string): Promise<any> {
9
9
  logger.info(`start overwriteConst`);
10
10
 
11
11
  // Overwrite newsConst
@@ -46,5 +46,18 @@ export async function overwriteConst(containerName: string, blobName: string, co
46
46
  }
47
47
 
48
48
  logger.info(`end overwriteConst`);
49
- return publisherListStr;
49
+
50
+ const res = {
51
+ newsConst: newsConst,
52
+ newsCategorySourceMapping: newsCategorySourceMapping,
53
+ reportsCategorySourceMapping: reportsCategorySourceMapping,
54
+ transcriptsCategorySourceMapping: transcriptsCategorySourceMapping,
55
+ exchangeFilingsCategorySourceMapping: exchangeFilingsCategorySourceMapping,
56
+ pressReleaseSourceMapping: pressReleaseSourceMapping,
57
+ dataMiningSourceMapping: dataMiningSourceMapping,
58
+ webContentSourceMapping: webContentSourceMapping,
59
+ contentApplicationFeature: contentApplicationFeature,
60
+ lockedContentApplicationFeature: lockedContentApplicationFeature
61
+ }
62
+ return res;
50
63
  }
package/dist/index.d.ts DELETED
@@ -1,24 +0,0 @@
1
- export * from './utils/appConfig';
2
- export * from './utils/appConst';
3
- export * from './utils/commonUtils';
4
- export * from './utils/authentication/auth';
5
- export * from './utils/logger/logger';
6
- export { default as morganLogger } from './utils/logger/morganLogger';
7
- export * from './utils/middleware/handleError';
8
- export * from './utils/middleware/isPublicUser';
9
- export * from './utils/middleware/overwriteConst';
10
- export * from './utils/middleware/startdbConnection';
11
- export * from './utils/baseClass/baseController';
12
- export * from './utils/baseClass/baseService';
13
- export * from './interfaces/index';
14
- export * from './lib/azure/azureKeyVault';
15
- export * from './lib/azure/azureStorageQueue';
16
- export * from './lib/azure/azureServiceBusQueue';
17
- export * from './lib/azure/azureTableStorage';
18
- export * from './lib/azure/azureBlobStorage';
19
- export * from './utils/documentation/swagger';
20
- export * from './lib/httpClient';
21
- export * from './utils/monitoring/apm';
22
- export * from './models/baseControllerParameter';
23
- export * from './lib/redisClient';
24
- export * from './lib/sendGridClient';
package/dist/index.js DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./utils/appConfig"), exports);
14
- __exportStar(require("./utils/appConst"), exports);
15
- __exportStar(require("./utils/commonUtils"), exports);
16
- __exportStar(require("./utils/authentication/auth"), exports);
17
- __exportStar(require("./utils/logger/logger"), exports);
18
- var morganLogger_1 = require("./utils/logger/morganLogger");
19
- Object.defineProperty(exports, "morganLogger", { enumerable: true, get: function () { return morganLogger_1.default; } });
20
- __exportStar(require("./utils/middleware/handleError"), exports);
21
- __exportStar(require("./utils/middleware/isPublicUser"), exports);
22
- __exportStar(require("./utils/middleware/overwriteConst"), exports);
23
- __exportStar(require("./utils/middleware/startdbConnection"), exports);
24
- __exportStar(require("./utils/baseClass/baseController"), exports);
25
- __exportStar(require("./utils/baseClass/baseService"), exports);
26
- __exportStar(require("./interfaces/index"), exports);
27
- __exportStar(require("./lib/azure/azureKeyVault"), exports);
28
- __exportStar(require("./lib/azure/azureStorageQueue"), exports);
29
- __exportStar(require("./lib/azure/azureServiceBusQueue"), exports);
30
- __exportStar(require("./lib/azure/azureTableStorage"), exports);
31
- __exportStar(require("./lib/azure/azureBlobStorage"), exports);
32
- __exportStar(require("./utils/documentation/swagger"), exports);
33
- __exportStar(require("./lib/httpClient"), exports);
34
- __exportStar(require("./utils/monitoring/apm"), exports);
35
- __exportStar(require("./models/baseControllerParameter"), exports);
36
- __exportStar(require("./lib/redisClient"), exports);
37
- __exportStar(require("./lib/sendGridClient"), exports);
38
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkC;AAClC,mDAAiC;AACjC,sDAAoC;AACpC,8DAA4C;AAC5C,wDAAsC;AACtC,4DAAsE;AAA7D,4GAAA,OAAO,OAAgB;AAChC,iEAA+C;AAC/C,kEAAgD;AAChD,oEAAkD;AAClD,uEAAqD;AACrD,mEAAiD;AACjD,gEAA8C;AAC9C,qDAAmC;AACnC,4DAA0C;AAC1C,gEAA8C;AAC9C,mEAAiD;AACjD,gEAA8C;AAC9C,+DAA6C;AAC7C,gEAA8C;AAC9C,mDAAiC;AACjC,yDAAuC;AACvC,mEAAiD;AACjD,oDAAkC;AAClC,uDAAqC"}
@@ -1,7 +0,0 @@
1
- export interface ApiResponse {
2
- isSuccess: boolean;
3
- message?: string;
4
- data?: any;
5
- totalCount?: number;
6
- aggregation?: any;
7
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=apiResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"apiResponse.js","sourceRoot":"","sources":["../../src/interfaces/apiResponse.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- import { ApiResponse } from './apiResponse';
2
- import { ServiceResponse } from './serviceResponse';
3
- import { UserInfo } from './userInfo';
4
- import { Pagination } from './pagination';
5
- import { SubcriptionFeaturePermissionModel } from './subcriptionFeaturePermissionModel';
6
- export { ApiResponse, ServiceResponse, UserInfo, Pagination, SubcriptionFeaturePermissionModel };
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubcriptionFeaturePermissionModel = exports.Pagination = exports.UserInfo = void 0;
4
- const userInfo_1 = require("./userInfo");
5
- Object.defineProperty(exports, "UserInfo", { enumerable: true, get: function () { return userInfo_1.UserInfo; } });
6
- const pagination_1 = require("./pagination");
7
- Object.defineProperty(exports, "Pagination", { enumerable: true, get: function () { return pagination_1.Pagination; } });
8
- const subcriptionFeaturePermissionModel_1 = require("./subcriptionFeaturePermissionModel");
9
- Object.defineProperty(exports, "SubcriptionFeaturePermissionModel", { enumerable: true, get: function () { return subcriptionFeaturePermissionModel_1.SubcriptionFeaturePermissionModel; } });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAEA,yCAAsC;AAMlC,yFANK,mBAAQ,OAML;AALZ,6CAA0C;AAMtC,2FANK,uBAAU,OAML;AALd,2FAAwF;AAMpF,kHANK,qEAAiC,OAML"}
@@ -1,6 +0,0 @@
1
- export declare class Pagination {
2
- skip: number;
3
- take: number;
4
- order: any;
5
- constructor();
6
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Pagination = void 0;
4
- class Pagination {
5
- constructor() {
6
- this.skip = 0;
7
- this.take = 20;
8
- this.order = null;
9
- }
10
- }
11
- exports.Pagination = Pagination;
12
- //# sourceMappingURL=pagination.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/interfaces/pagination.ts"],"names":[],"mappings":";;;AACA,MAAa,UAAU;IAInB;QACI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;CACJ;AATD,gCASC"}
@@ -1,8 +0,0 @@
1
- export interface ServiceResponse {
2
- isSuccess: boolean;
3
- message?: string;
4
- data?: any;
5
- totalCount?: number;
6
- aggregation?: any;
7
- error?: boolean;
8
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=serviceResponse.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serviceResponse.js","sourceRoot":"","sources":["../../src/interfaces/serviceResponse.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- export declare class SubcriptionFeaturePermissionModel {
2
- organisationGuid: string;
3
- organisationName: string;
4
- organisationStatus: string;
5
- permissionList: string[];
6
- featureList: string[];
7
- constructor();
8
- }
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SubcriptionFeaturePermissionModel = void 0;
4
- class SubcriptionFeaturePermissionModel {
5
- constructor() {
6
- this.organisationGuid = null;
7
- this.organisationName = null;
8
- this.organisationStatus = null;
9
- this.permissionList = new Array();
10
- this.featureList = new Array();
11
- }
12
- }
13
- exports.SubcriptionFeaturePermissionModel = SubcriptionFeaturePermissionModel;
14
- //# sourceMappingURL=subcriptionFeaturePermissionModel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subcriptionFeaturePermissionModel.js","sourceRoot":"","sources":["../../src/interfaces/subcriptionFeaturePermissionModel.ts"],"names":[],"mappings":";;;AAAA,MAAa,iCAAiC;IAY1C;QACI,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,IAAI,KAAK,EAAU,CAAC;QAC1C,IAAI,CAAC,WAAW,GAAG,IAAI,KAAK,EAAU,CAAC;IAC3C,CAAC;CACJ;AAnBD,8EAmBC"}
@@ -1,17 +0,0 @@
1
- import { SubcriptionFeaturePermissionModel } from './subcriptionFeaturePermissionModel';
2
- export declare class UserInfo {
3
- userName: string;
4
- email: string;
5
- contactNumber: string;
6
- userGuid: string;
7
- firstName: string;
8
- lastName: string;
9
- subcriptionFeaturePermissionModel: SubcriptionFeaturePermissionModel[];
10
- requestOrganisation: string;
11
- isPublicUser: boolean;
12
- internalUsage: boolean;
13
- isApiUser: boolean;
14
- exp: number;
15
- subKeys: string[];
16
- constructor();
17
- }
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserInfo = void 0;
4
- class UserInfo {
5
- constructor() {
6
- this.userName = null;
7
- this.email = null;
8
- this.userGuid = null;
9
- this.firstName = null;
10
- this.lastName = null;
11
- this.isPublicUser = null;
12
- this.internalUsage = null;
13
- this.isApiUser = null;
14
- this.subcriptionFeaturePermissionModel = new Array();
15
- this.requestOrganisation = null;
16
- this.exp = Math.floor(Date.now() / 1000) + (60 * 60);
17
- this.subKeys = new Array();
18
- }
19
- }
20
- exports.UserInfo = UserInfo;
21
- //# sourceMappingURL=userInfo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"userInfo.js","sourceRoot":"","sources":["../../src/interfaces/userInfo.ts"],"names":[],"mappings":";;;AAEA,MAAa,QAAQ;IA2BjB;QACI,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,iCAAiC,GAAG,IAAI,KAAK,EAAqC,CAAC;QACxF,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QACrD,IAAI,CAAC,OAAO,GAAG,IAAI,KAAK,EAAU,CAAC;IACvC,CAAC;CACJ;AAzCD,4BAyCC"}
@@ -1,4 +0,0 @@
1
- export declare function uploadFile(containerName: string, fileName: string, content: any, connectionKey?: string): Promise<string>;
2
- export declare function listFile(containerName: string, prefix?: string, connectionKey?: string): Promise<string[]>;
3
- export declare function downloadFile(containerName: string, blobName: string, connectionKey?: string): Promise<string>;
4
- export declare function generateSasUrl(containerName: string, fileName: string, connectionKey?: string): Promise<string>;
@@ -1,135 +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
- var __asyncValues = (this && this.__asyncValues) || function (o) {
12
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
- var m = o[Symbol.asyncIterator], i;
14
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
15
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
16
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.generateSasUrl = exports.downloadFile = exports.listFile = exports.uploadFile = void 0;
20
- const { BlobServiceClient, generateBlobSASQueryParameters, StorageSharedKeyCredential, BlobSASPermissions } = require('@azure/storage-blob');
21
- const appConfig_1 = require("../../utils/appConfig");
22
- const azureKeyVault_1 = require("./azureKeyVault");
23
- const logger_1 = require("../../utils/logger/logger");
24
- function uploadFile(containerName, fileName, content, connectionKey = appConfig_1.commonAppConfig.StorageAccountConnectionKey) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- logger_1.logger.info(`start blobstorage.uploadFile : ${containerName} ; ${fileName}`);
27
- const STORAGE_CONNECTION_STRING = yield azureKeyVault_1.getKey(connectionKey);
28
- const blobServiceClient = BlobServiceClient.fromConnectionString(STORAGE_CONNECTION_STRING);
29
- const containerClient = blobServiceClient.getContainerClient(containerName);
30
- const blockBlobClient = containerClient.getBlockBlobClient(fileName);
31
- let jsonStr = JSON.stringify(content);
32
- const uploadBlobResponse = yield blockBlobClient.upload(jsonStr, jsonStr.length);
33
- logger_1.logger.info(`end blobstorage.uploadFile : ${uploadBlobResponse.requestId}`);
34
- return uploadBlobResponse.requestId;
35
- });
36
- }
37
- exports.uploadFile = uploadFile;
38
- function listFile(containerName, prefix = "", connectionKey = appConfig_1.commonAppConfig.StorageAccountConnectionKey) {
39
- var e_1, _a;
40
- return __awaiter(this, void 0, void 0, function* () {
41
- logger_1.logger.info(`start blobstorage.listFile : ${containerName} ; ${prefix}`);
42
- const STORAGE_CONNECTION_STRING = yield azureKeyVault_1.getKey(connectionKey);
43
- const blobServiceClient = BlobServiceClient.fromConnectionString(STORAGE_CONNECTION_STRING);
44
- const containerClient = blobServiceClient.getContainerClient(containerName);
45
- let option = {
46
- prefix: prefix
47
- };
48
- let fileNames = [];
49
- try {
50
- for (var _b = __asyncValues(containerClient.listBlobsFlat(option)), _c; _c = yield _b.next(), !_c.done;) {
51
- const blob = _c.value;
52
- fileNames.push(blob.name);
53
- }
54
- }
55
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
56
- finally {
57
- try {
58
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
59
- }
60
- finally { if (e_1) throw e_1.error; }
61
- }
62
- logger_1.logger.info(`end blobstorage.listFile : ${fileNames.length}`);
63
- return fileNames;
64
- });
65
- }
66
- exports.listFile = listFile;
67
- function downloadFile(containerName, blobName, connectionKey = appConfig_1.commonAppConfig.StorageAccountConnectionKey) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- logger_1.logger.info(`start blobstorage.downloadFile : ${containerName} ; ${blobName}`);
70
- const STORAGE_CONNECTION_STRING = yield azureKeyVault_1.getKey(connectionKey);
71
- const blobServiceClient = BlobServiceClient.fromConnectionString(STORAGE_CONNECTION_STRING);
72
- const containerClient = blobServiceClient.getContainerClient(containerName);
73
- const blobClient = containerClient.getBlobClient(blobName);
74
- const downloadResponse = yield blobClient.download();
75
- const downloaded = yield streamToBuffer(downloadResponse.readableStreamBody);
76
- const downloadString = downloaded.toString();
77
- logger_1.logger.info(`end blobstorage.downloadFile : ${downloadString}`);
78
- return downloadString;
79
- });
80
- }
81
- exports.downloadFile = downloadFile;
82
- function streamToBuffer(readableStream) {
83
- return __awaiter(this, void 0, void 0, function* () {
84
- return new Promise((resolve, reject) => {
85
- const chunks = [];
86
- readableStream.on("data", (data) => {
87
- chunks.push(data instanceof Buffer ? data : Buffer.from(data));
88
- });
89
- readableStream.on("end", () => {
90
- resolve(Buffer.concat(chunks));
91
- });
92
- readableStream.on("error", reject);
93
- });
94
- });
95
- }
96
- function generateSasUrl(containerName, fileName, connectionKey = appConfig_1.commonAppConfig.StorageAccountConnectionKey) {
97
- return __awaiter(this, void 0, void 0, function* () {
98
- logger_1.logger.info(`start blobstorage.generateSasUrl : ${containerName} ; ${fileName}`);
99
- const STORAGE_CONNECTION_STRING = yield azureKeyVault_1.getKey(connectionKey);
100
- let keys = STORAGE_CONNECTION_STRING.split(';');
101
- let accountName = "";
102
- let accountKey = "";
103
- let endpointSuffix = "";
104
- let protocol = "";
105
- for (let key of keys) {
106
- if (key.startsWith("AccountName")) {
107
- accountName = key.split("=")[1];
108
- }
109
- else if (key.startsWith("AccountKey")) {
110
- accountKey = key.split("=")[1];
111
- }
112
- else if (key.startsWith("DefaultEndpointsProtocol")) {
113
- protocol = key.split("=")[1];
114
- }
115
- else if (key.startsWith("EndpointSuffix")) {
116
- endpointSuffix = key.split("=")[1];
117
- }
118
- }
119
- var startDate = new Date();
120
- startDate.setMinutes(startDate.getMinutes() - 5);
121
- var expiryDate = new Date(startDate);
122
- expiryDate.setMinutes(startDate.getMinutes() + 60);
123
- const sasToken = generateBlobSASQueryParameters({
124
- containerName: containerName,
125
- blobName: fileName,
126
- expiresOn: expiryDate,
127
- startsOn: startDate,
128
- permissions: BlobSASPermissions.parse('r')
129
- }, new StorageSharedKeyCredential(accountName, accountKey)).toString();
130
- logger_1.logger.info(`end blobstorage.generateSasUrl `);
131
- return `${protocol}://${accountName}.blob.${endpointSuffix}/${containerName}/${encodeURIComponent(fileName)}?${sasToken}`;
132
- });
133
- }
134
- exports.generateSasUrl = generateSasUrl;
135
- //# sourceMappingURL=azureBlobStor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AAI,aAAa,IAAI,kBAAkB,CAAC,QAAQ,CAAC,IAAI,QAAQ,EAAE,CAAA;IAC7H,CAAC;CAAA;AAxCD,wCAwCC"}
@@ -1 +0,0 @@
1
- export declare function getKey(secretName: string): Promise<string>;
@@ -1,27 +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
- exports.getKey = void 0;
13
- const keyvault_secrets_1 = require("@azure/keyvault-secrets");
14
- const identity_1 = require("@azure/identity");
15
- const appConfig_1 = require("../../utils/appConfig");
16
- function getKey(secretName) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const credential = new identity_1.DefaultAzureCredential();
19
- const url = `https://${appConfig_1.commonAppConfig.KeyVaultName}.vault.azure.net`;
20
- const client = yield new keyvault_secrets_1.SecretClient(url, credential);
21
- // Read the secret we created
22
- const secret = yield client.getSecret(secretName);
23
- return secret.value;
24
- });
25
- }
26
- exports.getKey = getKey;
27
- //# sourceMappingURL=azureKeyVault.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"azureKeyVault.js","sourceRoot":"","sources":["../../../src/lib/azure/azureKeyVault.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8DAAuD;AACvD,8CAAyD;AACzD,qDAAuD;AAEvD,SAAsB,MAAM,CAAC,UAAmB;;QAC5C,MAAM,UAAU,GAAG,IAAI,iCAAsB,EAAE,CAAC;QAEhD,MAAM,GAAG,GAAG,WAAW,2BAAe,CAAC,YAAY,kBAAkB,CAAC;QAEtE,MAAM,MAAM,GAAG,MAAM,IAAI,+BAAY,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;QACvD,6BAA6B;QAC7B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAElD,OAAO,MAAM,CAAC,KAAK,CAAC;IACxB,CAAC;CAAA;AAVD,wBAUC"}
@@ -1 +0,0 @@
1
- export declare function sendServiceBusMessage(queueName: string, message: string, connectionKey?: string, isConvertMsgToJson?: boolean): Promise<void>;
@@ -1,42 +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
- exports.sendServiceBusMessage = void 0;
13
- const service_bus_1 = require("@azure/service-bus");
14
- const azureKeyVault_1 = require("./azureKeyVault");
15
- const appConfig_1 = require("../../utils/appConfig");
16
- const logger_1 = require("../../utils/logger/logger");
17
- function sendServiceBusMessage(queueName, message, connectionKey = appConfig_1.commonAppConfig.ServiceBusConnectionKey, isConvertMsgToJson = false) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- logger_1.logger.info("start sendServiceBusMessage");
20
- const SERVICE_BUS_CONNECTION_STRING = yield azureKeyVault_1.getKey(connectionKey);
21
- const sbClient = new service_bus_1.ServiceBusClient(SERVICE_BUS_CONNECTION_STRING);
22
- const sender = sbClient.createSender(queueName);
23
- try {
24
- let msg = {
25
- body: isConvertMsgToJson ? JSON.parse(message) : message,
26
- contentType: "application/json; charset=utf-8"
27
- };
28
- yield sender.sendMessages(msg);
29
- yield sender.close();
30
- }
31
- catch (err) {
32
- logger_1.logger.error(`Error in sendServiceBusMessage: ${err}`);
33
- throw err;
34
- }
35
- finally {
36
- yield sbClient.close();
37
- }
38
- logger_1.logger.info("end sendServiceBusMessage");
39
- });
40
- }
41
- exports.sendServiceBusMessage = sendServiceBusMessage;
42
- //# sourceMappingURL=azureServiceBusQueue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"azureServiceBusQueue.js","sourceRoot":"","sources":["../../../src/lib/azure/azureServiceBusQueue.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAwE;AACxE,mDAAyC;AACzC,qDAAwD;AACxD,sDAAmD;AAEnD,SAAsB,qBAAqB,CAAC,SAAiB,EAAE,OAAe,EAAE,gBAAwB,2BAAe,CAAC,uBAAuB,EAAE,qBAA8B,KAAK;;QAChL,eAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;QAC3C,MAAM,6BAA6B,GAAG,MAAM,sBAAM,CAAC,aAAa,CAAC,CAAC;QAClE,MAAM,QAAQ,GAAG,IAAI,8BAAgB,CAAC,6BAA6B,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAChD,IAAI;YACA,IAAI,GAAG,GAAsB;gBACzB,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;gBACxD,WAAW,EAAE,iCAAiC;aACjD,CAAC;YACF,MAAM,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YAC/B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;SACxB;QAAC,OAAM,GAAG,EAAE;YACT,eAAM,CAAC,KAAK,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAC;YACvD,MAAM,GAAG,CAAC;SACb;gBAAS;YACN,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;SAC1B;QACD,eAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC7C,CAAC;CAAA;AAnBD,sDAmBC"}
@@ -1 +0,0 @@
1
- export declare function sendMessage(queueName: string, message: string, connectionKey?: string): Promise<string>;
@@ -1,26 +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
- exports.sendMessage = void 0;
13
- const storage_queue_1 = require("@azure/storage-queue");
14
- const azureKeyVault_1 = require("./azureKeyVault");
15
- const appConfig_1 = require("../../utils/appConfig");
16
- function sendMessage(queueName, message, connectionKey = appConfig_1.commonAppConfig.StorageAccountConnectionKey) {
17
- return __awaiter(this, void 0, void 0, function* () {
18
- const STORAGE_CONNECTION_STRING = yield azureKeyVault_1.getKey(connectionKey);
19
- const queueServiceClient = storage_queue_1.QueueServiceClient.fromConnectionString(STORAGE_CONNECTION_STRING);
20
- const queueClient = queueServiceClient.getQueueClient(queueName);
21
- let queueSendMessageResponse = yield queueClient.sendMessage(Buffer.from(message).toString('base64'));
22
- return queueSendMessageResponse.messageId;
23
- });
24
- }
25
- exports.sendMessage = sendMessage;
26
- //# sourceMappingURL=azureStorageQueue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"azureStorageQueue.js","sourceRoot":"","sources":["../../../src/lib/azure/azureStorageQueue.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAAoF;AACpF,mDAAyC;AACzC,qDAAwD;AACxD,SAAsB,WAAW,CAAC,SAAiB,EAAE,OAAe,EAAE,gBAAwB,2BAAe,CAAC,2BAA2B;;QACrI,MAAM,yBAAyB,GAAG,MAAM,sBAAM,CAAC,aAAa,CAAC,CAAC;QAE9D,MAAM,kBAAkB,GAAG,kCAAkB,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,CAAC;QAE9F,MAAM,WAAW,GAAG,kBAAkB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QACjE,IAAI,wBAAwB,GAA6B,MAAM,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QAChI,OAAO,wBAAwB,CAAC,SAAS,CAAC;IAC9C,CAAC;CAAA;AARD,kCAQC"}
@@ -1,4 +0,0 @@
1
- import azure from 'azure-storage';
2
- export declare function retrieveEntity<T>(tableName: string, partitionKey: string, rowKey: string, storageConnectionKey?: string): Promise<T>;
3
- export declare function queryEntities<T>(tableName: string, tableQuery?: azure.TableQuery, storageConnectionKey?: string): Promise<T>;
4
- export declare function deleteEntity(tableName: string, partitionKey: string, rowKey: string, storageConnectionKey?: string): Promise<void>;