skyeye-svc-common-utils 2.0.0-dev0.20 → 2.0.0-dev0.21

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 (388) hide show
  1. package/dist/index.d.ts +32 -0
  2. package/dist/index.js +49 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/interfaces/apiResponse.d.ts +7 -0
  5. package/dist/interfaces/apiResponse.js +3 -0
  6. package/dist/interfaces/apiResponse.js.map +1 -0
  7. package/dist/interfaces/grpcListRequest.d.ts +6 -0
  8. package/dist/interfaces/grpcListRequest.js +3 -0
  9. package/dist/interfaces/grpcListRequest.js.map +1 -0
  10. package/dist/interfaces/grpcServiceResponse.d.ts +8 -0
  11. package/dist/interfaces/grpcServiceResponse.js +3 -0
  12. package/dist/interfaces/grpcServiceResponse.js.map +1 -0
  13. package/dist/interfaces/index.d.ts +10 -0
  14. package/dist/interfaces/index.js +26 -0
  15. package/dist/interfaces/index.js.map +1 -0
  16. package/dist/interfaces/internalHttp/request/index.d.ts +1 -0
  17. package/dist/interfaces/internalHttp/request/index.js +18 -0
  18. package/dist/interfaces/internalHttp/request/index.js.map +1 -0
  19. package/dist/interfaces/internalHttp/request/search.d.ts +9 -0
  20. package/dist/interfaces/internalHttp/request/search.js +3 -0
  21. package/dist/interfaces/internalHttp/request/search.js.map +1 -0
  22. package/dist/interfaces/internalHttp/response/index.d.ts +1 -0
  23. package/dist/interfaces/internalHttp/response/index.js +18 -0
  24. package/dist/interfaces/internalHttp/response/index.js.map +1 -0
  25. package/dist/interfaces/internalHttp/response/search.d.ts +10 -0
  26. package/dist/interfaces/internalHttp/response/search.js +3 -0
  27. package/dist/interfaces/internalHttp/response/search.js.map +1 -0
  28. package/dist/interfaces/pagination.d.ts +6 -0
  29. package/dist/interfaces/pagination.js +12 -0
  30. package/dist/interfaces/pagination.js.map +1 -0
  31. package/dist/interfaces/serviceResponse.d.ts +8 -0
  32. package/dist/interfaces/serviceResponse.js +3 -0
  33. package/dist/interfaces/serviceResponse.js.map +1 -0
  34. package/dist/interfaces/subcriptionFeaturePermissionModel.d.ts +8 -0
  35. package/dist/interfaces/subcriptionFeaturePermissionModel.js +14 -0
  36. package/dist/interfaces/subcriptionFeaturePermissionModel.js.map +1 -0
  37. package/dist/interfaces/userInfo.d.ts +17 -0
  38. package/dist/interfaces/userInfo.js +21 -0
  39. package/dist/interfaces/userInfo.js.map +1 -0
  40. package/dist/lib/azure/azureBlobStorage.d.ts +4 -0
  41. package/dist/lib/azure/azureBlobStorage.js +137 -0
  42. package/dist/lib/azure/azureBlobStorage.js.map +1 -0
  43. package/dist/lib/azure/azureKeyVault.d.ts +11 -0
  44. package/dist/lib/azure/azureKeyVault.js +65 -0
  45. package/dist/lib/azure/azureKeyVault.js.map +1 -0
  46. package/dist/lib/azure/azureServiceBusClient.d.ts +47 -0
  47. package/dist/lib/azure/azureServiceBusClient.js +139 -0
  48. package/dist/lib/azure/azureServiceBusClient.js.map +1 -0
  49. package/dist/lib/azure/azureServiceBusQueue.d.ts +1 -0
  50. package/dist/lib/azure/azureServiceBusQueue.js +42 -0
  51. package/dist/lib/azure/azureServiceBusQueue.js.map +1 -0
  52. package/dist/lib/azure/azureStorageQueue.d.ts +1 -0
  53. package/dist/lib/azure/azureStorageQueue.js +26 -0
  54. package/dist/lib/azure/azureStorageQueue.js.map +1 -0
  55. package/dist/lib/azure/azureTableStorage.d.ts +4 -0
  56. package/dist/lib/azure/azureTableStorage.js +67 -0
  57. package/dist/lib/azure/azureTableStorage.js.map +1 -0
  58. package/dist/lib/azure/cognitiveSearch/QueryType.d.ts +8 -0
  59. package/dist/lib/azure/cognitiveSearch/QueryType.js +13 -0
  60. package/dist/lib/azure/cognitiveSearch/QueryType.js.map +1 -0
  61. package/dist/lib/azure/cognitiveSearch/SearchClient.d.ts +42 -0
  62. package/dist/lib/azure/cognitiveSearch/SearchClient.js +161 -0
  63. package/dist/lib/azure/cognitiveSearch/SearchClient.js.map +1 -0
  64. package/dist/lib/azure/cognitiveSearch/SearchFacets.d.ts +16 -0
  65. package/dist/lib/azure/cognitiveSearch/SearchFacets.js +3 -0
  66. package/dist/lib/azure/cognitiveSearch/SearchFacets.js.map +1 -0
  67. package/dist/lib/azure/cognitiveSearch/SearchFilter.d.ts +68 -0
  68. package/dist/lib/azure/cognitiveSearch/SearchFilter.js +125 -0
  69. package/dist/lib/azure/cognitiveSearch/SearchFilter.js.map +1 -0
  70. package/dist/lib/azure/cognitiveSearch/SearchMode.d.ts +9 -0
  71. package/dist/lib/azure/cognitiveSearch/SearchMode.js +14 -0
  72. package/dist/lib/azure/cognitiveSearch/SearchMode.js.map +1 -0
  73. package/dist/lib/azure/cognitiveSearch/SearchOption.d.ts +88 -0
  74. package/dist/lib/azure/cognitiveSearch/SearchOption.js +104 -0
  75. package/dist/lib/azure/cognitiveSearch/SearchOption.js.map +1 -0
  76. package/dist/lib/azure/cognitiveSearch/SearchOrder.d.ts +9 -0
  77. package/dist/lib/azure/cognitiveSearch/SearchOrder.js +3 -0
  78. package/dist/lib/azure/cognitiveSearch/SearchOrder.js.map +1 -0
  79. package/dist/lib/azure/cognitiveSearch/index.d.ts +7 -0
  80. package/dist/lib/azure/cognitiveSearch/index.js +24 -0
  81. package/dist/lib/azure/cognitiveSearch/index.js.map +1 -0
  82. package/dist/lib/azure/index.d.ts +7 -0
  83. package/dist/lib/azure/index.js +24 -0
  84. package/dist/lib/azure/index.js.map +1 -0
  85. package/dist/lib/fetch/index.d.ts +2 -0
  86. package/dist/lib/fetch/index.js +19 -0
  87. package/dist/lib/fetch/index.js.map +1 -0
  88. package/dist/lib/fetch/sendRequest.d.ts +8 -0
  89. package/dist/lib/fetch/sendRequest.js +25 -0
  90. package/dist/lib/fetch/sendRequest.js.map +1 -0
  91. package/dist/lib/fetch/sendRequestWithTimeout.d.ts +9 -0
  92. package/dist/lib/fetch/sendRequestWithTimeout.js +53 -0
  93. package/dist/lib/fetch/sendRequestWithTimeout.js.map +1 -0
  94. package/dist/lib/httpClient.d.ts +4 -0
  95. package/dist/lib/httpClient.js +55 -0
  96. package/dist/lib/httpClient.js.map +1 -0
  97. package/dist/lib/index.d.ts +3 -0
  98. package/dist/lib/index.js +20 -0
  99. package/dist/lib/index.js.map +1 -0
  100. package/dist/lib/redisClient.d.ts +45 -0
  101. package/dist/lib/redisClient.js +153 -0
  102. package/dist/lib/redisClient.js.map +1 -0
  103. package/dist/lib/sendGridClient.d.ts +27 -0
  104. package/dist/lib/sendGridClient.js +62 -0
  105. package/dist/lib/sendGridClient.js.map +1 -0
  106. package/dist/lib/teams/broadcastLogMessage.d.ts +8 -0
  107. package/dist/lib/teams/broadcastLogMessage.js +81 -0
  108. package/dist/lib/teams/broadcastLogMessage.js.map +1 -0
  109. package/dist/lib/teams/index.d.ts +2 -0
  110. package/dist/lib/teams/index.js +19 -0
  111. package/dist/lib/teams/index.js.map +1 -0
  112. package/dist/lib/teams/logMessage.d.ts +51 -0
  113. package/dist/lib/teams/logMessage.js +33 -0
  114. package/dist/lib/teams/logMessage.js.map +1 -0
  115. package/dist/models/baseControllerParameter.d.ts +9 -0
  116. package/dist/models/baseControllerParameter.js +24 -0
  117. package/dist/models/baseControllerParameter.js.map +1 -0
  118. package/dist/models/campaign/grpcCampaignEventModel.d.ts +18 -0
  119. package/dist/models/campaign/grpcCampaignEventModel.js +24 -0
  120. package/dist/models/campaign/grpcCampaignEventModel.js.map +1 -0
  121. package/dist/models/campaign/grpcCampaignEventUserModel.d.ts +13 -0
  122. package/dist/models/campaign/grpcCampaignEventUserModel.js +19 -0
  123. package/dist/models/campaign/grpcCampaignEventUserModel.js.map +1 -0
  124. package/dist/models/campaign/grpcCampaignUserModel.d.ts +12 -0
  125. package/dist/models/campaign/grpcCampaignUserModel.js +16 -0
  126. package/dist/models/campaign/grpcCampaignUserModel.js.map +1 -0
  127. package/dist/models/campaign/index.d.ts +4 -0
  128. package/dist/models/campaign/index.js +10 -0
  129. package/dist/models/campaign/index.js.map +1 -0
  130. package/dist/models/emailtemplate/grpcEmailTemplateModel.d.ts +10 -0
  131. package/dist/models/emailtemplate/grpcEmailTemplateModel.js +16 -0
  132. package/dist/models/emailtemplate/grpcEmailTemplateModel.js.map +1 -0
  133. package/dist/models/emailtemplate/index.d.ts +2 -0
  134. package/dist/models/emailtemplate/index.js +6 -0
  135. package/dist/models/emailtemplate/index.js.map +1 -0
  136. package/dist/models/index.d.ts +10 -0
  137. package/dist/models/index.js +28 -0
  138. package/dist/models/index.js.map +1 -0
  139. package/dist/models/organisation/grpcOrganisationModel.d.ts +15 -0
  140. package/dist/models/organisation/grpcOrganisationModel.js +21 -0
  141. package/dist/models/organisation/grpcOrganisationModel.js.map +1 -0
  142. package/dist/models/organisation/index.d.ts +2 -0
  143. package/dist/models/organisation/index.js +6 -0
  144. package/dist/models/organisation/index.js.map +1 -0
  145. package/dist/models/rbac/grpcRoleModel.d.ts +9 -0
  146. package/dist/models/rbac/grpcRoleModel.js +15 -0
  147. package/dist/models/rbac/grpcRoleModel.js.map +1 -0
  148. package/dist/models/rbac/index.d.ts +2 -0
  149. package/dist/models/rbac/index.js +6 -0
  150. package/dist/models/rbac/index.js.map +1 -0
  151. package/dist/models/scoutai/grpcAIDETrainingResultListModel.d.ts +8 -0
  152. package/dist/models/scoutai/grpcAIDETrainingResultListModel.js +14 -0
  153. package/dist/models/scoutai/grpcAIDETrainingResultListModel.js.map +1 -0
  154. package/dist/models/scoutai/grpcNerlCorrectionModel.d.ts +11 -0
  155. package/dist/models/scoutai/grpcNerlCorrectionModel.js +16 -0
  156. package/dist/models/scoutai/grpcNerlCorrectionModel.js.map +1 -0
  157. package/dist/models/scoutai/grpcScoutAIListReq.d.ts +12 -0
  158. package/dist/models/scoutai/grpcScoutAIListReq.js +17 -0
  159. package/dist/models/scoutai/grpcScoutAIListReq.js.map +1 -0
  160. package/dist/models/scoutai/grpcScoutAIModel.d.ts +10 -0
  161. package/dist/models/scoutai/grpcScoutAIModel.js +16 -0
  162. package/dist/models/scoutai/grpcScoutAIModel.js.map +1 -0
  163. package/dist/models/scoutai/grpcScoutAIResult.d.ts +10 -0
  164. package/dist/models/scoutai/grpcScoutAIResult.js +16 -0
  165. package/dist/models/scoutai/grpcScoutAIResult.js.map +1 -0
  166. package/dist/models/scoutai/grpcTaasConfigAIModel.d.ts +6 -0
  167. package/dist/models/scoutai/grpcTaasConfigAIModel.js +12 -0
  168. package/dist/models/scoutai/grpcTaasConfigAIModel.js.map +1 -0
  169. package/dist/models/scoutai/grpcTaasConfigModel.d.ts +11 -0
  170. package/dist/models/scoutai/grpcTaasConfigModel.js +15 -0
  171. package/dist/models/scoutai/grpcTaasConfigModel.js.map +1 -0
  172. package/dist/models/scoutai/grpcTaasConfigUserModel.d.ts +8 -0
  173. package/dist/models/scoutai/grpcTaasConfigUserModel.js +14 -0
  174. package/dist/models/scoutai/grpcTaasConfigUserModel.js.map +1 -0
  175. package/dist/models/scoutai/grpcTagItemModel.d.ts +9 -0
  176. package/dist/models/scoutai/grpcTagItemModel.js +15 -0
  177. package/dist/models/scoutai/grpcTagItemModel.js.map +1 -0
  178. package/dist/models/scoutai/grpcVisualisationModel.d.ts +11 -0
  179. package/dist/models/scoutai/grpcVisualisationModel.js +15 -0
  180. package/dist/models/scoutai/grpcVisualisationModel.js.map +1 -0
  181. package/dist/models/scoutai/grpcVisualisationPositionModel.d.ts +6 -0
  182. package/dist/models/scoutai/grpcVisualisationPositionModel.js +11 -0
  183. package/dist/models/scoutai/grpcVisualisationPositionModel.js.map +1 -0
  184. package/dist/models/scoutai/index.d.ts +10 -0
  185. package/dist/models/scoutai/index.js +22 -0
  186. package/dist/models/scoutai/index.js.map +1 -0
  187. package/dist/models/search/grpcAggregation.d.ts +9 -0
  188. package/dist/models/search/grpcAggregation.js +14 -0
  189. package/dist/models/search/grpcAggregation.js.map +1 -0
  190. package/dist/models/search/grpcCmsModel.d.ts +5 -0
  191. package/dist/models/search/grpcCmsModel.js +11 -0
  192. package/dist/models/search/grpcCmsModel.js.map +1 -0
  193. package/dist/models/search/grpcCommonModels.d.ts +109 -0
  194. package/dist/models/search/grpcCommonModels.js +80 -0
  195. package/dist/models/search/grpcCommonModels.js.map +1 -0
  196. package/dist/models/search/grpcCompanyAggregation.d.ts +14 -0
  197. package/dist/models/search/grpcCompanyAggregation.js +16 -0
  198. package/dist/models/search/grpcCompanyAggregation.js.map +1 -0
  199. package/dist/models/search/grpcCompanyConnectModel.d.ts +14 -0
  200. package/dist/models/search/grpcCompanyConnectModel.js +18 -0
  201. package/dist/models/search/grpcCompanyConnectModel.js.map +1 -0
  202. package/dist/models/search/grpcCompanyListReq.d.ts +36 -0
  203. package/dist/models/search/grpcCompanyListReq.js +42 -0
  204. package/dist/models/search/grpcCompanyListReq.js.map +1 -0
  205. package/dist/models/search/grpcCompanyModel.d.ts +43 -0
  206. package/dist/models/search/grpcCompanyModel.js +46 -0
  207. package/dist/models/search/grpcCompanyModel.js.map +1 -0
  208. package/dist/models/search/grpcCompanyNewsCountModel.d.ts +9 -0
  209. package/dist/models/search/grpcCompanyNewsCountModel.js +14 -0
  210. package/dist/models/search/grpcCompanyNewsCountModel.js.map +1 -0
  211. package/dist/models/search/grpcCompanyPeriodMentionModel.d.ts +18 -0
  212. package/dist/models/search/grpcCompanyPeriodMentionModel.js +22 -0
  213. package/dist/models/search/grpcCompanyPeriodMentionModel.js.map +1 -0
  214. package/dist/models/search/grpcCompanyPreviewModel.d.ts +26 -0
  215. package/dist/models/search/grpcCompanyPreviewModel.js +31 -0
  216. package/dist/models/search/grpcCompanyPreviewModel.js.map +1 -0
  217. package/dist/models/search/grpcContentAggregation.d.ts +8 -0
  218. package/dist/models/search/grpcContentAggregation.js +7 -0
  219. package/dist/models/search/grpcContentAggregation.js.map +1 -0
  220. package/dist/models/search/grpcContentListReq.d.ts +16 -0
  221. package/dist/models/search/grpcContentListReq.js +22 -0
  222. package/dist/models/search/grpcContentListReq.js.map +1 -0
  223. package/dist/models/search/grpcContentModel.d.ts +32 -0
  224. package/dist/models/search/grpcContentModel.js +37 -0
  225. package/dist/models/search/grpcContentModel.js.map +1 -0
  226. package/dist/models/search/grpcContentPreviewModel.d.ts +28 -0
  227. package/dist/models/search/grpcContentPreviewModel.js +33 -0
  228. package/dist/models/search/grpcContentPreviewModel.js.map +1 -0
  229. package/dist/models/search/grpcContentTabsModel.d.ts +10 -0
  230. package/dist/models/search/grpcContentTabsModel.js +15 -0
  231. package/dist/models/search/grpcContentTabsModel.js.map +1 -0
  232. package/dist/models/search/grpcCountryModel.d.ts +13 -0
  233. package/dist/models/search/grpcCountryModel.js +19 -0
  234. package/dist/models/search/grpcCountryModel.js.map +1 -0
  235. package/dist/models/search/grpcFinancialModel.d.ts +292 -0
  236. package/dist/models/search/grpcFinancialModel.js +7 -0
  237. package/dist/models/search/grpcFinancialModel.js.map +1 -0
  238. package/dist/models/search/grpcMarketModel.d.ts +16 -0
  239. package/dist/models/search/grpcMarketModel.js +6 -0
  240. package/dist/models/search/grpcMarketModel.js.map +1 -0
  241. package/dist/models/search/grpcMentionContentCountModel.d.ts +5 -0
  242. package/dist/models/search/grpcMentionContentCountModel.js +7 -0
  243. package/dist/models/search/grpcMentionContentCountModel.js.map +1 -0
  244. package/dist/models/search/index.d.ts +16 -0
  245. package/dist/models/search/index.js +44 -0
  246. package/dist/models/search/index.js.map +1 -0
  247. package/dist/models/subscription/applicationFeatureModel.d.ts +7 -0
  248. package/dist/models/subscription/applicationFeatureModel.js +12 -0
  249. package/dist/models/subscription/applicationFeatureModel.js.map +1 -0
  250. package/dist/models/subscription/featureModel.d.ts +7 -0
  251. package/dist/models/subscription/featureModel.js +13 -0
  252. package/dist/models/subscription/featureModel.js.map +1 -0
  253. package/dist/models/subscription/grpcSubscriptionModel.d.ts +6 -0
  254. package/dist/models/subscription/grpcSubscriptionModel.js +12 -0
  255. package/dist/models/subscription/grpcSubscriptionModel.js.map +1 -0
  256. package/dist/models/subscription/index.d.ts +10 -0
  257. package/dist/models/subscription/index.js +22 -0
  258. package/dist/models/subscription/index.js.map +1 -0
  259. package/dist/models/subscription/licenseModel.d.ts +6 -0
  260. package/dist/models/subscription/licenseModel.js +12 -0
  261. package/dist/models/subscription/licenseModel.js.map +1 -0
  262. package/dist/models/subscription/licenseUserModel.d.ts +5 -0
  263. package/dist/models/subscription/licenseUserModel.js +11 -0
  264. package/dist/models/subscription/licenseUserModel.js.map +1 -0
  265. package/dist/models/subscription/subscriptionFeatureModel.d.ts +6 -0
  266. package/dist/models/subscription/subscriptionFeatureModel.js +12 -0
  267. package/dist/models/subscription/subscriptionFeatureModel.js.map +1 -0
  268. package/dist/models/subscription/subscriptionModel.d.ts +14 -0
  269. package/dist/models/subscription/subscriptionModel.js +19 -0
  270. package/dist/models/subscription/subscriptionModel.js.map +1 -0
  271. package/dist/models/subscription/subscriptionPlanFeatureModel.d.ts +5 -0
  272. package/dist/models/subscription/subscriptionPlanFeatureModel.js +11 -0
  273. package/dist/models/subscription/subscriptionPlanFeatureModel.js.map +1 -0
  274. package/dist/models/subscription/subscriptionPlanModel.d.ts +15 -0
  275. package/dist/models/subscription/subscriptionPlanModel.js +20 -0
  276. package/dist/models/subscription/subscriptionPlanModel.js.map +1 -0
  277. package/dist/models/user/grpcAccountInfoModel.d.ts +5 -0
  278. package/dist/models/user/grpcAccountInfoModel.js +7 -0
  279. package/dist/models/user/grpcAccountInfoModel.js.map +1 -0
  280. package/dist/models/user/grpcAppUserModel.d.ts +15 -0
  281. package/dist/models/user/grpcAppUserModel.js +20 -0
  282. package/dist/models/user/grpcAppUserModel.js.map +1 -0
  283. package/dist/models/user/grpcAppUserOrganisationStatistic.d.ts +6 -0
  284. package/dist/models/user/grpcAppUserOrganisationStatistic.js +12 -0
  285. package/dist/models/user/grpcAppUserOrganisationStatistic.js.map +1 -0
  286. package/dist/models/user/grpcAppUserRoleModel.d.ts +5 -0
  287. package/dist/models/user/grpcAppUserRoleModel.js +11 -0
  288. package/dist/models/user/grpcAppUserRoleModel.js.map +1 -0
  289. package/dist/models/user/grpcBrowseHistoryModel.d.ts +8 -0
  290. package/dist/models/user/grpcBrowseHistoryModel.js +14 -0
  291. package/dist/models/user/grpcBrowseHistoryModel.js.map +1 -0
  292. package/dist/models/user/grpcDailyDigestUserModel.d.ts +10 -0
  293. package/dist/models/user/grpcDailyDigestUserModel.js +15 -0
  294. package/dist/models/user/grpcDailyDigestUserModel.js.map +1 -0
  295. package/dist/models/user/grpcNotificationSettingModel.d.ts +11 -0
  296. package/dist/models/user/grpcNotificationSettingModel.js +17 -0
  297. package/dist/models/user/grpcNotificationSettingModel.js.map +1 -0
  298. package/dist/models/user/grpcSavedSearchModel.d.ts +8 -0
  299. package/dist/models/user/grpcSavedSearchModel.js +14 -0
  300. package/dist/models/user/grpcSavedSearchModel.js.map +1 -0
  301. package/dist/models/user/grpcSearchHistoryModel.d.ts +7 -0
  302. package/dist/models/user/grpcSearchHistoryModel.js +13 -0
  303. package/dist/models/user/grpcSearchHistoryModel.js.map +1 -0
  304. package/dist/models/user/grpcTargetListEntityModel.d.ts +5 -0
  305. package/dist/models/user/grpcTargetListEntityModel.js +7 -0
  306. package/dist/models/user/grpcTargetListEntityModel.js.map +1 -0
  307. package/dist/models/user/grpcTargetListExportModel.d.ts +8 -0
  308. package/dist/models/user/grpcTargetListExportModel.js +14 -0
  309. package/dist/models/user/grpcTargetListExportModel.js.map +1 -0
  310. package/dist/models/user/grpcTargetListItemModel.d.ts +7 -0
  311. package/dist/models/user/grpcTargetListItemModel.js +13 -0
  312. package/dist/models/user/grpcTargetListItemModel.js.map +1 -0
  313. package/dist/models/user/grpcTargetListModel.d.ts +9 -0
  314. package/dist/models/user/grpcTargetListModel.js +14 -0
  315. package/dist/models/user/grpcTargetListModel.js.map +1 -0
  316. package/dist/models/user/index.d.ts +14 -0
  317. package/dist/models/user/index.js +30 -0
  318. package/dist/models/user/index.js.map +1 -0
  319. package/dist/utils/appConfig.d.ts +45 -0
  320. package/dist/utils/appConfig.js +57 -0
  321. package/dist/utils/appConfig.js.map +1 -0
  322. package/dist/utils/appConst.d.ts +196 -0
  323. package/dist/utils/appConst.js +214 -0
  324. package/dist/utils/appConst.js.map +1 -0
  325. package/dist/utils/authentication/auth.d.ts +2 -0
  326. package/dist/utils/authentication/auth.js +163 -0
  327. package/dist/utils/authentication/auth.js.map +1 -0
  328. package/dist/utils/authentication/role.d.ts +7 -0
  329. package/dist/utils/authentication/role.js +139 -0
  330. package/dist/utils/authentication/role.js.map +1 -0
  331. package/dist/utils/baseClass/appDataSource.d.ts +7 -0
  332. package/dist/utils/baseClass/appDataSource.js +31 -0
  333. package/dist/utils/baseClass/appDataSource.js.map +1 -0
  334. package/dist/utils/baseClass/baseController.d.ts +12 -0
  335. package/dist/utils/baseClass/baseController.js +176 -0
  336. package/dist/utils/baseClass/baseController.js.map +1 -0
  337. package/dist/utils/baseClass/baseService.d.ts +7 -0
  338. package/dist/utils/baseClass/baseService.js +11 -0
  339. package/dist/utils/baseClass/baseService.js.map +1 -0
  340. package/dist/utils/commonUtils/appConfigKeyRetriever.d.ts +7 -0
  341. package/dist/utils/commonUtils/appConfigKeyRetriever.js +43 -0
  342. package/dist/utils/commonUtils/appConfigKeyRetriever.js.map +1 -0
  343. package/dist/utils/commonUtils/appUtils.d.ts +41 -0
  344. package/dist/utils/commonUtils/appUtils.js +236 -0
  345. package/dist/utils/commonUtils/appUtils.js.map +1 -0
  346. package/dist/utils/commonUtils/cronUtils.d.ts +9 -0
  347. package/dist/utils/commonUtils/cronUtils.js +32 -0
  348. package/dist/utils/commonUtils/cronUtils.js.map +1 -0
  349. package/dist/utils/commonUtils/index.d.ts +6 -0
  350. package/dist/utils/commonUtils/index.js +23 -0
  351. package/dist/utils/commonUtils/index.js.map +1 -0
  352. package/dist/utils/commonUtils/jwtUtils.d.ts +3 -0
  353. package/dist/utils/commonUtils/jwtUtils.js +83 -0
  354. package/dist/utils/commonUtils/jwtUtils.js.map +1 -0
  355. package/dist/utils/commonUtils/responseUtils.d.ts +7 -0
  356. package/dist/utils/commonUtils/responseUtils.js +131 -0
  357. package/dist/utils/commonUtils/responseUtils.js.map +1 -0
  358. package/dist/utils/commonUtils/validation.d.ts +6 -0
  359. package/dist/utils/commonUtils/validation.js +92 -0
  360. package/dist/utils/commonUtils/validation.js.map +1 -0
  361. package/dist/utils/documentation/swagger.d.ts +1 -0
  362. package/dist/utils/documentation/swagger.js +44 -0
  363. package/dist/utils/documentation/swagger.js.map +1 -0
  364. package/dist/utils/index.d.ts +2 -0
  365. package/dist/utils/index.js +19 -0
  366. package/dist/utils/index.js.map +1 -0
  367. package/dist/utils/logger/logger.d.ts +1 -0
  368. package/dist/utils/logger/logger.js +58 -0
  369. package/dist/utils/logger/logger.js.map +1 -0
  370. package/dist/utils/logger/morganLogger.d.ts +2 -0
  371. package/dist/utils/logger/morganLogger.js +41 -0
  372. package/dist/utils/logger/morganLogger.js.map +1 -0
  373. package/dist/utils/middleware/handleError.d.ts +2 -0
  374. package/dist/utils/middleware/handleError.js +12 -0
  375. package/dist/utils/middleware/handleError.js.map +1 -0
  376. package/dist/utils/middleware/isPublicUser.d.ts +2 -0
  377. package/dist/utils/middleware/isPublicUser.js +35 -0
  378. package/dist/utils/middleware/isPublicUser.js.map +1 -0
  379. package/dist/utils/middleware/loadConfig.d.ts +128 -0
  380. package/dist/utils/middleware/loadConfig.js +143 -0
  381. package/dist/utils/middleware/loadConfig.js.map +1 -0
  382. package/dist/utils/middleware/overwriteConst.d.ts +1 -0
  383. package/dist/utils/middleware/overwriteConst.js +84 -0
  384. package/dist/utils/middleware/overwriteConst.js.map +1 -0
  385. package/dist/utils/monitoring/apm.d.ts +6 -0
  386. package/dist/utils/monitoring/apm.js +99 -0
  387. package/dist/utils/monitoring/apm.js.map +1 -0
  388. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azureKeyVault.js","sourceRoot":"","sources":["../../../src/lib/azure/azureKeyVault.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8DAAuD;AACvD,8CAAyD;AACzD,8DAA0D;AAC1D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,IAAI,CAAC;oBACtB,MAAM;gBACV,CAAC;gBACD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;oBACnB,MAAM,IAAI,KAAK,CAAC,8DAA8D,KAAK,GAAG,CAAC,CAAC;gBAC5F,CAAC;YACL,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,CAAC,OAAO,GAAG,GAAa,CAAC;QACjC,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CAAA;AA/BD,kCA+BC"}
