@getjones/test-infra 4.5.15 → 4.5.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 (246) hide show
  1. package/package.json +30 -30
  2. package/src/common/commonFlows/auth/auth.js +40 -40
  3. package/src/common/commonFlows/index.js +4 -4
  4. package/src/common/commonFlows/records/records.js +269 -269
  5. package/src/common/consts/accountSettings.js +44 -44
  6. package/src/common/consts/activationStatuses.js +6 -6
  7. package/src/common/consts/autocomplete.js +10 -10
  8. package/src/common/consts/constantsForRecordsSortingAndFilters.js +49 -49
  9. package/src/common/consts/dashboardCharts.js +18 -18
  10. package/src/common/consts/homepage/AttentionTab.js +6 -6
  11. package/src/common/consts/homepage/sortOptions.js +19 -19
  12. package/src/common/consts/ocrStatuses.js +6 -6
  13. package/src/common/consts/projectSettings.js +21 -21
  14. package/src/common/consts/recordTypes.js +5 -5
  15. package/src/common/consts/requirementActions.js +10 -10
  16. package/src/common/consts/s3FileTypes.js +13 -13
  17. package/src/common/consts/userRoles.js +18 -18
  18. package/src/common/consts/userTypes.js +8 -8
  19. package/src/common/errorCodes.js +3 -3
  20. package/src/common/httpResponseStatusCodes.json +11 -11
  21. package/src/common/httpResponseTypes.json +2 -2
  22. package/src/common/requests/apiKeyAuth/requests.js +44 -44
  23. package/src/common/requests/cookieAuth/requests.js +40 -40
  24. package/src/common/requests/internalAuth/requests.js +48 -48
  25. package/src/common/requests/requestHandlers.js +80 -80
  26. package/src/common/utils/complianceUtil.js +113 -113
  27. package/src/common/utils/configsUtil.js +22 -22
  28. package/src/common/utils/dataTypeUtils.js +41 -41
  29. package/src/common/utils/numberUtils.js +22 -22
  30. package/src/common/utils/objectUtils.js +7 -7
  31. package/src/common/utils/timeUtils.js +177 -177
  32. package/src/common/validations/errorValidation.js +16 -16
  33. package/src/common/validations/typeValidations.js +36 -36
  34. package/src/defaults/configs/auditConfigs.js +125 -125
  35. package/src/defaults/configs/coverage.js +144 -144
  36. package/src/defaults/configs/polices.js +76 -76
  37. package/src/defaults/configs/requirement.js +32 -32
  38. package/src/defaults/index.js +6 -6
  39. package/src/env.js +57 -57
  40. package/src/factory/globalRecord/globalRecord.js +43 -43
  41. package/src/factory/index.js +8 -8
  42. package/src/factory/records/records.js +281 -281
  43. package/src/factory/users/users.js +69 -69
  44. package/src/index.js +103 -103
  45. package/src/saas/internal-api/accountDirectory/api/accountDirectory.api.js +50 -50
  46. package/src/saas/internal-api/accountDirectory/api/accountDirectory.service.js +182 -182
  47. package/src/saas/internal-api/accountDirectory/index.js +4 -4
  48. package/src/saas/internal-api/accountDirectory/models/accountDirectory.model.js +40 -40
  49. package/src/saas/internal-api/accounts/api/core/accounts.core.api.js +35 -35
  50. package/src/saas/internal-api/accounts/api/core/accounts.core.service.js +93 -93
  51. package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.api.js +29 -29
  52. package/src/saas/internal-api/accounts/api/emailCustomization/accounts.email.customizations.service.js +61 -61
  53. package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.api.js +48 -48
  54. package/src/saas/internal-api/accounts/api/openapi/accounts.openapi.service.js +74 -74
  55. package/src/saas/internal-api/accounts/api/settings/settings.api.js +21 -21
  56. package/src/saas/internal-api/accounts/api/settings/settings.service.js +41 -41
  57. package/src/saas/internal-api/accounts/consts/consts.js +8 -8
  58. package/src/saas/internal-api/accounts/index.js +22 -22
  59. package/src/saas/internal-api/accounts/models/core/create.account.model.js +16 -16
  60. package/src/saas/internal-api/accounts/models/settings/update.settings.model.js +53 -53
  61. package/src/saas/internal-api/accounts/utils/utils.js +61 -61
  62. package/src/saas/internal-api/agreement/api/agreement.api.js +39 -39
  63. package/src/saas/internal-api/agreement/api/agreement.service.js +121 -121
  64. package/src/saas/internal-api/agreement/consts/consts.js +11 -11
  65. package/src/saas/internal-api/agreement/index.js +12 -12
  66. package/src/saas/internal-api/agreement/models/create.agreement.model.js +12 -12
  67. package/src/saas/internal-api/agreement/models/createAgreementByAuditorModel.js +11 -11
  68. package/src/saas/internal-api/agreement/models/createAgreementByPMModel.js +13 -13
  69. package/src/saas/internal-api/auditCustomerRules/api/customer.rules.api.js +43 -43
  70. package/src/saas/internal-api/auditCustomerRules/api/customer.rules.service.js +105 -105
  71. package/src/saas/internal-api/auditCustomerRules/consts/customer.rule.js +11 -11
  72. package/src/saas/internal-api/auditCustomerRules/index.js +6 -6
  73. package/src/saas/internal-api/auditCustomerRules/models/customer.rule.model.js +46 -46
  74. package/src/saas/internal-api/auditCustomerRules/utils/customer.rule.util.js +19 -19
  75. package/src/saas/internal-api/auditNotes/api/audit.notes.api.js +40 -40
  76. package/src/saas/internal-api/auditNotes/api/audit.notes.service.js +115 -115
  77. package/src/saas/internal-api/auditNotes/index.js +4 -4
  78. package/src/saas/internal-api/auditNotes/models/audit.note.model.js +30 -30
  79. package/src/saas/internal-api/auth/api/auth.api.js +27 -27
  80. package/src/saas/internal-api/auth/api/auth.service.js +90 -90
  81. package/src/saas/internal-api/auth/index.js +3 -3
  82. package/src/saas/internal-api/coi/api/coi.api.js +58 -58
  83. package/src/saas/internal-api/coi/api/coi.service.js +61 -61
  84. package/src/saas/internal-api/coi/consts/hashes.js +5 -5
  85. package/src/saas/internal-api/coi/consts/uploaderTypes.js +5 -5
  86. package/src/saas/internal-api/coi/index.js +14 -14
  87. package/src/saas/internal-api/coi/models/Combine.last.two.cois.model.js +25 -25
  88. package/src/saas/internal-api/coi/models/submit.coi.model.js +19 -19
  89. package/src/saas/internal-api/coi/utils/utils.js +117 -117
  90. package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.api.js +12 -12
  91. package/src/saas/internal-api/compliance/api/amBestRating/am.best.rating.service.js +14 -14
  92. package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.api.js +27 -0
  93. package/src/saas/internal-api/compliance/api/audit/aiAudit/aiAudit.service.js +38 -0
  94. package/src/saas/internal-api/compliance/api/audit/audit.api.js +112 -112
  95. package/src/saas/internal-api/compliance/api/audit/audit.service.js +319 -319
  96. package/src/saas/internal-api/compliance/api/convert/convert.api.js +17 -17
  97. package/src/saas/internal-api/compliance/api/convert/convert.service.js +11 -11
  98. package/src/saas/internal-api/compliance/api/coverage/coverage.api.js +33 -33
  99. package/src/saas/internal-api/compliance/api/coverage/coverage.service.js +46 -46
  100. package/src/saas/internal-api/compliance/api/overrideGap/override.gap.api.js +38 -38
  101. package/src/saas/internal-api/compliance/api/overrideGap/override.gap.service.js +189 -189
  102. package/src/saas/internal-api/compliance/consts/audit.js +113 -113
  103. package/src/saas/internal-api/compliance/index.js +38 -36
  104. package/src/saas/internal-api/compliance/models/audit/audit.model.js +96 -96
  105. package/src/saas/internal-api/compliance/models/waive/waive.model.js +49 -49
  106. package/src/saas/internal-api/compliance/utils/auditUtil.js +269 -269
  107. package/src/saas/internal-api/compliance/utils/coverageUtil.js +45 -45
  108. package/src/saas/internal-api/contractors/api/contractors.api.js +209 -209
  109. package/src/saas/internal-api/contractors/api/contractors.service.js +361 -361
  110. package/src/saas/internal-api/contractors/consts/consts.js +6 -6
  111. package/src/saas/internal-api/contractors/index.js +8 -8
  112. package/src/saas/internal-api/contractors/models/assign.requirement.model.js +10 -10
  113. package/src/saas/internal-api/contractors/models/edit.contractor.model.js +73 -73
  114. package/src/saas/internal-api/contractors/models/link.request.model.js +10 -10
  115. package/src/saas/internal-api/contractors/models/subscription.contractor.model.js +13 -13
  116. package/src/saas/internal-api/contractors/models/verification.contractor.model.js +27 -27
  117. package/src/saas/internal-api/contractors/utils.js +25 -25
  118. package/src/saas/internal-api/dashboard/api/recordList.api.js +38 -38
  119. package/src/saas/internal-api/dashboard/api/recordList.service.js +60 -60
  120. package/src/saas/internal-api/dashboard/index.js +5 -5
  121. package/src/saas/internal-api/dashboard/models/dashboard.filter.criteria.model.js +38 -38
  122. package/src/saas/internal-api/dbEmails/api/db.emails.api.js +25 -25
  123. package/src/saas/internal-api/dbEmails/api/db.emails.service.js +156 -156
  124. package/src/saas/internal-api/dbEmails/consts/consts.js +56 -56
  125. package/src/saas/internal-api/dbEmails/index.js +6 -6
  126. package/src/saas/internal-api/dbEmails/models/db.emails.model.js +22 -22
  127. package/src/saas/internal-api/dbEmails/utils/util.js +87 -87
  128. package/src/saas/internal-api/emailCustomization/api/email.customization.api.js +26 -26
  129. package/src/saas/internal-api/emailCustomization/api/email.customization.service.js +50 -50
  130. package/src/saas/internal-api/emailCustomization/index.js +3 -3
  131. package/src/saas/internal-api/globalRecord/api/global.record.api.js +95 -95
  132. package/src/saas/internal-api/globalRecord/api/global.record.service.js +112 -112
  133. package/src/saas/internal-api/globalRecord/consts.js +20 -20
  134. package/src/saas/internal-api/globalRecord/index.js +6 -6
  135. package/src/saas/internal-api/globalRecord/models/global.record.model.js +60 -60
  136. package/src/saas/internal-api/globalRecord/utils/util.js +161 -161
  137. package/src/saas/internal-api/homepageCharts/api/charts.api.js +12 -12
  138. package/src/saas/internal-api/homepageCharts/api/charts.service.js +7 -7
  139. package/src/saas/internal-api/homepageCharts/index.js +3 -3
  140. package/src/saas/internal-api/jonesNetworkTab/api/jones.network.tab.api.js +14 -14
  141. package/src/saas/internal-api/jonesNetworkTab/api/jones.network.tab.service.js +16 -16
  142. package/src/saas/internal-api/jonesNetworkTab/index.js +3 -3
  143. package/src/saas/internal-api/notificationCenter/api/notification.center.api.js +32 -32
  144. package/src/saas/internal-api/notificationCenter/api/notification.center.service.js +49 -49
  145. package/src/saas/internal-api/notificationCenter/index.js +3 -3
  146. package/src/saas/internal-api/policyFile/api/policy.file.api.js +43 -43
  147. package/src/saas/internal-api/policyFile/api/policy.file.service.js +117 -117
  148. package/src/saas/internal-api/policyFile/consts.js +21 -21
  149. package/src/saas/internal-api/policyFile/index.js +11 -11
  150. package/src/saas/internal-api/policyFile/models/create.policy.file.model.js +11 -11
  151. package/src/saas/internal-api/policyFile/models/set.publish.flag.to.policy.model.js +13 -13
  152. package/src/saas/internal-api/projects/api/core/projects.api.js +39 -39
  153. package/src/saas/internal-api/projects/api/core/projects.service.js +77 -77
  154. package/src/saas/internal-api/projects/api/settings/project.settings.api.js +18 -18
  155. package/src/saas/internal-api/projects/api/settings/project.settings.service.js +35 -35
  156. package/src/saas/internal-api/projects/consts/defaultProject.js +3 -3
  157. package/src/saas/internal-api/projects/index.js +24 -24
  158. package/src/saas/internal-api/projects/models/core/create.project.model.js +41 -41
  159. package/src/saas/internal-api/projects/models/core/update.project.model.js +47 -47
  160. package/src/saas/internal-api/projects/models/settings/update.project.settings.model.js +40 -40
  161. package/src/saas/internal-api/projects/utils/utils.js +155 -155
  162. package/src/saas/internal-api/recordHub/api/record.hub.api.js +14 -14
  163. package/src/saas/internal-api/recordHub/api/record.hub.service.js +32 -32
  164. package/src/saas/internal-api/recordHub/index.js +3 -3
  165. package/src/saas/internal-api/recordNotes/api/record.notes.api.js +38 -38
  166. package/src/saas/internal-api/recordNotes/api/record.notes.service.js +56 -56
  167. package/src/saas/internal-api/recordNotes/api/record.notes.utils.js +12 -12
  168. package/src/saas/internal-api/recordNotes/index.js +3 -3
  169. package/src/saas/internal-api/reports/api/reports.api.js +62 -62
  170. package/src/saas/internal-api/reports/api/reports.service.js +79 -79
  171. package/src/saas/internal-api/reports/consts/consts.js +74 -74
  172. package/src/saas/internal-api/reports/index.js +15 -15
  173. package/src/saas/internal-api/reports/models/report.model.js +27 -27
  174. package/src/saas/internal-api/requests/api/requests.api.js +132 -132
  175. package/src/saas/internal-api/requests/api/requests.service.js +312 -312
  176. package/src/saas/internal-api/requests/index.js +21 -21
  177. package/src/saas/internal-api/requests/models/create.request.model.js +36 -36
  178. package/src/saas/internal-api/requests/models/draft.request.criteria.model.js +18 -18
  179. package/src/saas/internal-api/requests/models/draft.request.report.model.js +14 -14
  180. package/src/saas/internal-api/requests/models/edit.request.model.js +31 -31
  181. package/src/saas/internal-api/requests/models/homepageRequestCriteriaModel.js +19 -19
  182. package/src/saas/internal-api/requests/models/requestListCriteriaModel.js +17 -17
  183. package/src/saas/internal-api/requests/models/tenant.request.model.js +9 -9
  184. package/src/saas/internal-api/requests/utils.js +16 -16
  185. package/src/saas/internal-api/requestsTable/api/requests.table.api.js +20 -20
  186. package/src/saas/internal-api/requestsTable/api/requests.table.service.js +14 -14
  187. package/src/saas/internal-api/requestsTable/index.js +3 -3
  188. package/src/saas/internal-api/requirements/api/requirements.api.js +57 -57
  189. package/src/saas/internal-api/requirements/api/requirements.service.js +184 -184
  190. package/src/saas/internal-api/requirements/consts/attributeTypes.json +8 -8
  191. package/src/saas/internal-api/requirements/consts/consts.js +6 -6
  192. package/src/saas/internal-api/requirements/index.js +10 -10
  193. package/src/saas/internal-api/requirements/models/create.requirement.model.js +17 -17
  194. package/src/saas/internal-api/requirements/models/policy.model.js +35 -35
  195. package/src/saas/internal-api/requirements/models/update.requirement.model.js +19 -19
  196. package/src/saas/internal-api/requirements/utils/utils.js +129 -129
  197. package/src/saas/internal-api/serviceArea/api/coordinates.api.js +12 -12
  198. package/src/saas/internal-api/serviceArea/api/coordinates.service.js +7 -7
  199. package/src/saas/internal-api/serviceArea/index.js +4 -4
  200. package/src/saas/internal-api/serviceArea/utils/utils.js +8 -8
  201. package/src/saas/internal-api/tabs/api/tabs.api.js +32 -32
  202. package/src/saas/internal-api/tabs/api/tabs.service.js +60 -60
  203. package/src/saas/internal-api/tabs/index.js +3 -3
  204. package/src/saas/internal-api/tabs/models/tabs.model.js +19 -19
  205. package/src/saas/internal-api/thread-scheduler/runner.js +55 -55
  206. package/src/saas/internal-api/uploadFiles/api/upload.file.api.js +43 -43
  207. package/src/saas/internal-api/uploadFiles/api/upload.file.service.js +107 -107
  208. package/src/saas/internal-api/uploadFiles/consts.js +12 -12
  209. package/src/saas/internal-api/uploadFiles/index.js +5 -5
  210. package/src/saas/internal-api/users/api/tenantApp/tenant.app.api.js +38 -38
  211. package/src/saas/internal-api/users/api/tenantApp/tenant.app.service.js +108 -108
  212. package/src/saas/internal-api/users/api/users.api.js +126 -126
  213. package/src/saas/internal-api/users/api/users.service.js +258 -258
  214. package/src/saas/internal-api/users/index.js +16 -16
  215. package/src/saas/internal-api/users/models/create.inner.system.user.model.js +18 -18
  216. package/src/saas/internal-api/users/models/notification.settings.model.js +12 -12
  217. package/src/saas/internal-api/users/models/tenent.user.model.js +11 -11
  218. package/src/saas/internal-api/users/models/users.model.js +43 -43
  219. package/src/saas/internal-api/users/utils/util.js +39 -39
  220. package/src/saas/internal-api/vendorProfile/api/vendor.profile.api.js +26 -26
  221. package/src/saas/internal-api/vendorProfile/api/vendor.profile.service.js +19 -19
  222. package/src/saas/internal-api/vendorProfile/index.js +3 -3
  223. package/src/saas/openapi/accounts/accounts.api.js +17 -17
  224. package/src/saas/openapi/accounts/accounts.service.js +11 -11
  225. package/src/saas/openapi/coi/coi.api.js +30 -30
  226. package/src/saas/openapi/coi/coi.service.js +43 -43
  227. package/src/saas/openapi/projects/projects.api.js +83 -83
  228. package/src/saas/openapi/projects/projects.service.js +64 -64
  229. package/src/saas/openapi/requests/index.js +7 -7
  230. package/src/saas/openapi/requests/models/invite.request.model.js +40 -40
  231. package/src/saas/openapi/requests/models/update.request.model.js +35 -35
  232. package/src/saas/openapi/requests/requests.api.js +93 -93
  233. package/src/saas/openapi/requests/requests.service.js +94 -94
  234. package/src/saas/openapi/requirements/index.js +6 -6
  235. package/src/saas/openapi/requirements/models/copy.requirement.model.js +10 -10
  236. package/src/saas/openapi/requirements/requirements.api.js +41 -41
  237. package/src/saas/openapi/requirements/requirements.service.js +49 -49
  238. package/src/saas/openapi/tabs/index.js +6 -6
  239. package/src/saas/openapi/tabs/models/create.tab.model.js +6 -6
  240. package/src/saas/openapi/tabs/tabs.api.js +27 -27
  241. package/src/saas/openapi/tabs/tabs.service.js +19 -19
  242. package/src/saas/openapi/users/user.model.js +10 -10
  243. package/src/saas/openapi/users/users.api.js +33 -33
  244. package/src/saas/openapi/users/users.service.js +51 -51
  245. package/tests/env.test.js +40 -40
  246. package/tests/validation.test.js +83 -83
@@ -1,161 +1,161 @@
1
- const globalRecordServices = require('../api/global.record.service');
2
- const globalRecordModels = require('../models/global.record.model');
3
-
4
- const { CreateGlobalRecordModel } = globalRecordModels;
5
- const { createGlobalRecord, getAllGlobalRecordsInPage } = globalRecordServices;
6
-
7
- const {
8
- getCapitalLetterUnicodeValueList,
9
- getUniqueNumber
10
- } = require('../../../../common/utils/numberUtils');
11
-
12
- const { SERVICE_AREAS } = require('../consts');
13
- const { cloneObject } = require('../../../../common/utils/objectUtils');
14
-
15
- const createGlobalRecordConfig = (
16
- name,
17
- { stateIndex, glPolicyNumbers } = {}
18
- ) => {
19
- const serviceArea = getServiceAreaByIndex(stateIndex || 0);
20
- const uniqueNumbers = glPolicyNumbers || getUniqueNumber();
21
- const emailBase = name.replace(/\s+/g, '').toLowerCase();
22
- return {
23
- header: `${name}Header`,
24
- recordName: `${name}Name`,
25
- additionalContacts: [
26
- `${emailBase}@additional1.jon`,
27
- `${emailBase}@additional2.jon`
28
- ],
29
- brokerEmails: [`${emailBase}@broker1.jon`, `${emailBase}@broker2.jon`],
30
- expirationDate: '2030-12-09',
31
- publishDate: '',
32
- lastPublishUserName: '',
33
- glPolicyNumbers: [uniqueNumbers.toString()],
34
- numberOfAssociatedRequests: 0,
35
- numberOfFilledMandatory: 0,
36
- dba: '',
37
- primaryEmail: '',
38
- serviceAreas: [getServiceArea(serviceArea)],
39
- __v: 0,
40
- recordType: ['Vendors']
41
- };
42
- };
43
-
44
- const getServiceArea = state => {
45
- return {
46
- city: `${state}TestCity`,
47
- state: state
48
- };
49
- };
50
-
51
- const createGlobalRecordConfigs = (
52
- nameList,
53
- { stateIndexes, glPolicyNumbers } = {}
54
- ) => {
55
- return nameList.map((name, index) =>
56
- createGlobalRecordConfig(name, {
57
- stateIndex: stateIndexes ? stateIndexes[index] : index,
58
- glPolicyNumbers: glPolicyNumbers ? glPolicyNumbers[index] : null
59
- })
60
- );
61
- };
62
-
63
- const createGlobalRecordModel = config => {
64
- return new CreateGlobalRecordModel(
65
- config.header,
66
- config.expirationDate,
67
- config.glPolicyNumbers,
68
- config.numberOfAssociatedRequests,
69
- config.numberOfFilledMandatory,
70
- {
71
- id: config.id,
72
- recordName: config.recordName,
73
- additionalContacts: config.additionalContacts,
74
- brokerEmails: config.brokerEmails,
75
- publishDate: config.publishDate,
76
- serviceAreas: config.serviceAreas,
77
- primaryEmail: config.primaryEmail,
78
- dba: config.dba,
79
- lastPublishUserName: config.lastPublishUserName,
80
- __v: config.__v,
81
- recordType: config.recordType
82
- }
83
- );
84
- };
85
-
86
- const createGlobalRecordModels = configList => {
87
- return configList.map(config => createGlobalRecordModel(config));
88
- };
89
-
90
- const getCreateRandomGlobalRecordModels = nameList => {
91
- const configList = createGlobalRecordConfigs(nameList);
92
- return createGlobalRecordModels(configList);
93
- };
94
-
95
- const createGlobalRecords = async (globalRecordModelList, context) => {
96
- const newGlobalRecodDetailsList = new Array();
97
- for (globalRecordModel of globalRecordModelList) {
98
- const newGlobalRecordDetails = await createGlobalRecord(
99
- globalRecordModel,
100
- context
101
- );
102
- newGlobalRecodDetailsList.push(newGlobalRecordDetails);
103
- }
104
-
105
- return newGlobalRecodDetailsList;
106
- };
107
-
108
- const getGlobalRecordsByNumberOfPages = async (numberOfPages, context) => {
109
- const allGlobalRecords = new Array();
110
-
111
- for (let pageNumber = 1; pageNumber <= numberOfPages; pageNumber++) {
112
- const allGlobalRecordsInPage = await getAllGlobalRecordsInPage(
113
- pageNumber,
114
- context
115
- );
116
- allGlobalRecords.push(allGlobalRecordsInPage);
117
- }
118
-
119
- return allGlobalRecords;
120
- };
121
-
122
- const getServiceAreaByIndex = stateIndex => {
123
- return SERVICE_AREAS[Object.keys(SERVICE_AREAS)[stateIndex % 10]];
124
- };
125
-
126
- const getGlobalRecordsDefaultNameList = (nameBase, listLength) => {
127
- const letterUnicodeValueList = getCapitalLetterUnicodeValueList({
128
- listLength
129
- });
130
-
131
- //How much times same letter will appear in one index on the array
132
- const repeatTimes = 4;
133
- return letterUnicodeValueList.map(
134
- unicode =>
135
- `${nameBase} ${String.fromCharCode(unicode).repeat(repeatTimes)}`
136
- );
137
- };
138
-
139
- const createPublishGlobalConfig = (recordName, id, primaryEmail, { additionalContacts, brokerEmails } = {}) => {
140
- return cloneObject({
141
- recordName,
142
- id,
143
- primaryEmail,
144
- additionalContacts: additionalContacts || [],
145
- brokerEmails: brokerEmails || []
146
-
147
- });
148
- };
149
-
150
- module.exports = {
151
- createGlobalRecords,
152
- createGlobalRecordConfig,
153
- createGlobalRecordConfigs,
154
- createGlobalRecordModel,
155
- createGlobalRecordModels,
156
- createPublishGlobalConfig,
157
- getCreateRandomGlobalRecordModels,
158
- getGlobalRecordsDefaultNameList,
159
- getGlobalRecordsByNumberOfPages,
160
- getServiceArea
161
- };
1
+ const globalRecordServices = require('../api/global.record.service');
2
+ const globalRecordModels = require('../models/global.record.model');
3
+
4
+ const { CreateGlobalRecordModel } = globalRecordModels;
5
+ const { createGlobalRecord, getAllGlobalRecordsInPage } = globalRecordServices;
6
+
7
+ const {
8
+ getCapitalLetterUnicodeValueList,
9
+ getUniqueNumber
10
+ } = require('../../../../common/utils/numberUtils');
11
+
12
+ const { SERVICE_AREAS } = require('../consts');
13
+ const { cloneObject } = require('../../../../common/utils/objectUtils');
14
+
15
+ const createGlobalRecordConfig = (
16
+ name,
17
+ { stateIndex, glPolicyNumbers } = {}
18
+ ) => {
19
+ const serviceArea = getServiceAreaByIndex(stateIndex || 0);
20
+ const uniqueNumbers = glPolicyNumbers || getUniqueNumber();
21
+ const emailBase = name.replace(/\s+/g, '').toLowerCase();
22
+ return {
23
+ header: `${name}Header`,
24
+ recordName: `${name}Name`,
25
+ additionalContacts: [
26
+ `${emailBase}@additional1.jon`,
27
+ `${emailBase}@additional2.jon`
28
+ ],
29
+ brokerEmails: [`${emailBase}@broker1.jon`, `${emailBase}@broker2.jon`],
30
+ expirationDate: '2030-12-09',
31
+ publishDate: '',
32
+ lastPublishUserName: '',
33
+ glPolicyNumbers: [uniqueNumbers.toString()],
34
+ numberOfAssociatedRequests: 0,
35
+ numberOfFilledMandatory: 0,
36
+ dba: '',
37
+ primaryEmail: '',
38
+ serviceAreas: [getServiceArea(serviceArea)],
39
+ __v: 0,
40
+ recordType: ['Vendors']
41
+ };
42
+ };
43
+
44
+ const getServiceArea = state => {
45
+ return {
46
+ city: `${state}TestCity`,
47
+ state: state
48
+ };
49
+ };
50
+
51
+ const createGlobalRecordConfigs = (
52
+ nameList,
53
+ { stateIndexes, glPolicyNumbers } = {}
54
+ ) => {
55
+ return nameList.map((name, index) =>
56
+ createGlobalRecordConfig(name, {
57
+ stateIndex: stateIndexes ? stateIndexes[index] : index,
58
+ glPolicyNumbers: glPolicyNumbers ? glPolicyNumbers[index] : null
59
+ })
60
+ );
61
+ };
62
+
63
+ const createGlobalRecordModel = config => {
64
+ return new CreateGlobalRecordModel(
65
+ config.header,
66
+ config.expirationDate,
67
+ config.glPolicyNumbers,
68
+ config.numberOfAssociatedRequests,
69
+ config.numberOfFilledMandatory,
70
+ {
71
+ id: config.id,
72
+ recordName: config.recordName,
73
+ additionalContacts: config.additionalContacts,
74
+ brokerEmails: config.brokerEmails,
75
+ publishDate: config.publishDate,
76
+ serviceAreas: config.serviceAreas,
77
+ primaryEmail: config.primaryEmail,
78
+ dba: config.dba,
79
+ lastPublishUserName: config.lastPublishUserName,
80
+ __v: config.__v,
81
+ recordType: config.recordType
82
+ }
83
+ );
84
+ };
85
+
86
+ const createGlobalRecordModels = configList => {
87
+ return configList.map(config => createGlobalRecordModel(config));
88
+ };
89
+
90
+ const getCreateRandomGlobalRecordModels = nameList => {
91
+ const configList = createGlobalRecordConfigs(nameList);
92
+ return createGlobalRecordModels(configList);
93
+ };
94
+
95
+ const createGlobalRecords = async (globalRecordModelList, context) => {
96
+ const newGlobalRecodDetailsList = new Array();
97
+ for (globalRecordModel of globalRecordModelList) {
98
+ const newGlobalRecordDetails = await createGlobalRecord(
99
+ globalRecordModel,
100
+ context
101
+ );
102
+ newGlobalRecodDetailsList.push(newGlobalRecordDetails);
103
+ }
104
+
105
+ return newGlobalRecodDetailsList;
106
+ };
107
+
108
+ const getGlobalRecordsByNumberOfPages = async (numberOfPages, context) => {
109
+ const allGlobalRecords = new Array();
110
+
111
+ for (let pageNumber = 1; pageNumber <= numberOfPages; pageNumber++) {
112
+ const allGlobalRecordsInPage = await getAllGlobalRecordsInPage(
113
+ pageNumber,
114
+ context
115
+ );
116
+ allGlobalRecords.push(allGlobalRecordsInPage);
117
+ }
118
+
119
+ return allGlobalRecords;
120
+ };
121
+
122
+ const getServiceAreaByIndex = stateIndex => {
123
+ return SERVICE_AREAS[Object.keys(SERVICE_AREAS)[stateIndex % 10]];
124
+ };
125
+
126
+ const getGlobalRecordsDefaultNameList = (nameBase, listLength) => {
127
+ const letterUnicodeValueList = getCapitalLetterUnicodeValueList({
128
+ listLength
129
+ });
130
+
131
+ //How much times same letter will appear in one index on the array
132
+ const repeatTimes = 4;
133
+ return letterUnicodeValueList.map(
134
+ unicode =>
135
+ `${nameBase} ${String.fromCharCode(unicode).repeat(repeatTimes)}`
136
+ );
137
+ };
138
+
139
+ const createPublishGlobalConfig = (recordName, id, primaryEmail, { additionalContacts, brokerEmails } = {}) => {
140
+ return cloneObject({
141
+ recordName,
142
+ id,
143
+ primaryEmail,
144
+ additionalContacts: additionalContacts || [],
145
+ brokerEmails: brokerEmails || []
146
+
147
+ });
148
+ };
149
+
150
+ module.exports = {
151
+ createGlobalRecords,
152
+ createGlobalRecordConfig,
153
+ createGlobalRecordConfigs,
154
+ createGlobalRecordModel,
155
+ createGlobalRecordModels,
156
+ createPublishGlobalConfig,
157
+ getCreateRandomGlobalRecordModels,
158
+ getGlobalRecordsDefaultNameList,
159
+ getGlobalRecordsByNumberOfPages,
160
+ getServiceArea
161
+ };
@@ -1,12 +1,12 @@
1
- const requests = require('../../../../common/requests/cookieAuth/requests');
2
- const { backendUrl } = require('../../../../env').getEnv();
3
-
4
- const Endpoints = {
5
- getHomePageChartsDataApi: () => `${backendUrl}/saas/user/properties/compliance-summary`
6
- };
7
-
8
- const getHomePageChartsData = context => {
9
- return requests.postRequestHandler(Endpoints.getHomePageChartsDataApi(), {}, context);
10
- };
11
-
12
- module.exports = { getHomePageChartsData };
1
+ const requests = require('../../../../common/requests/cookieAuth/requests');
2
+ const { backendUrl } = require('../../../../env').getEnv();
3
+
4
+ const Endpoints = {
5
+ getHomePageChartsDataApi: () => `${backendUrl}/saas/user/properties/compliance-summary`
6
+ };
7
+
8
+ const getHomePageChartsData = context => {
9
+ return requests.postRequestHandler(Endpoints.getHomePageChartsDataApi(), {}, context);
10
+ };
11
+
12
+ module.exports = { getHomePageChartsData };
@@ -1,7 +1,7 @@
1
- const chartsAPI = require('./charts.api');
2
-
3
- const getHomePageChartsData = context => {
4
- return chartsAPI.getHomePageChartsData(context);
5
- };
6
-
7
- module.exports = { getHomePageChartsData };
1
+ const chartsAPI = require('./charts.api');
2
+
3
+ const getHomePageChartsData = context => {
4
+ return chartsAPI.getHomePageChartsData(context);
5
+ };
6
+
7
+ module.exports = { getHomePageChartsData };
@@ -1,3 +1,3 @@
1
- const services = require('./api/charts.service');
2
-
3
- module.exports = { services };
1
+ const services = require('./api/charts.service');
2
+
3
+ module.exports = { services };
@@ -1,14 +1,14 @@
1
- const requests = require('../../../../common/requests/cookieAuth/requests');
2
- const { backendUrl } = require('../../../../env').getEnv();
3
-
4
- const Endpoints = {
5
- isNetworkTabEnabledForUser: `${backendUrl}/saas/account/user/jones-network-enabled/setting`
6
- };
7
-
8
- const isNetworkTabEnabledForUser = async context => {
9
- return requests.getRequestHandler(Endpoints.isNetworkTabEnabledForUser, { }, context);
10
- };
11
-
12
- module.exports = {
13
- isNetworkTabEnabledForUser
14
- };
1
+ const requests = require('../../../../common/requests/cookieAuth/requests');
2
+ const { backendUrl } = require('../../../../env').getEnv();
3
+
4
+ const Endpoints = {
5
+ isNetworkTabEnabledForUser: `${backendUrl}/saas/account/user/jones-network-enabled/setting`
6
+ };
7
+
8
+ const isNetworkTabEnabledForUser = async context => {
9
+ return requests.getRequestHandler(Endpoints.isNetworkTabEnabledForUser, { }, context);
10
+ };
11
+
12
+ module.exports = {
13
+ isNetworkTabEnabledForUser
14
+ };
@@ -1,16 +1,16 @@
1
- const networkTabApi = require('./jones.network.tab.api');
2
- const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
3
-
4
- const isNetworkTabEnabledForUser = async context => {
5
- const notificationPageResponse = await networkTabApi.isNetworkTabEnabledForUser(context);
6
-
7
- if (notificationPageResponse.status !== httpResponseStatusCodes.OK) {
8
- throw new Error(`Failed to get network tab enable settings status, cause by: ${notificationPageResponse.message}`);
9
- }
10
-
11
- return notificationPageResponse.data;
12
- };
13
-
14
- module.exports = {
15
- isNetworkTabEnabledForUser
16
- };
1
+ const networkTabApi = require('./jones.network.tab.api');
2
+ const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
3
+
4
+ const isNetworkTabEnabledForUser = async context => {
5
+ const notificationPageResponse = await networkTabApi.isNetworkTabEnabledForUser(context);
6
+
7
+ if (notificationPageResponse.status !== httpResponseStatusCodes.OK) {
8
+ throw new Error(`Failed to get network tab enable settings status, cause by: ${notificationPageResponse.message}`);
9
+ }
10
+
11
+ return notificationPageResponse.data;
12
+ };
13
+
14
+ module.exports = {
15
+ isNetworkTabEnabledForUser
16
+ };
@@ -1,3 +1,3 @@
1
- const services = require('./api/jones.network.tab.service');
2
-
3
- module.exports = { services };
1
+ const services = require('./api/jones.network.tab.service');
2
+
3
+ module.exports = { services };
@@ -1,32 +1,32 @@
1
- const requests = require('../../../../common/requests/cookieAuth/requests');
2
- const { backendUrl } = require('../../../../env').getEnv();
3
-
4
- const Endpoints = {
5
- getNotificationsPage: `${backendUrl}/saas/notifications`,
6
- getLatestNotifications: `${backendUrl}/saas/notifications/newest`,
7
- markNotificationAsRead: notificationId => `${backendUrl}/saas/notifications/${notificationId}/read`,
8
- markNotificationsAsSeen: latestSeenNotificationId => `${backendUrl}/saas/notifications/${latestSeenNotificationId}/seen`
9
- };
10
-
11
- const getNotificationsPage = async (lastNotificationId, context) => {
12
- return requests.getRequestHandler(Endpoints.getNotificationsPage, { lastNotificationId }, context);
13
- };
14
-
15
- const getLatestNotifications = async context => {
16
- return requests.getRequestHandler(Endpoints.getLatestNotifications, {}, context);
17
- };
18
-
19
- const markNotificationAsRead = async (notificationId, context) => {
20
- return requests.postRequestHandler(Endpoints.markNotificationAsRead(notificationId), {}, context);
21
- };
22
-
23
- const markNotificationsAsSeen = async (latestSeenNotificationId, context) => {
24
- return requests.postRequestHandler(Endpoints.markNotificationsAsSeen(latestSeenNotificationId), {}, context);
25
- };
26
-
27
- module.exports = {
28
- getNotificationsPage,
29
- getLatestNotifications,
30
- markNotificationAsRead,
31
- markNotificationsAsSeen
32
- };
1
+ const requests = require('../../../../common/requests/cookieAuth/requests');
2
+ const { backendUrl } = require('../../../../env').getEnv();
3
+
4
+ const Endpoints = {
5
+ getNotificationsPage: `${backendUrl}/saas/notifications`,
6
+ getLatestNotifications: `${backendUrl}/saas/notifications/newest`,
7
+ markNotificationAsRead: notificationId => `${backendUrl}/saas/notifications/${notificationId}/read`,
8
+ markNotificationsAsSeen: latestSeenNotificationId => `${backendUrl}/saas/notifications/${latestSeenNotificationId}/seen`
9
+ };
10
+
11
+ const getNotificationsPage = async (lastNotificationId, context) => {
12
+ return requests.getRequestHandler(Endpoints.getNotificationsPage, { lastNotificationId }, context);
13
+ };
14
+
15
+ const getLatestNotifications = async context => {
16
+ return requests.getRequestHandler(Endpoints.getLatestNotifications, {}, context);
17
+ };
18
+
19
+ const markNotificationAsRead = async (notificationId, context) => {
20
+ return requests.postRequestHandler(Endpoints.markNotificationAsRead(notificationId), {}, context);
21
+ };
22
+
23
+ const markNotificationsAsSeen = async (latestSeenNotificationId, context) => {
24
+ return requests.postRequestHandler(Endpoints.markNotificationsAsSeen(latestSeenNotificationId), {}, context);
25
+ };
26
+
27
+ module.exports = {
28
+ getNotificationsPage,
29
+ getLatestNotifications,
30
+ markNotificationAsRead,
31
+ markNotificationsAsSeen
32
+ };
@@ -1,49 +1,49 @@
1
- const notificationCenterApi = require('./notification.center.api');
2
- const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
3
-
4
- const getNotificationsPage = async (lastNotificationId, context, { shouldExpectError } = {}) => {
5
- const notificationPageResponse = await notificationCenterApi.getNotificationsPage(lastNotificationId, context);
6
-
7
- if (notificationPageResponse.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
8
- throw new Error(`Failed to get notifications page, cause by : ${notificationPageResponse.message}`);
9
- }
10
-
11
- return shouldExpectError ? notificationPageResponse : notificationPageResponse.data;
12
- };
13
-
14
- const getLatestNotifications = async (context, { shouldExpectError } = {}) => {
15
- const latestNotificationResponse = await notificationCenterApi.getLatestNotifications(context);
16
-
17
- if (latestNotificationResponse.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
18
- throw new Error(`Failed to get latest notifications, cause by : ${latestNotificationResponse.message}`);
19
- }
20
-
21
- return shouldExpectError ? latestNotificationResponse : latestNotificationResponse.data;
22
- };
23
-
24
- const markNotificationAsRead = async (notificationId, context, { shouldExpectError } = {}) => {
25
- const response = await notificationCenterApi.markNotificationAsRead(notificationId, context);
26
-
27
- if (response.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
28
- throw new Error(`Failed to mark notifications as read, cause by : ${response.message}`);
29
- }
30
-
31
- return response;
32
- };
33
-
34
- const markNotificationsAsSeen = async (latestSeenNotificationId, context, { shouldExpectError } = {}) => {
35
- const response = await notificationCenterApi.markNotificationsAsSeen(latestSeenNotificationId, context);
36
-
37
- if (response.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
38
- throw new Error(`Failed to mark notifications as seen, cause by : ${response.message}`);
39
- }
40
-
41
- return response;
42
- };
43
-
44
- module.exports = {
45
- getNotificationsPage,
46
- getLatestNotifications,
47
- markNotificationAsRead,
48
- markNotificationsAsSeen
49
- };
1
+ const notificationCenterApi = require('./notification.center.api');
2
+ const httpResponseStatusCodes = require('../../../../common/httpResponseStatusCodes.json');
3
+
4
+ const getNotificationsPage = async (lastNotificationId, context, { shouldExpectError } = {}) => {
5
+ const notificationPageResponse = await notificationCenterApi.getNotificationsPage(lastNotificationId, context);
6
+
7
+ if (notificationPageResponse.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
8
+ throw new Error(`Failed to get notifications page, cause by : ${notificationPageResponse.message}`);
9
+ }
10
+
11
+ return shouldExpectError ? notificationPageResponse : notificationPageResponse.data;
12
+ };
13
+
14
+ const getLatestNotifications = async (context, { shouldExpectError } = {}) => {
15
+ const latestNotificationResponse = await notificationCenterApi.getLatestNotifications(context);
16
+
17
+ if (latestNotificationResponse.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
18
+ throw new Error(`Failed to get latest notifications, cause by : ${latestNotificationResponse.message}`);
19
+ }
20
+
21
+ return shouldExpectError ? latestNotificationResponse : latestNotificationResponse.data;
22
+ };
23
+
24
+ const markNotificationAsRead = async (notificationId, context, { shouldExpectError } = {}) => {
25
+ const response = await notificationCenterApi.markNotificationAsRead(notificationId, context);
26
+
27
+ if (response.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
28
+ throw new Error(`Failed to mark notifications as read, cause by : ${response.message}`);
29
+ }
30
+
31
+ return response;
32
+ };
33
+
34
+ const markNotificationsAsSeen = async (latestSeenNotificationId, context, { shouldExpectError } = {}) => {
35
+ const response = await notificationCenterApi.markNotificationsAsSeen(latestSeenNotificationId, context);
36
+
37
+ if (response.status !== httpResponseStatusCodes.OK && !shouldExpectError) {
38
+ throw new Error(`Failed to mark notifications as seen, cause by : ${response.message}`);
39
+ }
40
+
41
+ return response;
42
+ };
43
+
44
+ module.exports = {
45
+ getNotificationsPage,
46
+ getLatestNotifications,
47
+ markNotificationAsRead,
48
+ markNotificationsAsSeen
49
+ };
@@ -1,3 +1,3 @@
1
- const services = require('./api/notification.center.service');
2
-
3
- module.exports = { services };
1
+ const services = require('./api/notification.center.service');
2
+
3
+ module.exports = { services };