@@ -0,0 +1,47 @@
1
+ import { ServiceBusMessage, ServiceBusReceivedMessage } from '@azure/service-bus';
2
+ export declare class ServiceBusClient {
3
+ private connection;
4
+ private queueName;
5
+ private sender;
6
+ private receiver;
7
+ constructor(connectionString: string, queueName: string);
8
+ /**
9
+ * The function closes the sender, receiver, and connection objects if they exist.
10
+ */
11
+ closeConnection(): Promise<void>;
12
+ /**
13
+ * The function "getOrCreateSender" creates a sender if it doesn't exist and returns it.
14
+ * @returns The `getOrCreateSender` function returns a Promise that resolves to the `sender`
15
+ * object.
16
+ */
17
+ private getOrCreateSender;
18
+ /**
19
+ * The function `getOrCreateReceiver` creates a receiver if it doesn't already exist and returns
20
+ * it.
21
+ * @returns The `getOrCreateReceiver` function is returning the `this.receiver` object.
22
+ */
23
+ private getOrCreateReceiver;
24
+ /**
25
+ * The function sends an array of messages using a Service Bus sender, creating a new message batch
26
+ * if the current batch is full.
27
+ * @param {ServiceBusMessage[]} messages - An array of ServiceBusMessage objects.
28
+ * @returns a Promise.
29
+ */
30
+ sendMessage(messages: ServiceBusMessage[]): Promise<void>;
31
+ /**
32
+ * The function `receiveMessage` retrieves messages from a Service Bus queue or topic subscription,
33
+ * either by receiving them or peeking at them, and returns an array of received messages.
34
+ * @param {boolean} [receiveMode=true] - The `receiveMode` parameter is a boolean flag that determines
35
+ * whether the messages should be peeked or received. When `receiveMode` is set to `false`, the method
36
+ * will peek messages from the queue without removing them. When `receiveMode` is set to `true` (or
37
+ * not provided, the method remove messages from the queue after retrieval.
38
+ * @param {number} [numMessageRequired] - The `numMessageRequired` parameter is an optional
39
+ * parameter that specifies the maximum number of messages required. If this parameter is provided,
40
+ * the function will stop receiving messages once the number of received messages reaches or
41
+ * exceeds the specified value. If this parameter is not provided, the function will continue to
42
+ * receive messages until no more message in the queue.
43
+ * @returns The function `receiveMessage` returns a promise that resolves to an array of
44
+ * `ServiceBusReceivedMessage` objects.
45
+ */
46
+ receiveMessage(receiveMode?: boolean, numMessageRequired?: number): Promise<ServiceBusReceivedMessage[]>;
47
+ }
@@ -0,0 +1,139 @@
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.ServiceBusClient = void 0;
13
+ const service_bus_1 = require("@azure/service-bus");
14
+ const appConst_1 = require("../../utils/appConst");
15
+ /* The `ServiceBusClient` class is a TypeScript class that provides methods for sending and receiving
16
+ messages using Azure Service Bus. */
17
+ class ServiceBusClient {
18
+ constructor(connectionString, queueName) {
19
+ this.connection = new service_bus_1.ServiceBusClient(connectionString);
20
+ this.queueName = queueName;
21
+ }
22
+ /**
23
+ * The function closes the sender, receiver, and connection objects if they exist.
24
+ */
25
+ closeConnection() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ if (this.sender) {
28
+ yield this.sender.close();
29
+ }
30
+ if (this.receiver) {
31
+ yield this.receiver.close();
32
+ }
33
+ if (this.connection) {
34
+ yield this.connection.close();
35
+ }
36
+ });
37
+ }
38
+ /**
39
+ * The function "getOrCreateSender" creates a sender if it doesn't exist and returns it.
40
+ * @returns The `getOrCreateSender` function returns a Promise that resolves to the `sender`
41
+ * object.
42
+ */
43
+ getOrCreateSender() {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ if (!this.sender) {
46
+ this.sender = this.connection.createSender(this.queueName);
47
+ }
48
+ return this.sender;
49
+ });
50
+ }
51
+ /**
52
+ * The function `getOrCreateReceiver` creates a receiver if it doesn't already exist and returns
53
+ * it.
54
+ * @returns The `getOrCreateReceiver` function is returning the `this.receiver` object.
55
+ */
56
+ getOrCreateReceiver() {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ if (!this.receiver) {
59
+ this.receiver = this.connection.createReceiver(this.queueName, {
60
+ receiveMode: 'receiveAndDelete'
61
+ });
62
+ }
63
+ return this.receiver;
64
+ });
65
+ }
66
+ /**
67
+ * The function sends an array of messages using a Service Bus sender, creating a new message batch
68
+ * if the current batch is full.
69
+ * @param {ServiceBusMessage[]} messages - An array of ServiceBusMessage objects.
70
+ * @returns a Promise.
71
+ */
72
+ sendMessage(messages) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ if (messages.length === 0)
75
+ return;
76
+ const sender = yield this.getOrCreateSender();
77
+ try {
78
+ let batch = yield sender.createMessageBatch();
79
+ for (const message of messages) {
80
+ if (!batch.tryAddMessage(message)) {
81
+ yield sender.sendMessages(batch);
82
+ batch = yield sender.createMessageBatch();
83
+ if (!batch.tryAddMessage(message)) {
84
+ throw new Error('Message is too large.');
85
+ }
86
+ }
87
+ }
88
+ yield sender.sendMessages(batch);
89
+ }
90
+ catch (err) {
91
+ throw new Error(`serviceBusClient/sendMessage: ${err}`);
92
+ }
93
+ });
94
+ }
95
+ /**
96
+ * The function `receiveMessage` retrieves messages from a Service Bus queue or topic subscription,
97
+ * either by receiving them or peeking at them, and returns an array of received messages.
98
+ * @param {boolean} [receiveMode=true] - The `receiveMode` parameter is a boolean flag that determines
99
+ * whether the messages should be peeked or received. When `receiveMode` is set to `false`, the method
100
+ * will peek messages from the queue without removing them. When `receiveMode` is set to `true` (or
101
+ * not provided, the method remove messages from the queue after retrieval.
102
+ * @param {number} [numMessageRequired] - The `numMessageRequired` parameter is an optional
103
+ * parameter that specifies the maximum number of messages required. If this parameter is provided,
104
+ * the function will stop receiving messages once the number of received messages reaches or
105
+ * exceeds the specified value. If this parameter is not provided, the function will continue to
106
+ * receive messages until no more message in the queue.
107
+ * @returns The function `receiveMessage` returns a promise that resolves to an array of
108
+ * `ServiceBusReceivedMessage` objects.
109
+ */
110
+ receiveMessage(receiveMode = true, numMessageRequired) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ const receiver = yield this.getOrCreateReceiver();
113
+ try {
114
+ const result = [];
115
+ let messages;
116
+ while (true) {
117
+ messages = receiveMode ?
118
+ yield receiver.receiveMessages(appConst_1.commonAppConst.serviceBus.receiverOptions.maxMessageCount, {
119
+ maxWaitTimeInMs: appConst_1.commonAppConst.serviceBus.receiverOptions.maxWaitTimeInMs,
120
+ }) :
121
+ yield receiver.peekMessages(appConst_1.commonAppConst.serviceBus.receiverOptions.maxWaitTimeInMs);
122
+ if (messages.length === 0) {
123
+ break; // No more messages in the queue
124
+ }
125
+ result.push(...messages);
126
+ if (numMessageRequired !== undefined && result.length >= numMessageRequired) {
127
+ break;
128
+ }
129
+ }
130
+ return result.slice(0, numMessageRequired);
131
+ }
132
+ catch (err) {
133
+ throw new Error(`serviceBusClient/peekMessage: ${err}`);
134
+ }
135
+ });
136
+ }
137
+ }
138
+ exports.ServiceBusClient = ServiceBusClient;
139
+ //# sourceMappingURL=azureServiceBusClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azureServiceBusClient.js","sourceRoot":"","sources":["../../../src/lib/azure/azureServiceBusClient.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAI4B;AAC5B,mDAAsD;AAEtD;oCACoC;AACpC,MAAa,gBAAgB;IAMzB,YAAY,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K,CAAC,EAAE,CAAC;wBACxB,MAAM,CAAC,gCAAgC;oBAC3C,CAAC;oBACD,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC;oBACzB,IAAI,kBAAkB,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,IAAI,kBAAkB,EAAE,CAAC;wBAC1E,MAAM;oBACV,CAAC;gBACL,CAAC;gBACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;YAC/C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;YAC5D,CAAC;QACL,CAAC;KAAA;CACJ;AAxHD,4CAwHC"}
@@ -0,0 +1 @@
1
+ export declare function sendServiceBusMessage(queueName: string, message: string, connectionKey?: string, isConvertMsgToJson?: boolean): Promise<void>;
@@ -0,0 +1,42 @@
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 (0, 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
@@ -0,0 +1 @@
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,IAAA,sBAAM,EAAC,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,CAAC;YACD,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;QACzB,CAAC;QAAC,OAAM,GAAG,EAAE,CAAC;YACV,eAAM,CAAC,KAAK,CAAC,mCAAmC,GAAG,EAAE,CAAC,CAAC;YACvD,MAAM,GAAG,CAAC;QACd,CAAC;gBAAS,CAAC;YACP,MAAM,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC3B,CAAC;QACD,eAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC7C,CAAC;CAAA;AAnBD,sDAmBC"}
@@ -0,0 +1 @@
1
+ export declare function sendMessage(queueName: string, message: string, connectionKey?: string): Promise<string>;
@@ -0,0 +1,26 @@
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 (0, 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
@@ -0,0 +1 @@
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,IAAA,sBAAM,EAAC,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"}
@@ -0,0 +1,4 @@
1
+ import { ListTableEntitiesOptions } from '@azure/data-tables';
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?: ListTableEntitiesOptions, top?: number, storageConnectionKey?: string): Promise<T>;
4
+ export declare function deleteEntity(tableName: string, partitionKey: string, rowKey: string, storageConnectionKey?: string): Promise<void>;
@@ -0,0 +1,67 @@
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.deleteEntity = exports.queryEntities = exports.retrieveEntity = void 0;
20
+ const data_tables_1 = require("@azure/data-tables");
21
+ const azureKeyVault_1 = require("./azureKeyVault");
22
+ const appConfig_1 = require("../../utils/appConfig");
23
+ function retrieveEntity(tableName, partitionKey, rowKey, storageConnectionKey = appConfig_1.commonAppConfig.StorageAccountConnectionKey) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const STORAGE_CONNECTION_STRING = yield (0, azureKeyVault_1.getKey)(storageConnectionKey);
26
+ const tableServiceClient = data_tables_1.TableClient.fromConnectionString(STORAGE_CONNECTION_STRING, tableName);
27
+ return JSON.parse(JSON.stringify(yield tableServiceClient.getEntity(partitionKey, rowKey)));
28
+ });
29
+ }
30
+ exports.retrieveEntity = retrieveEntity;
31
+ function queryEntities(tableName, tableQuery = {}, top = 20, storageConnectionKey = appConfig_1.commonAppConfig.StorageAccountConnectionKey) {
32
+ var _a, e_1, _b, _c;
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const STORAGE_CONNECTION_STRING = yield (0, azureKeyVault_1.getKey)(storageConnectionKey);
35
+ const tableServiceClient = data_tables_1.TableClient.fromConnectionString(STORAGE_CONNECTION_STRING, tableName);
36
+ const entities = yield tableServiceClient.listEntities(tableQuery);
37
+ const iterator = entities.byPage({ maxPageSize: top });
38
+ let topEntities = [];
39
+ try {
40
+ for (var _d = true, iterator_1 = __asyncValues(iterator), iterator_1_1; iterator_1_1 = yield iterator_1.next(), _a = iterator_1_1.done, !_a; _d = true) {
41
+ _c = iterator_1_1.value;
42
+ _d = false;
43
+ const page = _c;
44
+ topEntities = page;
45
+ break;
46
+ }
47
+ }
48
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
49
+ finally {
50
+ try {
51
+ if (!_d && !_a && (_b = iterator_1.return)) yield _b.call(iterator_1);
52
+ }
53
+ finally { if (e_1) throw e_1.error; }
54
+ }
55
+ return JSON.parse(JSON.stringify(topEntities));
56
+ });
57
+ }
58
+ exports.queryEntities = queryEntities;
59
+ function deleteEntity(tableName, partitionKey, rowKey, storageConnectionKey = appConfig_1.commonAppConfig.StorageAccountConnectionKey) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const STORAGE_CONNECTION_STRING = yield (0, azureKeyVault_1.getKey)(storageConnectionKey);
62
+ const tableServiceClient = data_tables_1.TableClient.fromConnectionString(STORAGE_CONNECTION_STRING, tableName);
63
+ yield tableServiceClient.deleteEntity(partitionKey, rowKey);
64
+ });
65
+ }
66
+ exports.deleteEntity = deleteEntity;
67
+ //# sourceMappingURL=azureTableStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azureTableStorage.js","sourceRoot":"","sources":["../../../src/lib/azure/azureTableStorage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,oDAAiG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AAY,CAAC,SAAiB,EAAE,YAAoB,EAAE,MAAc,EAAE,uBAA6B,2BAAe,CAAC,2BAA2B;;QAChK,MAAM,yBAAyB,GAAG,MAAM,IAAA,sBAAM,EAAC,oBAAoB,CAAC,CAAC;QACrE,MAAM,kBAAkB,GAAG,yBAAW,CAAC,oBAAoB,CAAC,yBAAyB,EAAE,SAAS,CAAC,CAAA;QACjG,MAAM,kBAAkB,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;IAC/D,CAAC;CAAA;AAJD,oCAIC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @description Specifies whether simple or full of query type must be matched
3
+ * @see https://docs.microsoft.com/en-us/rest/api/searchservice/search-documents
4
+ */
5
+ export declare enum QueryType {
6
+ simple = "simple",
7
+ full = "full"
8
+ }
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueryType = void 0;
4
+ /**
5
+ * @description Specifies whether simple or full of query type must be matched
6
+ * @see https://docs.microsoft.com/en-us/rest/api/searchservice/search-documents
7
+ */
8
+ var QueryType;
9
+ (function (QueryType) {
10
+ QueryType["simple"] = "simple";
11
+ QueryType["full"] = "full";
12
+ })(QueryType || (exports.QueryType = QueryType = {}));
13
+ //# sourceMappingURL=QueryType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueryType.js","sourceRoot":"","sources":["../../../../src/lib/azure/cognitiveSearch/QueryType.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,8BAAiB,CAAA;IACjB,0BAAa,CAAA;AACjB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB"}
@@ -0,0 +1,42 @@
1
+ import { ServiceResponse } from '../../../interfaces';
2
+ import { AzureSearchIndex } from '../../../utils';
3
+ /**
4
+ * @classdesc SearchClient as an adaptor to bind the third-party library
5
+ * (@azure/search-documents) with the internal application. That is to say, the
6
+ * class is aim to enhance dev's maintenance between lib and the exact usage.
7
+ * @property {SearchClient} instance - Singleton instance
8
+ * @property {string} endpoint - Azure cognitive search's request endpoint
9
+ * @property {string} credential - Azure cognitive search's API key
10
+ * @property {Semaphore} semaphore - to ensure not too many requests are sent to Azure cognitive search
11
+ * @property {Record<AzureSearchIndex, string>} indexMap - to store the index's alias
12
+ *
13
+ * @example
14
+ * const client = await SearchClient.getInstance();
15
+ * const searchOption = new SearchOption( { top: 1 });
16
+ * console.log(JSON.stringify(await client.query(AzureSearchIndex.company, '*', searchOption.value())));
17
+ */
18
+ export declare class SearchClient {
19
+ private static instance;
20
+ private static endpoint;
21
+ private static credential;
22
+ private static indexMap;
23
+ /**
24
+ * @description To retrieve the instance in the Singleton pattern
25
+ * @returns {SearchClient} the singleton instance of SearchClient
26
+ */
27
+ static getInstance(): Promise<SearchClient>;
28
+ /**
29
+ * @description To query the Azure cognitive search
30
+ * @param {AzureSearchIndex} index - to retrieve the document
31
+ * @param {string} keyword - as the prop 'search'
32
+ * @param {any} options - additional option for the search
33
+ * @param {number} retryTimes - specify how many times if Azure cognitive search returns a bad request
34
+ * @returns {ServiceResponse} a serviceResponse, noted that data is stated in `data.document`
35
+ */
36
+ query(index: AzureSearchIndex, keyword?: string, options?: any, retryTimes?: number, tracking?: number): Promise<ServiceResponse>;
37
+ /**
38
+ * @description To postpone for specific millisecond
39
+ * @param {number} ms - millisecond to wait for
40
+ */
41
+ private sleep;
42
+ }
@@ -0,0 +1,161 @@
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.SearchClient = void 0;
20
+ const search_documents_1 = require("@azure/search-documents");
21
+ const logger_1 = require("../../../utils/logger/logger");
22
+ const azureKeyVault_1 = require("../../azure/azureKeyVault");
23
+ const utils_1 = require("../../../utils");
24
+ const loadConfig_1 = require("../../../utils/middleware/loadConfig");
25
+ /**
26
+ * @classdesc SearchClient as an adaptor to bind the third-party library
27
+ * (@azure/search-documents) with the internal application. That is to say, the
28
+ * class is aim to enhance dev's maintenance between lib and the exact usage.
29
+ * @property {SearchClient} instance - Singleton instance
30
+ * @property {string} endpoint - Azure cognitive search's request endpoint
31
+ * @property {string} credential - Azure cognitive search's API key
32
+ * @property {Semaphore} semaphore - to ensure not too many requests are sent to Azure cognitive search
33
+ * @property {Record<AzureSearchIndex, string>} indexMap - to store the index's alias
34
+ *
35
+ * @example
36
+ * const client = await SearchClient.getInstance();
37
+ * const searchOption = new SearchOption( { top: 1 });
38
+ * console.log(JSON.stringify(await client.query(AzureSearchIndex.company, '*', searchOption.value())));
39
+ */
40
+ class SearchClient {
41
+ /**
42
+ * @description To retrieve the instance in the Singleton pattern
43
+ * @returns {SearchClient} the singleton instance of SearchClient
44
+ */
45
+ static getInstance() {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ if (!!SearchClient.instance) {
48
+ return SearchClient.instance;
49
+ }
50
+ SearchClient.instance = new SearchClient();
51
+ /**
52
+ * When the keyVaultName is empty, loadConfig() should be called in order to fetch the value as possible
53
+ * since we are not using lazy-loading here. It would be better to transform into a lazy-loading mechanism.
54
+ */
55
+ if (loadConfig_1.appConfig === undefined) {
56
+ try {
57
+ yield (0, loadConfig_1.loadConfig)();
58
+ if (loadConfig_1.appConfig.keyVaultName === undefined) {
59
+ throw new Error('SearchClient/getInstance: empty keyVaultName');
60
+ }
61
+ }
62
+ catch (err) {
63
+ throw err;
64
+ }
65
+ }
66
+ const credentialResp = yield (0, azureKeyVault_1.getKeyVault)(loadConfig_1.appConfig.keyVaultName, utils_1.AzureSearchConfig.credentialSecretName);
67
+ if (credentialResp.isSuccess === false) {
68
+ throw new Error('/SearchClient/getInstance(): retrieve search credential failed');
69
+ }
70
+ const secret = credentialResp.data;
71
+ const indexMapResp = yield (0, azureKeyVault_1.getKeyVault)(loadConfig_1.appConfig.keyVaultName, utils_1.AzureSearchConfig.indexSecretName);
72
+ if (indexMapResp.isSuccess === false) {
73
+ throw new Error('/SearchClient/getInstance(): retrieve search indexMap failed');
74
+ }
75
+ SearchClient.indexMap = indexMapResp.data;
76
+ SearchClient.endpoint = secret.endpoint;
77
+ SearchClient.credential = secret.credential;
78
+ return SearchClient.instance;
79
+ });
80
+ }
81
+ /**
82
+ * @description To query the Azure cognitive search
83
+ * @param {AzureSearchIndex} index - to retrieve the document
84
+ * @param {string} keyword - as the prop 'search'
85
+ * @param {any} options - additional option for the search
86
+ * @param {number} retryTimes - specify how many times if Azure cognitive search returns a bad request
87
+ * @returns {ServiceResponse} a serviceResponse, noted that data is stated in `data.document`
88
+ */
89
+ query(index, keyword = '*', options, retryTimes = utils_1.AzureSearchConfig.queryRetryDefault, tracking = Math.floor(Math.random() * 100000000000)) {
90
+ var _a, e_1, _b, _c;
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ logger_1.logger.verbose(`start SearchClient/query: ${tracking}`);
93
+ let serviceResponse = { isSuccess: false };
94
+ let searchResults;
95
+ let curRetry = 0;
96
+ try {
97
+ const client = new search_documents_1.SearchClient(SearchClient.endpoint, SearchClient.indexMap[index], new search_documents_1.AzureKeyCredential(SearchClient.credential));
98
+ while (curRetry < retryTimes) {
99
+ try {
100
+ logger_1.logger.verbose(`SearchClient/query before sending : ${curRetry}|${tracking}`);
101
+ searchResults = yield client.search(keyword, options);
102
+ logger_1.logger.verbose(`SearchClient/query after sending : ${curRetry}|${tracking}`);
103
+ serviceResponse.data = { document: [] };
104
+ try {
105
+ for (var _d = true, _e = (e_1 = void 0, __asyncValues(searchResults.results)), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
106
+ _c = _f.value;
107
+ _d = false;
108
+ const result = _c;
109
+ result.document.score = result.score;
110
+ result.document.highlights = result.highlights;
111
+ serviceResponse.data.document.push(result.document);
112
+ }
113
+ }
114
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
115
+ finally {
116
+ try {
117
+ if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
118
+ }
119
+ finally { if (e_1) throw e_1.error; }
120
+ }
121
+ logger_1.logger.verbose(`SearchClient/query after processing : ${curRetry}|${tracking}`);
122
+ if (!!searchResults.facets) {
123
+ serviceResponse.data.facets = searchResults.facets;
124
+ }
125
+ if (!!searchResults.count) {
126
+ serviceResponse.data.count = searchResults.count;
127
+ }
128
+ serviceResponse.isSuccess = true;
129
+ }
130
+ catch (err) {
131
+ logger_1.logger.error(`SearchClient/query: fail - ${err}`);
132
+ }
133
+ if (!serviceResponse.isSuccess) {
134
+ logger_1.logger.info(`SearchClient/query: retry - ${curRetry}`);
135
+ ++curRetry;
136
+ yield this.sleep(utils_1.AzureSearchConfig.retryIntervalSecond * 1000);
137
+ }
138
+ else {
139
+ break;
140
+ }
141
+ }
142
+ }
143
+ catch (err) {
144
+ logger_1.logger.error(`SearchClient/query: ${err}`);
145
+ }
146
+ logger_1.logger.verbose(`end SearchClient/query : ${curRetry}|${serviceResponse.data.document.length}|${tracking}`);
147
+ return serviceResponse;
148
+ });
149
+ }
150
+ /**
151
+ * @description To postpone for specific millisecond
152
+ * @param {number} ms - millisecond to wait for
153
+ */
154
+ sleep(ms) {
155
+ return __awaiter(this, void 0, void 0, function* () {
156
+ yield new Promise(_ => setTimeout(_, ms));
157
+ });
158
+ }
159
+ }
160
+ exports.SearchClient = SearchClient;
161
+ //# sourceMappingURL=SearchClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchClient.js","sourceRoot":"","sources":["../../../../src/lib/azure/cognitiveSearch/SearchClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,8DAAmG;AACnG,yDAAsD;AACtD,6DAAwD;AAExD,0CAAqE;AACrE,qEAA6E;AAG7E;;;;;;;;;;;;;;GAcG;AACH,MAAa,YAAY;IAMrB;;;OAGG;IACH,MAAM,CAAO,WAAW;;YACpB,IAAI,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;gBAAC,OAAO,YAAY,CAAC,QAAQ,CAAC;YAAC,CAAC;YAE9D,YAAY,CAAC,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;YAE3C;;;eAGG;YACH,IAAI,sBAAS,KAAK,SAAS,EAAE,CAAC;gBAC1B,IAAI,CAAC;oBACD,MAAM,IAAA,uBAAU,GAAE,CAAC;oBACnB,IAAI,sBAAS,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;wBACvC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;oBACpE,CAAC;gBACL,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACX,MAAM,GAAG,CAAC;gBACd,CAAC;YACL,CAAC;YAED,MAAM,cAAc,GAAG,MAAM,IAAA,2BAAW,EAAC,sBAAS,CAAC,YAAY,EAAE,yBAAiB,CAAC,oBAAoB,CAAC,CAAC;YAEzG,IAAI,cAAc,CAAC,SAAS,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EAAE,CAAC;wBAC7B,eAAM,CAAC,IAAI,CAAC,+BAA+B,QAAQ,EAAE,CAAC,CAAC;wBACvD,EAAE,QAAQ,CAAC;wBACX,MAAM,IAAI,CAAC,KAAK,CAAC,yBAAiB,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;oBACnE,CAAC;yBAAM,CAAC;wBACJ,MAAM;oBACV,CAAC;gBACL,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,eAAM,CAAC,KAAK,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;YAC/C,CAAC;YACD,eAAM,CAAC,OAAO,CAAC,4BAA4B,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC,CAAC;YAC3G,OAAO,eAAe,CAAC;;KAC1B;IAED;;;OAGG;IACW,KAAK,CAAC,EAAU;;YAC1B,MAAM,IAAI,OAAO,CAAE,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QAC/C,CAAC;KAAA;CACJ;AA7HD,oCA6HC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @description SearchFacets as a type is to wrap facets for @azure/search-documents
3
+ * @see https://docs.microsoft.com/en-us/rest/api/searchservice/search-documents
4
+ * @property {string} attr - attribute/prop to reach
5
+ * @property {number} count - volume of the search
6
+ * @property {enum} sort - order
7
+ * @property {enum | number} interval - interval greater than 0 for numbers for date time values
8
+ * @property {string} timeoffset - specifying a dynamic set of facet entry values
9
+ */
10
+ export type SearchFacets = {
11
+ attr: string;
12
+ count?: number;
13
+ sort?: 'count' | '-count' | 'value' | '-value';
14
+ interval?: number | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
15
+ timeoffset?: string;
16
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=SearchFacets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchFacets.js","sourceRoot":"","sources":["../../../../src/lib/azure/cognitiveSearch/SearchFacets.ts"],"names":[],"mappings":""}