@squiz/job-runner-lib 1.66.1

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 (826) hide show
  1. package/.env.example +1 -0
  2. package/CHANGELOG.md +726 -0
  3. package/build.js +17 -0
  4. package/jest.config.ts +24 -0
  5. package/jest.integration.config.ts +27 -0
  6. package/lib/TestHelpers.d.ts +18 -0
  7. package/lib/TestHelpers.js +97 -0
  8. package/lib/TestHelpers.js.map +1 -0
  9. package/lib/domains/__test__/createPackage.d.ts +3 -0
  10. package/lib/domains/__test__/createPackage.js +45 -0
  11. package/lib/domains/__test__/createPackage.js.map +1 -0
  12. package/lib/domains/__test__/loadAllUnitTestComponents.d.ts +3 -0
  13. package/lib/domains/__test__/loadAllUnitTestComponents.js +63 -0
  14. package/lib/domains/__test__/loadAllUnitTestComponents.js.map +1 -0
  15. package/lib/domains/component/component-context/__mocks__/mockedManifestModel.d.ts +3 -0
  16. package/lib/domains/component/component-context/__mocks__/mockedManifestModel.js +33 -0
  17. package/lib/domains/component/component-context/__mocks__/mockedManifestModel.js.map +1 -0
  18. package/lib/domains/component/component-context/__mocks__/mockedUriObj.d.ts +3 -0
  19. package/lib/domains/component/component-context/__mocks__/mockedUriObj.js +38 -0
  20. package/lib/domains/component/component-context/__mocks__/mockedUriObj.js.map +1 -0
  21. package/lib/domains/component/component-context/__mocks__/mockedUriObjPreview.d.ts +3 -0
  22. package/lib/domains/component/component-context/__mocks__/mockedUriObjPreview.js +38 -0
  23. package/lib/domains/component/component-context/__mocks__/mockedUriObjPreview.js.map +1 -0
  24. package/lib/domains/component/component-context/createComponentContextualFunctions.d.ts +23 -0
  25. package/lib/domains/component/component-context/createComponentContextualFunctions.js +75 -0
  26. package/lib/domains/component/component-context/createComponentContextualFunctions.js.map +1 -0
  27. package/lib/domains/component/component-context/createComponentContextualFunctions.spec.d.ts +1 -0
  28. package/lib/domains/component/component-context/createComponentContextualFunctions.spec.js +248 -0
  29. package/lib/domains/component/component-context/createComponentContextualFunctions.spec.js.map +1 -0
  30. package/lib/domains/component/errors/ComponentError.d.ts +12 -0
  31. package/lib/domains/component/errors/ComponentError.js +20 -0
  32. package/lib/domains/component/errors/ComponentError.js.map +1 -0
  33. package/lib/domains/component/errors/JobError.d.ts +10 -0
  34. package/lib/domains/component/errors/JobError.js +18 -0
  35. package/lib/domains/component/errors/JobError.js.map +1 -0
  36. package/lib/domains/component/index.d.ts +13 -0
  37. package/lib/domains/component/index.js +30 -0
  38. package/lib/domains/component/index.js.map +1 -0
  39. package/lib/domains/component/models/Component.d.ts +7 -0
  40. package/lib/domains/component/models/Component.js +13 -0
  41. package/lib/domains/component/models/Component.js.map +1 -0
  42. package/lib/domains/component/models/Component.spec.d.ts +1 -0
  43. package/lib/domains/component/models/Component.spec.js +18 -0
  44. package/lib/domains/component/models/Component.spec.js.map +1 -0
  45. package/lib/domains/component/models/ComponentVersion.d.ts +18 -0
  46. package/lib/domains/component/models/ComponentVersion.js +35 -0
  47. package/lib/domains/component/models/ComponentVersion.js.map +1 -0
  48. package/lib/domains/component/models/ComponentVersion.spec.d.ts +1 -0
  49. package/lib/domains/component/models/ComponentVersion.spec.js +55 -0
  50. package/lib/domains/component/models/ComponentVersion.spec.js.map +1 -0
  51. package/lib/domains/component/repositories/ComponentRepository.d.ts +12 -0
  52. package/lib/domains/component/repositories/ComponentRepository.integration.spec.d.ts +1 -0
  53. package/lib/domains/component/repositories/ComponentRepository.integration.spec.js +111 -0
  54. package/lib/domains/component/repositories/ComponentRepository.integration.spec.js.map +1 -0
  55. package/lib/domains/component/repositories/ComponentRepository.js +28 -0
  56. package/lib/domains/component/repositories/ComponentRepository.js.map +1 -0
  57. package/lib/domains/component/repositories/ComponentVersionRepository.d.ts +21 -0
  58. package/lib/domains/component/repositories/ComponentVersionRepository.integration.spec.d.ts +1 -0
  59. package/lib/domains/component/repositories/ComponentVersionRepository.integration.spec.js +378 -0
  60. package/lib/domains/component/repositories/ComponentVersionRepository.integration.spec.js.map +1 -0
  61. package/lib/domains/component/repositories/ComponentVersionRepository.js +83 -0
  62. package/lib/domains/component/repositories/ComponentVersionRepository.js.map +1 -0
  63. package/lib/domains/component/services/ComponentService.d.ts +40 -0
  64. package/lib/domains/component/services/ComponentService.integration.spec.d.ts +1 -0
  65. package/lib/domains/component/services/ComponentService.integration.spec.js +614 -0
  66. package/lib/domains/component/services/ComponentService.integration.spec.js.map +1 -0
  67. package/lib/domains/component/services/ComponentService.js +254 -0
  68. package/lib/domains/component/services/ComponentService.js.map +1 -0
  69. package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.d.ts +12 -0
  70. package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.js +15 -0
  71. package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.js.map +1 -0
  72. package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.spec.d.ts +1 -0
  73. package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.spec.js +75 -0
  74. package/lib/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.spec.js.map +1 -0
  75. package/lib/domains/component/utils/getComponentFileSystemFolder.d.ts +1 -0
  76. package/lib/domains/component/utils/getComponentFileSystemFolder.js +12 -0
  77. package/lib/domains/component/utils/getComponentFileSystemFolder.js.map +1 -0
  78. package/lib/domains/component/utils/getComponentFileSystemFolder.spec.d.ts +1 -0
  79. package/lib/domains/component/utils/getComponentFileSystemFolder.spec.js +13 -0
  80. package/lib/domains/component/utils/getComponentFileSystemFolder.spec.js.map +1 -0
  81. package/lib/domains/component/utils/getComponentName.d.ts +1 -0
  82. package/lib/domains/component/utils/getComponentName.js +8 -0
  83. package/lib/domains/component/utils/getComponentName.js.map +1 -0
  84. package/lib/domains/component/utils/getComponentName.spec.d.ts +1 -0
  85. package/lib/domains/component/utils/getComponentName.spec.js +9 -0
  86. package/lib/domains/component/utils/getComponentName.spec.js.map +1 -0
  87. package/lib/domains/component/utils/moveFilesAndDirectories.d.ts +1 -0
  88. package/lib/domains/component/utils/moveFilesAndDirectories.js +33 -0
  89. package/lib/domains/component/utils/moveFilesAndDirectories.js.map +1 -0
  90. package/lib/domains/component/utils/moveFilesAndDirectories.spec.d.ts +1 -0
  91. package/lib/domains/component/utils/moveFilesAndDirectories.spec.js +52 -0
  92. package/lib/domains/component/utils/moveFilesAndDirectories.spec.js.map +1 -0
  93. package/lib/domains/component/web-models/ComponentForWeb.d.ts +11 -0
  94. package/lib/domains/component/web-models/ComponentForWeb.js +3 -0
  95. package/lib/domains/component/web-models/ComponentForWeb.js.map +1 -0
  96. package/lib/domains/component/web-models/ComponentVersionWebModel.d.ts +15 -0
  97. package/lib/domains/component/web-models/ComponentVersionWebModel.js +3 -0
  98. package/lib/domains/component/web-models/ComponentVersionWebModel.js.map +1 -0
  99. package/lib/domains/component/web-models/ComponentsForWeb.d.ts +17 -0
  100. package/lib/domains/component/web-models/ComponentsForWeb.js +3 -0
  101. package/lib/domains/component/web-models/ComponentsForWeb.js.map +1 -0
  102. package/lib/domains/component-set/errors/InvalidEnvironmentVariablesError.d.ts +5 -0
  103. package/lib/domains/component-set/errors/InvalidEnvironmentVariablesError.js +14 -0
  104. package/lib/domains/component-set/errors/InvalidEnvironmentVariablesError.js.map +1 -0
  105. package/lib/domains/component-set/index.d.ts +13 -0
  106. package/lib/domains/component-set/index.js +30 -0
  107. package/lib/domains/component-set/index.js.map +1 -0
  108. package/lib/domains/component-set/models/ComponentSet.d.ts +20 -0
  109. package/lib/domains/component-set/models/ComponentSet.js +28 -0
  110. package/lib/domains/component-set/models/ComponentSet.js.map +1 -0
  111. package/lib/domains/component-set/models/ComponentSet.spec.d.ts +1 -0
  112. package/lib/domains/component-set/models/ComponentSet.spec.js +45 -0
  113. package/lib/domains/component-set/models/ComponentSet.spec.js.map +1 -0
  114. package/lib/domains/component-set/models/ComponentSetComponentVersion.d.ts +23 -0
  115. package/lib/domains/component-set/models/ComponentSetComponentVersion.js +29 -0
  116. package/lib/domains/component-set/models/ComponentSetComponentVersion.js.map +1 -0
  117. package/lib/domains/component-set/models/ComponentSetComponentVersion.spec.d.ts +1 -0
  118. package/lib/domains/component-set/models/ComponentSetComponentVersion.spec.js +83 -0
  119. package/lib/domains/component-set/models/ComponentSetComponentVersion.spec.js.map +1 -0
  120. package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.d.ts +12 -0
  121. package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.js +57 -0
  122. package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.js.map +1 -0
  123. package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.spec.d.ts +1 -0
  124. package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.spec.js +60 -0
  125. package/lib/domains/component-set/models/ComponentSetComponentVersionEditable.spec.js.map +1 -0
  126. package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.d.ts +11 -0
  127. package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.js +17 -0
  128. package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.js.map +1 -0
  129. package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.spec.d.ts +1 -0
  130. package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.spec.js +34 -0
  131. package/lib/domains/component-set/models/ComponentSetComponentVersionExcluded.spec.js.map +1 -0
  132. package/lib/domains/component-set/models/ComponentSetRule.d.ts +12 -0
  133. package/lib/domains/component-set/models/ComponentSetRule.js +50 -0
  134. package/lib/domains/component-set/models/ComponentSetRule.js.map +1 -0
  135. package/lib/domains/component-set/models/ComponentSetRule.spec.d.ts +1 -0
  136. package/lib/domains/component-set/models/ComponentSetRule.spec.js +29 -0
  137. package/lib/domains/component-set/models/ComponentSetRule.spec.js.map +1 -0
  138. package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.d.ts +10 -0
  139. package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.integration.spec.d.ts +1 -0
  140. package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.integration.spec.js +127 -0
  141. package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.integration.spec.js.map +1 -0
  142. package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.js +37 -0
  143. package/lib/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.js.map +1 -0
  144. package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.d.ts +10 -0
  145. package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.integration.spec.d.ts +1 -0
  146. package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.integration.spec.js +127 -0
  147. package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.integration.spec.js.map +1 -0
  148. package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.js +37 -0
  149. package/lib/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.js.map +1 -0
  150. package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.d.ts +10 -0
  151. package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.integration.spec.d.ts +1 -0
  152. package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.integration.spec.js +163 -0
  153. package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.integration.spec.js.map +1 -0
  154. package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.js +22 -0
  155. package/lib/domains/component-set/repositories/ComponentSetComponentVersionRepository.js.map +1 -0
  156. package/lib/domains/component-set/repositories/ComponentSetRepository.d.ts +13 -0
  157. package/lib/domains/component-set/repositories/ComponentSetRepository.integration.spec.d.ts +1 -0
  158. package/lib/domains/component-set/repositories/ComponentSetRepository.integration.spec.js +161 -0
  159. package/lib/domains/component-set/repositories/ComponentSetRepository.integration.spec.js.map +1 -0
  160. package/lib/domains/component-set/repositories/ComponentSetRepository.js +48 -0
  161. package/lib/domains/component-set/repositories/ComponentSetRepository.js.map +1 -0
  162. package/lib/domains/component-set/repositories/ComponentSetRuleRepository.d.ts +13 -0
  163. package/lib/domains/component-set/repositories/ComponentSetRuleRepository.integration.spec.d.ts +1 -0
  164. package/lib/domains/component-set/repositories/ComponentSetRuleRepository.integration.spec.js +88 -0
  165. package/lib/domains/component-set/repositories/ComponentSetRuleRepository.integration.spec.js.map +1 -0
  166. package/lib/domains/component-set/repositories/ComponentSetRuleRepository.js +55 -0
  167. package/lib/domains/component-set/repositories/ComponentSetRuleRepository.js.map +1 -0
  168. package/lib/domains/component-set/services/ComponentSetRuleService.d.ts +10 -0
  169. package/lib/domains/component-set/services/ComponentSetRuleService.integration.spec.d.ts +1 -0
  170. package/lib/domains/component-set/services/ComponentSetRuleService.integration.spec.js +107 -0
  171. package/lib/domains/component-set/services/ComponentSetRuleService.integration.spec.js.map +1 -0
  172. package/lib/domains/component-set/services/ComponentSetRuleService.js +23 -0
  173. package/lib/domains/component-set/services/ComponentSetRuleService.js.map +1 -0
  174. package/lib/domains/component-set/services/ComponentSetService.d.ts +37 -0
  175. package/lib/domains/component-set/services/ComponentSetService.js +13 -0
  176. package/lib/domains/component-set/services/ComponentSetService.js.map +1 -0
  177. package/lib/domains/component-set/services/ComponentSetService.spec.d.ts +1 -0
  178. package/lib/domains/component-set/services/ComponentSetService.spec.js +120 -0
  179. package/lib/domains/component-set/services/ComponentSetService.spec.js.map +1 -0
  180. package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.d.ts +24 -0
  181. package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.js +85 -0
  182. package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.js.map +1 -0
  183. package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.spec.d.ts +1 -0
  184. package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.spec.js +141 -0
  185. package/lib/domains/component-set/services/ComponentSetServiceForLocalDev.spec.js.map +1 -0
  186. package/lib/domains/component-set/services/ComponentSetServiceForProduction.d.ts +53 -0
  187. package/lib/domains/component-set/services/ComponentSetServiceForProduction.integration.spec.d.ts +1 -0
  188. package/lib/domains/component-set/services/ComponentSetServiceForProduction.integration.spec.js +2565 -0
  189. package/lib/domains/component-set/services/ComponentSetServiceForProduction.integration.spec.js.map +1 -0
  190. package/lib/domains/component-set/services/ComponentSetServiceForProduction.js +601 -0
  191. package/lib/domains/component-set/services/ComponentSetServiceForProduction.js.map +1 -0
  192. package/lib/domains/component-set/services/EnvironmentVariables.d.ts +1 -0
  193. package/lib/domains/component-set/services/EnvironmentVariables.js +3 -0
  194. package/lib/domains/component-set/services/EnvironmentVariables.js.map +1 -0
  195. package/lib/domains/component-set/services/Headers.d.ts +1 -0
  196. package/lib/domains/component-set/services/Headers.js +3 -0
  197. package/lib/domains/component-set/services/Headers.js.map +1 -0
  198. package/lib/domains/component-set/services/RuntimeComponentSet.d.ts +6 -0
  199. package/lib/domains/component-set/services/RuntimeComponentSet.js +3 -0
  200. package/lib/domains/component-set/services/RuntimeComponentSet.js.map +1 -0
  201. package/lib/domains/component-set/web-models/ComponentSetComponentVersionForWeb.d.ts +5 -0
  202. package/lib/domains/component-set/web-models/ComponentSetComponentVersionForWeb.js +3 -0
  203. package/lib/domains/component-set/web-models/ComponentSetComponentVersionForWeb.js.map +1 -0
  204. package/lib/domains/component-set/web-models/ComponentSetForWeb.d.ts +64 -0
  205. package/lib/domains/component-set/web-models/ComponentSetForWeb.js +22 -0
  206. package/lib/domains/component-set/web-models/ComponentSetForWeb.js.map +1 -0
  207. package/lib/domains/content/index.d.ts +4 -0
  208. package/lib/domains/content/index.js +21 -0
  209. package/lib/domains/content/index.js.map +1 -0
  210. package/lib/domains/content/services/ComponentContentSchemaService.d.ts +9 -0
  211. package/lib/domains/content/services/ComponentContentSchemaService.js +45 -0
  212. package/lib/domains/content/services/ComponentContentSchemaService.js.map +1 -0
  213. package/lib/domains/content/services/ComponentContentSchemaService.spec.d.ts +1 -0
  214. package/lib/domains/content/services/ComponentContentSchemaService.spec.js +240 -0
  215. package/lib/domains/content/services/ComponentContentSchemaService.spec.js.map +1 -0
  216. package/lib/domains/content/services/ContentItemService.d.ts +7 -0
  217. package/lib/domains/content/services/ContentItemService.js +36 -0
  218. package/lib/domains/content/services/ContentItemService.js.map +1 -0
  219. package/lib/domains/content/services/ContentItemService.spec.d.ts +1 -0
  220. package/lib/domains/content/services/ContentItemService.spec.js +95 -0
  221. package/lib/domains/content/services/ContentItemService.spec.js.map +1 -0
  222. package/lib/domains/content/services/DynamicContentItemService.d.ts +8 -0
  223. package/lib/domains/content/services/DynamicContentItemService.js +31 -0
  224. package/lib/domains/content/services/DynamicContentItemService.js.map +1 -0
  225. package/lib/domains/content/services/DynamicContentItemService.spec.d.ts +1 -0
  226. package/lib/domains/content/services/DynamicContentItemService.spec.js +81 -0
  227. package/lib/domains/content/services/DynamicContentItemService.spec.js.map +1 -0
  228. package/lib/domains/content/utils/getContentSchemaName.d.ts +1 -0
  229. package/lib/domains/content/utils/getContentSchemaName.js +8 -0
  230. package/lib/domains/content/utils/getContentSchemaName.js.map +1 -0
  231. package/lib/domains/content/utils/getContentSchemaName.spec.d.ts +1 -0
  232. package/lib/domains/content/utils/getContentSchemaName.spec.js +9 -0
  233. package/lib/domains/content/utils/getContentSchemaName.spec.js.map +1 -0
  234. package/lib/domains/db/ComponentConnectionManager.d.ts +3 -0
  235. package/lib/domains/db/ComponentConnectionManager.js +3 -0
  236. package/lib/domains/db/ComponentConnectionManager.js.map +1 -0
  237. package/lib/domains/db/ComponentRepositories.d.ts +19 -0
  238. package/lib/domains/db/ComponentRepositories.js +23 -0
  239. package/lib/domains/db/ComponentRepositories.js.map +1 -0
  240. package/lib/domains/db/createConnectionManager.d.ts +5 -0
  241. package/lib/domains/db/createConnectionManager.js +16 -0
  242. package/lib/domains/db/createConnectionManager.js.map +1 -0
  243. package/lib/domains/db/index.d.ts +3 -0
  244. package/lib/domains/db/index.js +20 -0
  245. package/lib/domains/db/index.js.map +1 -0
  246. package/lib/domains/db/migration-list.d.ts +2 -0
  247. package/lib/domains/db/migration-list.js +19 -0
  248. package/lib/domains/db/migration-list.js.map +1 -0
  249. package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.d.ts +2 -0
  250. package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.js +24 -0
  251. package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.js.map +1 -0
  252. package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.spec.d.ts +5 -0
  253. package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.spec.js +24 -0
  254. package/lib/domains/job/ParsePartitionKey/ParsePartitionKey.spec.js.map +1 -0
  255. package/lib/domains/job/ParsePartitionKey/index.d.ts +1 -0
  256. package/lib/domains/job/ParsePartitionKey/index.js +18 -0
  257. package/lib/domains/job/ParsePartitionKey/index.js.map +1 -0
  258. package/lib/domains/job/constants/JobExecutionStatus.constants.d.ts +8 -0
  259. package/lib/domains/job/constants/JobExecutionStatus.constants.js +12 -0
  260. package/lib/domains/job/constants/JobExecutionStatus.constants.js.map +1 -0
  261. package/lib/domains/job/constants/QueryParams.d.ts +14 -0
  262. package/lib/domains/job/constants/QueryParams.js +19 -0
  263. package/lib/domains/job/constants/QueryParams.js.map +1 -0
  264. package/lib/domains/job/constants/Repository.constants.d.ts +12 -0
  265. package/lib/domains/job/constants/Repository.constants.js +15 -0
  266. package/lib/domains/job/constants/Repository.constants.js.map +1 -0
  267. package/lib/domains/job/core/dynamoClient.mock.d.ts +8 -0
  268. package/lib/domains/job/core/dynamoClient.mock.js +32 -0
  269. package/lib/domains/job/core/dynamoClient.mock.js.map +1 -0
  270. package/lib/domains/job/core/pagination/index.d.ts +3 -0
  271. package/lib/domains/job/core/pagination/index.js +20 -0
  272. package/lib/domains/job/core/pagination/index.js.map +1 -0
  273. package/lib/domains/job/core/pagination/model/PageQuery.d.ts +28 -0
  274. package/lib/domains/job/core/pagination/model/PageQuery.js +7 -0
  275. package/lib/domains/job/core/pagination/model/PageQuery.js.map +1 -0
  276. package/lib/domains/job/core/pagination/model/PaginationInfo.d.ts +35 -0
  277. package/lib/domains/job/core/pagination/model/PaginationInfo.js +7 -0
  278. package/lib/domains/job/core/pagination/model/PaginationInfo.js.map +1 -0
  279. package/lib/domains/job/core/pagination/model/PaginationKey.d.ts +2 -0
  280. package/lib/domains/job/core/pagination/model/PaginationKey.js +3 -0
  281. package/lib/domains/job/core/pagination/model/PaginationKey.js.map +1 -0
  282. package/lib/domains/job/core/pagination/model/PaginationLinks.d.ts +27 -0
  283. package/lib/domains/job/core/pagination/model/PaginationLinks.js +7 -0
  284. package/lib/domains/job/core/pagination/model/PaginationLinks.js.map +1 -0
  285. package/lib/domains/job/core/pagination/model/PaginationQueryParams.d.ts +14 -0
  286. package/lib/domains/job/core/pagination/model/PaginationQueryParams.js +3 -0
  287. package/lib/domains/job/core/pagination/model/PaginationQueryParams.js.map +1 -0
  288. package/lib/domains/job/core/pagination/model/PaginationQueryResponse.d.ts +24 -0
  289. package/lib/domains/job/core/pagination/model/PaginationQueryResponse.js +7 -0
  290. package/lib/domains/job/core/pagination/model/PaginationQueryResponse.js.map +1 -0
  291. package/lib/domains/job/core/pagination/model/PaginationResponse.d.ts +43 -0
  292. package/lib/domains/job/core/pagination/model/PaginationResponse.js +7 -0
  293. package/lib/domains/job/core/pagination/model/PaginationResponse.js.map +1 -0
  294. package/lib/domains/job/core/pagination/model/PaginationTypes.d.ts +39 -0
  295. package/lib/domains/job/core/pagination/model/PaginationTypes.js +29 -0
  296. package/lib/domains/job/core/pagination/model/PaginationTypes.js.map +1 -0
  297. package/lib/domains/job/core/pagination/model/index.d.ts +8 -0
  298. package/lib/domains/job/core/pagination/model/index.js +25 -0
  299. package/lib/domains/job/core/pagination/model/index.js.map +1 -0
  300. package/lib/domains/job/core/pagination/services/PaginationService.d.ts +41 -0
  301. package/lib/domains/job/core/pagination/services/PaginationService.js +129 -0
  302. package/lib/domains/job/core/pagination/services/PaginationService.js.map +1 -0
  303. package/lib/domains/job/core/pagination/services/PaginationService.spec.d.ts +5 -0
  304. package/lib/domains/job/core/pagination/services/PaginationService.spec.js +179 -0
  305. package/lib/domains/job/core/pagination/services/PaginationService.spec.js.map +1 -0
  306. package/lib/domains/job/core/pagination/services/index.d.ts +1 -0
  307. package/lib/domains/job/core/pagination/services/index.js +18 -0
  308. package/lib/domains/job/core/pagination/services/index.js.map +1 -0
  309. package/lib/domains/job/core/pagination/utils/PaginationUtils.d.ts +48 -0
  310. package/lib/domains/job/core/pagination/utils/PaginationUtils.js +139 -0
  311. package/lib/domains/job/core/pagination/utils/PaginationUtils.js.map +1 -0
  312. package/lib/domains/job/core/pagination/utils/PaginationUtils.spec.d.ts +5 -0
  313. package/lib/domains/job/core/pagination/utils/PaginationUtils.spec.js +212 -0
  314. package/lib/domains/job/core/pagination/utils/PaginationUtils.spec.js.map +1 -0
  315. package/lib/domains/job/core/pagination/utils/index.d.ts +1 -0
  316. package/lib/domains/job/core/pagination/utils/index.js +18 -0
  317. package/lib/domains/job/core/pagination/utils/index.js.map +1 -0
  318. package/lib/domains/job/errors/BadRequestError.d.ts +15 -0
  319. package/lib/domains/job/errors/BadRequestError.js +23 -0
  320. package/lib/domains/job/errors/BadRequestError.js.map +1 -0
  321. package/lib/domains/job/errors/Error.constants.d.ts +32 -0
  322. package/lib/domains/job/errors/Error.constants.js +36 -0
  323. package/lib/domains/job/errors/Error.constants.js.map +1 -0
  324. package/lib/domains/job/errors/ErrorWithHttpStatusCode.d.ts +16 -0
  325. package/lib/domains/job/errors/ErrorWithHttpStatusCode.js +23 -0
  326. package/lib/domains/job/errors/ErrorWithHttpStatusCode.js.map +1 -0
  327. package/lib/domains/job/errors/ExecutionStatusError.d.ts +3 -0
  328. package/lib/domains/job/errors/ExecutionStatusError.js +11 -0
  329. package/lib/domains/job/errors/ExecutionStatusError.js.map +1 -0
  330. package/lib/domains/job/errors/InternalServerError.d.ts +15 -0
  331. package/lib/domains/job/errors/InternalServerError.js +23 -0
  332. package/lib/domains/job/errors/InternalServerError.js.map +1 -0
  333. package/lib/domains/job/errors/NotFoundError.d.ts +14 -0
  334. package/lib/domains/job/errors/NotFoundError.js +22 -0
  335. package/lib/domains/job/errors/NotFoundError.js.map +1 -0
  336. package/lib/domains/job/errors/NotImplementedError.d.ts +15 -0
  337. package/lib/domains/job/errors/NotImplementedError.js +23 -0
  338. package/lib/domains/job/errors/NotImplementedError.js.map +1 -0
  339. package/lib/domains/job/errors/UnprocessableContent.d.ts +15 -0
  340. package/lib/domains/job/errors/UnprocessableContent.js +23 -0
  341. package/lib/domains/job/errors/UnprocessableContent.js.map +1 -0
  342. package/lib/domains/job/errors/index.d.ts +8 -0
  343. package/lib/domains/job/errors/index.js +25 -0
  344. package/lib/domains/job/errors/index.js.map +1 -0
  345. package/lib/domains/job/index.d.ts +16 -0
  346. package/lib/domains/job/index.js +33 -0
  347. package/lib/domains/job/index.js.map +1 -0
  348. package/lib/domains/job/manifest/JobManifestTypes.d.ts +126 -0
  349. package/lib/domains/job/manifest/JobManifestTypes.js +7 -0
  350. package/lib/domains/job/manifest/JobManifestTypes.js.map +1 -0
  351. package/lib/domains/job/manifest/JobManifestV1.d.ts +17 -0
  352. package/lib/domains/job/manifest/JobManifestV1.js +58 -0
  353. package/lib/domains/job/manifest/JobManifestV1.js.map +1 -0
  354. package/lib/domains/job/manifest/JobManifestV1.spec.d.ts +1 -0
  355. package/lib/domains/job/manifest/JobManifestV1.spec.js +136 -0
  356. package/lib/domains/job/manifest/JobManifestV1.spec.js.map +1 -0
  357. package/lib/domains/job/manifest/index.d.ts +5 -0
  358. package/lib/domains/job/manifest/index.js +22 -0
  359. package/lib/domains/job/manifest/index.js.map +1 -0
  360. package/lib/domains/job/manifest/mocks/JobManifest.mock.d.ts +7 -0
  361. package/lib/domains/job/manifest/mocks/JobManifest.mock.js +36 -0
  362. package/lib/domains/job/manifest/mocks/JobManifest.mock.js.map +1 -0
  363. package/lib/domains/job/manifest/mocks/JobManifestDto.mock.d.ts +7 -0
  364. package/lib/domains/job/manifest/mocks/JobManifestDto.mock.js +48 -0
  365. package/lib/domains/job/manifest/mocks/JobManifestDto.mock.js.map +1 -0
  366. package/lib/domains/job/manifest/mocks/JobManifestRecord.mock.d.ts +7 -0
  367. package/lib/domains/job/manifest/mocks/JobManifestRecord.mock.js +38 -0
  368. package/lib/domains/job/manifest/mocks/JobManifestRecord.mock.js.map +1 -0
  369. package/lib/domains/job/manifest/mocks/JobManifestRequest.mock.d.ts +6 -0
  370. package/lib/domains/job/manifest/mocks/JobManifestRequest.mock.js +29 -0
  371. package/lib/domains/job/manifest/mocks/JobManifestRequest.mock.js.map +1 -0
  372. package/lib/domains/job/model/Base/Base.d.ts +40 -0
  373. package/lib/domains/job/model/Base/Base.js +3 -0
  374. package/lib/domains/job/model/Base/Base.js.map +1 -0
  375. package/lib/domains/job/model/Base/index.d.ts +1 -0
  376. package/lib/domains/job/model/Base/index.js +18 -0
  377. package/lib/domains/job/model/Base/index.js.map +1 -0
  378. package/lib/domains/job/model/Job/Job.d.ts +85 -0
  379. package/lib/domains/job/model/Job/Job.js +7 -0
  380. package/lib/domains/job/model/Job/Job.js.map +1 -0
  381. package/lib/domains/job/model/Job/index.d.ts +5 -0
  382. package/lib/domains/job/model/Job/index.js +22 -0
  383. package/lib/domains/job/model/Job/index.js.map +1 -0
  384. package/lib/domains/job/model/Job/mocks/Job.mock.d.ts +7 -0
  385. package/lib/domains/job/model/Job/mocks/Job.mock.js +28 -0
  386. package/lib/domains/job/model/Job/mocks/Job.mock.js.map +1 -0
  387. package/lib/domains/job/model/Job/mocks/JobDto.mock.d.ts +7 -0
  388. package/lib/domains/job/model/Job/mocks/JobDto.mock.js +39 -0
  389. package/lib/domains/job/model/Job/mocks/JobDto.mock.js.map +1 -0
  390. package/lib/domains/job/model/Job/mocks/JobRecord.mock.d.ts +7 -0
  391. package/lib/domains/job/model/Job/mocks/JobRecord.mock.js +29 -0
  392. package/lib/domains/job/model/Job/mocks/JobRecord.mock.js.map +1 -0
  393. package/lib/domains/job/model/Job/mocks/JobRequest.mock.d.ts +6 -0
  394. package/lib/domains/job/model/Job/mocks/JobRequest.mock.js +21 -0
  395. package/lib/domains/job/model/Job/mocks/JobRequest.mock.js.map +1 -0
  396. package/lib/domains/job/model/JobContext/JobContext.d.ts +87 -0
  397. package/lib/domains/job/model/JobContext/JobContext.js +7 -0
  398. package/lib/domains/job/model/JobContext/JobContext.js.map +1 -0
  399. package/lib/domains/job/model/JobContext/index.d.ts +5 -0
  400. package/lib/domains/job/model/JobContext/index.js +22 -0
  401. package/lib/domains/job/model/JobContext/index.js.map +1 -0
  402. package/lib/domains/job/model/JobContext/mocks/JobContext.mock.d.ts +7 -0
  403. package/lib/domains/job/model/JobContext/mocks/JobContext.mock.js +35 -0
  404. package/lib/domains/job/model/JobContext/mocks/JobContext.mock.js.map +1 -0
  405. package/lib/domains/job/model/JobContext/mocks/JobContextDto.mock.d.ts +7 -0
  406. package/lib/domains/job/model/JobContext/mocks/JobContextDto.mock.js +46 -0
  407. package/lib/domains/job/model/JobContext/mocks/JobContextDto.mock.js.map +1 -0
  408. package/lib/domains/job/model/JobContext/mocks/JobContextRecord.mock.d.ts +7 -0
  409. package/lib/domains/job/model/JobContext/mocks/JobContextRecord.mock.js +34 -0
  410. package/lib/domains/job/model/JobContext/mocks/JobContextRecord.mock.js.map +1 -0
  411. package/lib/domains/job/model/JobContext/mocks/JobContextRequest.mock.d.ts +6 -0
  412. package/lib/domains/job/model/JobContext/mocks/JobContextRequest.mock.js +25 -0
  413. package/lib/domains/job/model/JobContext/mocks/JobContextRequest.mock.js.map +1 -0
  414. package/lib/domains/job/model/JobExecution/JobExecution.d.ts +189 -0
  415. package/lib/domains/job/model/JobExecution/JobExecution.js +7 -0
  416. package/lib/domains/job/model/JobExecution/JobExecution.js.map +1 -0
  417. package/lib/domains/job/model/JobExecution/index.d.ts +5 -0
  418. package/lib/domains/job/model/JobExecution/index.js +22 -0
  419. package/lib/domains/job/model/JobExecution/index.js.map +1 -0
  420. package/lib/domains/job/model/JobExecution/mocks/JobExecution.mock.d.ts +7 -0
  421. package/lib/domains/job/model/JobExecution/mocks/JobExecution.mock.js +45 -0
  422. package/lib/domains/job/model/JobExecution/mocks/JobExecution.mock.js.map +1 -0
  423. package/lib/domains/job/model/JobExecution/mocks/JobExecutionDto.mock.d.ts +7 -0
  424. package/lib/domains/job/model/JobExecution/mocks/JobExecutionDto.mock.js +64 -0
  425. package/lib/domains/job/model/JobExecution/mocks/JobExecutionDto.mock.js.map +1 -0
  426. package/lib/domains/job/model/JobExecution/mocks/JobExecutionRecord.mock.d.ts +7 -0
  427. package/lib/domains/job/model/JobExecution/mocks/JobExecutionRecord.mock.js +48 -0
  428. package/lib/domains/job/model/JobExecution/mocks/JobExecutionRecord.mock.js.map +1 -0
  429. package/lib/domains/job/model/JobExecution/mocks/JobExecutionRequest.mock.d.ts +6 -0
  430. package/lib/domains/job/model/JobExecution/mocks/JobExecutionRequest.mock.js +25 -0
  431. package/lib/domains/job/model/JobExecution/mocks/JobExecutionRequest.mock.js.map +1 -0
  432. package/lib/domains/job/repository/AbstractRepository.d.ts +73 -0
  433. package/lib/domains/job/repository/AbstractRepository.js +174 -0
  434. package/lib/domains/job/repository/AbstractRepository.js.map +1 -0
  435. package/lib/domains/job/repository/JobContextRepository/JobContextRepository.d.ts +24 -0
  436. package/lib/domains/job/repository/JobContextRepository/JobContextRepository.js +169 -0
  437. package/lib/domains/job/repository/JobContextRepository/JobContextRepository.js.map +1 -0
  438. package/lib/domains/job/repository/JobContextRepository/JobContextRepository.spec.d.ts +5 -0
  439. package/lib/domains/job/repository/JobContextRepository/JobContextRepository.spec.js +246 -0
  440. package/lib/domains/job/repository/JobContextRepository/JobContextRepository.spec.js.map +1 -0
  441. package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.d.ts +47 -0
  442. package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.js +276 -0
  443. package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.js.map +1 -0
  444. package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.d.ts +5 -0
  445. package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.js +296 -0
  446. package/lib/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.js.map +1 -0
  447. package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.d.ts +16 -0
  448. package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.js +133 -0
  449. package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.js.map +1 -0
  450. package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.spec.d.ts +5 -0
  451. package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.spec.js +162 -0
  452. package/lib/domains/job/repository/JobManifestRepository/JobManifestRepository.spec.js.map +1 -0
  453. package/lib/domains/job/repository/JobRepository/JobRepository.d.ts +30 -0
  454. package/lib/domains/job/repository/JobRepository/JobRepository.js +189 -0
  455. package/lib/domains/job/repository/JobRepository/JobRepository.js.map +1 -0
  456. package/lib/domains/job/repository/JobRepository/JobRepository.spec.d.ts +5 -0
  457. package/lib/domains/job/repository/JobRepository/JobRepository.spec.js +270 -0
  458. package/lib/domains/job/repository/JobRepository/JobRepository.spec.js.map +1 -0
  459. package/lib/domains/job/repository/index.d.ts +5 -0
  460. package/lib/domains/job/repository/index.js +22 -0
  461. package/lib/domains/job/repository/index.js.map +1 -0
  462. package/lib/domains/job/repository/mocks/mockIoc.d.ts +5 -0
  463. package/lib/domains/job/repository/mocks/mockIoc.js +40 -0
  464. package/lib/domains/job/repository/mocks/mockIoc.js.map +1 -0
  465. package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.d.ts +13 -0
  466. package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.defs.d.ts +39 -0
  467. package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.defs.js +3 -0
  468. package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.defs.js.map +1 -0
  469. package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.js +139 -0
  470. package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.js.map +1 -0
  471. package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.spec.d.ts +1 -0
  472. package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.spec.js +78 -0
  473. package/lib/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.spec.js.map +1 -0
  474. package/lib/domains/job/services/index.d.ts +1 -0
  475. package/lib/domains/job/services/index.js +18 -0
  476. package/lib/domains/job/services/index.js.map +1 -0
  477. package/lib/domains/job/singletonProvider.d.ts +6 -0
  478. package/lib/domains/job/singletonProvider.js +14 -0
  479. package/lib/domains/job/singletonProvider.js.map +1 -0
  480. package/lib/domains/job/transientProvider.d.ts +6 -0
  481. package/lib/domains/job/transientProvider.js +14 -0
  482. package/lib/domains/job/transientProvider.js.map +1 -0
  483. package/lib/domains/job/utils/SlackClient/SlackClient.d.ts +44 -0
  484. package/lib/domains/job/utils/SlackClient/SlackClient.js +113 -0
  485. package/lib/domains/job/utils/SlackClient/SlackClient.js.map +1 -0
  486. package/lib/domains/job/utils/SlackClient/SlackClient.spec.d.ts +5 -0
  487. package/lib/domains/job/utils/SlackClient/SlackClient.spec.js +116 -0
  488. package/lib/domains/job/utils/SlackClient/SlackClient.spec.js.map +1 -0
  489. package/lib/domains/job/utils/SlackClient/types/SlackClient.types.d.ts +56 -0
  490. package/lib/domains/job/utils/SlackClient/types/SlackClient.types.js +28 -0
  491. package/lib/domains/job/utils/SlackClient/types/SlackClient.types.js.map +1 -0
  492. package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.d.ts +9 -0
  493. package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.js +21 -0
  494. package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.js.map +1 -0
  495. package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.spec.d.ts +5 -0
  496. package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.spec.js +26 -0
  497. package/lib/domains/job/utils/SortByTimeQueued/SortByTimeQueued.spec.js.map +1 -0
  498. package/lib/domains/job/utils/index.d.ts +3 -0
  499. package/lib/domains/job/utils/index.js +20 -0
  500. package/lib/domains/job/utils/index.js.map +1 -0
  501. package/lib/domains/manifest/AbstractManifest.d.ts +38 -0
  502. package/lib/domains/manifest/AbstractManifest.js +45 -0
  503. package/lib/domains/manifest/AbstractManifest.js.map +1 -0
  504. package/lib/domains/manifest/ManifestModel.d.ts +7 -0
  505. package/lib/domains/manifest/ManifestModel.js +3 -0
  506. package/lib/domains/manifest/ManifestModel.js.map +1 -0
  507. package/lib/domains/manifest/ManifestV1.d.ts +18 -0
  508. package/lib/domains/manifest/ManifestV1.js +124 -0
  509. package/lib/domains/manifest/ManifestV1.js.map +1 -0
  510. package/lib/domains/manifest/ManifestV1.spec.d.ts +1 -0
  511. package/lib/domains/manifest/ManifestV1.spec.js +347 -0
  512. package/lib/domains/manifest/ManifestV1.spec.js.map +1 -0
  513. package/lib/domains/manifest/errors/ManifestLocationError.d.ts +5 -0
  514. package/lib/domains/manifest/errors/ManifestLocationError.js +13 -0
  515. package/lib/domains/manifest/errors/ManifestLocationError.js.map +1 -0
  516. package/lib/domains/manifest/errors/ManifestValidationError.d.ts +3 -0
  517. package/lib/domains/manifest/errors/ManifestValidationError.js +12 -0
  518. package/lib/domains/manifest/errors/ManifestValidationError.js.map +1 -0
  519. package/lib/domains/manifest/index.d.ts +16 -0
  520. package/lib/domains/manifest/index.js +33 -0
  521. package/lib/domains/manifest/index.js.map +1 -0
  522. package/lib/domains/manifest/services/AbstractManifestService.d.ts +49 -0
  523. package/lib/domains/manifest/services/AbstractManifestService.js +235 -0
  524. package/lib/domains/manifest/services/AbstractManifestService.js.map +1 -0
  525. package/lib/domains/manifest/services/AbstractManifestService.spec.d.ts +1 -0
  526. package/lib/domains/manifest/services/AbstractManifestService.spec.js +301 -0
  527. package/lib/domains/manifest/services/AbstractManifestService.spec.js.map +1 -0
  528. package/lib/domains/manifest/services/ComponentFunctionService.d.ts +35 -0
  529. package/lib/domains/manifest/services/ComponentFunctionService.js +129 -0
  530. package/lib/domains/manifest/services/ComponentFunctionService.js.map +1 -0
  531. package/lib/domains/manifest/services/ComponentFunctionService.spec.d.ts +1 -0
  532. package/lib/domains/manifest/services/ComponentFunctionService.spec.js +567 -0
  533. package/lib/domains/manifest/services/ComponentFunctionService.spec.js.map +1 -0
  534. package/lib/domains/manifest/services/ComponentInputValidationService.d.ts +5 -0
  535. package/lib/domains/manifest/services/ComponentInputValidationService.js +11 -0
  536. package/lib/domains/manifest/services/ComponentInputValidationService.js.map +1 -0
  537. package/lib/domains/manifest/services/ComponentSchemaValidationService.d.ts +5 -0
  538. package/lib/domains/manifest/services/ComponentSchemaValidationService.js +11 -0
  539. package/lib/domains/manifest/services/ComponentSchemaValidationService.js.map +1 -0
  540. package/lib/domains/manifest/services/JobFunctionService.d.ts +12 -0
  541. package/lib/domains/manifest/services/JobFunctionService.js +23 -0
  542. package/lib/domains/manifest/services/JobFunctionService.js.map +1 -0
  543. package/lib/domains/manifest/services/JobFunctionService.spec.d.ts +1 -0
  544. package/lib/domains/manifest/services/JobFunctionService.spec.js +132 -0
  545. package/lib/domains/manifest/services/JobFunctionService.spec.js.map +1 -0
  546. package/lib/domains/manifest/services/ManifestServiceForDev.d.ts +18 -0
  547. package/lib/domains/manifest/services/ManifestServiceForDev.js +83 -0
  548. package/lib/domains/manifest/services/ManifestServiceForDev.js.map +1 -0
  549. package/lib/domains/manifest/services/ManifestServiceForDev.spec.d.ts +1 -0
  550. package/lib/domains/manifest/services/ManifestServiceForDev.spec.js +184 -0
  551. package/lib/domains/manifest/services/ManifestServiceForDev.spec.js.map +1 -0
  552. package/lib/domains/manifest/services/ManifestServiceForProduction.d.ts +12 -0
  553. package/lib/domains/manifest/services/ManifestServiceForProduction.js +81 -0
  554. package/lib/domains/manifest/services/ManifestServiceForProduction.js.map +1 -0
  555. package/lib/domains/manifest/services/ManifestServiceForProduction.spec.d.ts +1 -0
  556. package/lib/domains/manifest/services/ManifestServiceForProduction.spec.js +81 -0
  557. package/lib/domains/manifest/services/ManifestServiceForProduction.spec.js.map +1 -0
  558. package/lib/domains/manifest/utils/assertFuncEntryFilesAreValid.d.ts +3 -0
  559. package/lib/domains/manifest/utils/assertFuncEntryFilesAreValid.js +14 -0
  560. package/lib/domains/manifest/utils/assertFuncEntryFilesAreValid.js.map +1 -0
  561. package/lib/domains/manifest/utils/assertStaticFilesAreValid.d.ts +3 -0
  562. package/lib/domains/manifest/utils/assertStaticFilesAreValid.js +27 -0
  563. package/lib/domains/manifest/utils/assertStaticFilesAreValid.js.map +1 -0
  564. package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.d.ts +2 -0
  565. package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.js +16 -0
  566. package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.js.map +1 -0
  567. package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.spec.d.ts +1 -0
  568. package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.spec.js +111 -0
  569. package/lib/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.spec.js.map +1 -0
  570. package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.d.ts +3 -0
  571. package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.js +28 -0
  572. package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.js.map +1 -0
  573. package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.spec.d.ts +1 -0
  574. package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.spec.js +115 -0
  575. package/lib/domains/manifest/utils/getAndAssertJobManifestVersion.spec.js.map +1 -0
  576. package/lib/domains/manifest/utils/getAndAssertManifestVersion.d.ts +3 -0
  577. package/lib/domains/manifest/utils/getAndAssertManifestVersion.js +23 -0
  578. package/lib/domains/manifest/utils/getAndAssertManifestVersion.js.map +1 -0
  579. package/lib/domains/manifest/utils/getAndAssertManifestVersion.spec.d.ts +1 -0
  580. package/lib/domains/manifest/utils/getAndAssertManifestVersion.spec.js +109 -0
  581. package/lib/domains/manifest/utils/getAndAssertManifestVersion.spec.js.map +1 -0
  582. package/lib/domains/manifest/utils/isValidManifestVersion.d.ts +2 -0
  583. package/lib/domains/manifest/utils/isValidManifestVersion.js +12 -0
  584. package/lib/domains/manifest/utils/isValidManifestVersion.js.map +1 -0
  585. package/lib/domains/manifest/utils/isValidManifestVersion.spec.d.ts +1 -0
  586. package/lib/domains/manifest/utils/isValidManifestVersion.spec.js +19 -0
  587. package/lib/domains/manifest/utils/isValidManifestVersion.spec.js.map +1 -0
  588. package/lib/domains/url/convertFunctionStaticFilesToFqdn.d.ts +1 -0
  589. package/lib/domains/url/convertFunctionStaticFilesToFqdn.js +22 -0
  590. package/lib/domains/url/convertFunctionStaticFilesToFqdn.js.map +1 -0
  591. package/lib/domains/url/convertFunctionStaticFilesToFqdn.spec.d.ts +1 -0
  592. package/lib/domains/url/convertFunctionStaticFilesToFqdn.spec.js +16 -0
  593. package/lib/domains/url/convertFunctionStaticFilesToFqdn.spec.js.map +1 -0
  594. package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.d.ts +1 -0
  595. package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.js +22 -0
  596. package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.js.map +1 -0
  597. package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.spec.d.ts +1 -0
  598. package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.spec.js +16 -0
  599. package/lib/domains/url/convertFunctionStaticFilesToFqdnForPreview.spec.js.map +1 -0
  600. package/lib/domains/url/index.d.ts +1 -0
  601. package/lib/domains/url/index.js +18 -0
  602. package/lib/domains/url/index.js.map +1 -0
  603. package/lib/index.d.ts +9 -0
  604. package/lib/index.js +39 -0
  605. package/lib/index.js.map +1 -0
  606. package/lib/jest-global-setup.d.ts +3 -0
  607. package/lib/jest-global-setup.js +22 -0
  608. package/lib/jest-global-setup.js.map +1 -0
  609. package/package.json +59 -0
  610. package/src/TestHelpers.ts +111 -0
  611. package/src/custom-types.d.ts +7 -0
  612. package/src/domains/__test__/createPackage.ts +48 -0
  613. package/src/domains/__test__/loadAllUnitTestComponents.ts +73 -0
  614. package/src/domains/component/component-context/__mocks__/mockedManifestModel.ts +30 -0
  615. package/src/domains/component/component-context/__mocks__/mockedUriObj.ts +38 -0
  616. package/src/domains/component/component-context/__mocks__/mockedUriObjPreview.ts +38 -0
  617. package/src/domains/component/component-context/createComponentContextualFunctions.spec.ts +299 -0
  618. package/src/domains/component/component-context/createComponentContextualFunctions.ts +108 -0
  619. package/src/domains/component/errors/ComponentError.ts +22 -0
  620. package/src/domains/component/errors/JobError.ts +20 -0
  621. package/src/domains/component/index.ts +17 -0
  622. package/src/domains/component/models/Component.spec.ts +21 -0
  623. package/src/domains/component/models/Component.ts +16 -0
  624. package/src/domains/component/models/ComponentVersion.spec.ts +77 -0
  625. package/src/domains/component/models/ComponentVersion.ts +55 -0
  626. package/src/domains/component/repositories/ComponentRepository.integration.spec.ts +148 -0
  627. package/src/domains/component/repositories/ComponentRepository.ts +37 -0
  628. package/src/domains/component/repositories/ComponentVersionRepository.integration.spec.ts +523 -0
  629. package/src/domains/component/repositories/ComponentVersionRepository.ts +138 -0
  630. package/src/domains/component/services/ComponentService.integration.spec.ts +721 -0
  631. package/src/domains/component/services/ComponentService.ts +350 -0
  632. package/src/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.spec.ts +78 -0
  633. package/src/domains/component/services/content-item-uri-resolver/ComponentContentUriResolverForPreview.ts +18 -0
  634. package/src/domains/component/utils/getComponentFileSystemFolder.spec.ts +8 -0
  635. package/src/domains/component/utils/getComponentFileSystemFolder.ts +5 -0
  636. package/src/domains/component/utils/getComponentName.spec.ts +7 -0
  637. package/src/domains/component/utils/getComponentName.ts +3 -0
  638. package/src/domains/component/utils/moveFilesAndDirectories.spec.ts +62 -0
  639. package/src/domains/component/utils/moveFilesAndDirectories.ts +27 -0
  640. package/src/domains/component/web-models/ComponentForWeb.ts +11 -0
  641. package/src/domains/component/web-models/ComponentVersionWebModel.ts +16 -0
  642. package/src/domains/component/web-models/ComponentsForWeb.ts +17 -0
  643. package/src/domains/component-set/errors/InvalidEnvironmentVariablesError.ts +11 -0
  644. package/src/domains/component-set/index.ts +18 -0
  645. package/src/domains/component-set/models/ComponentSet.spec.ts +66 -0
  646. package/src/domains/component-set/models/ComponentSet.ts +67 -0
  647. package/src/domains/component-set/models/ComponentSetComponentVersion.spec.ts +106 -0
  648. package/src/domains/component-set/models/ComponentSetComponentVersion.ts +54 -0
  649. package/src/domains/component-set/models/ComponentSetComponentVersionEditable.spec.ts +82 -0
  650. package/src/domains/component-set/models/ComponentSetComponentVersionEditable.ts +46 -0
  651. package/src/domains/component-set/models/ComponentSetComponentVersionExcluded.spec.ts +46 -0
  652. package/src/domains/component-set/models/ComponentSetComponentVersionExcluded.ts +26 -0
  653. package/src/domains/component-set/models/ComponentSetRule.spec.ts +39 -0
  654. package/src/domains/component-set/models/ComponentSetRule.ts +37 -0
  655. package/src/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.integration.spec.ts +172 -0
  656. package/src/domains/component-set/repositories/ComponentSetComponentVersionEditableRepository.ts +47 -0
  657. package/src/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.integration.spec.ts +172 -0
  658. package/src/domains/component-set/repositories/ComponentSetComponentVersionExcludedRepository.ts +47 -0
  659. package/src/domains/component-set/repositories/ComponentSetComponentVersionRepository.integration.spec.ts +229 -0
  660. package/src/domains/component-set/repositories/ComponentSetComponentVersionRepository.ts +37 -0
  661. package/src/domains/component-set/repositories/ComponentSetRepository.integration.spec.ts +199 -0
  662. package/src/domains/component-set/repositories/ComponentSetRepository.ts +68 -0
  663. package/src/domains/component-set/repositories/ComponentSetRuleRepository.integration.spec.ts +107 -0
  664. package/src/domains/component-set/repositories/ComponentSetRuleRepository.ts +40 -0
  665. package/src/domains/component-set/services/ComponentSetRuleService.integration.spec.ts +137 -0
  666. package/src/domains/component-set/services/ComponentSetRuleService.ts +34 -0
  667. package/src/domains/component-set/services/ComponentSetService.spec.ts +144 -0
  668. package/src/domains/component-set/services/ComponentSetService.ts +82 -0
  669. package/src/domains/component-set/services/ComponentSetServiceForLocalDev.spec.ts +209 -0
  670. package/src/domains/component-set/services/ComponentSetServiceForLocalDev.ts +111 -0
  671. package/src/domains/component-set/services/ComponentSetServiceForProduction.integration.spec.ts +2898 -0
  672. package/src/domains/component-set/services/ComponentSetServiceForProduction.ts +839 -0
  673. package/src/domains/component-set/services/EnvironmentVariables.ts +1 -0
  674. package/src/domains/component-set/services/Headers.ts +1 -0
  675. package/src/domains/component-set/services/RuntimeComponentSet.ts +7 -0
  676. package/src/domains/component-set/web-models/ComponentSetComponentVersionForWeb.ts +7 -0
  677. package/src/domains/component-set/web-models/ComponentSetForWeb.ts +83 -0
  678. package/src/domains/content/index.ts +4 -0
  679. package/src/domains/content/services/ComponentContentSchemaService.spec.ts +264 -0
  680. package/src/domains/content/services/ComponentContentSchemaService.ts +53 -0
  681. package/src/domains/content/services/ContentItemService.spec.ts +108 -0
  682. package/src/domains/content/services/ContentItemService.ts +34 -0
  683. package/src/domains/content/services/DynamicContentItemService.spec.ts +97 -0
  684. package/src/domains/content/services/DynamicContentItemService.ts +30 -0
  685. package/src/domains/content/utils/getContentSchemaName.spec.ts +7 -0
  686. package/src/domains/content/utils/getContentSchemaName.ts +7 -0
  687. package/src/domains/db/ComponentConnectionManager.ts +4 -0
  688. package/src/domains/db/ComponentRepositories.ts +31 -0
  689. package/src/domains/db/createConnectionManager.ts +24 -0
  690. package/src/domains/db/index.ts +3 -0
  691. package/src/domains/db/migration-list.ts +16 -0
  692. package/src/domains/job/ParsePartitionKey/ParsePartitionKey.spec.ts +27 -0
  693. package/src/domains/job/ParsePartitionKey/ParsePartitionKey.ts +19 -0
  694. package/src/domains/job/ParsePartitionKey/index.ts +1 -0
  695. package/src/domains/job/constants/JobExecutionStatus.constants.ts +9 -0
  696. package/src/domains/job/constants/QueryParams.ts +16 -0
  697. package/src/domains/job/constants/Repository.constants.ts +18 -0
  698. package/src/domains/job/core/dynamoClient.mock.ts +34 -0
  699. package/src/domains/job/core/pagination/index.ts +3 -0
  700. package/src/domains/job/core/pagination/model/PageQuery.ts +31 -0
  701. package/src/domains/job/core/pagination/model/PaginationInfo.ts +40 -0
  702. package/src/domains/job/core/pagination/model/PaginationKey.ts +4 -0
  703. package/src/domains/job/core/pagination/model/PaginationLinks.ts +30 -0
  704. package/src/domains/job/core/pagination/model/PaginationQueryParams.ts +15 -0
  705. package/src/domains/job/core/pagination/model/PaginationQueryResponse.ts +27 -0
  706. package/src/domains/job/core/pagination/model/PaginationResponse.ts +48 -0
  707. package/src/domains/job/core/pagination/model/PaginationTypes.ts +45 -0
  708. package/src/domains/job/core/pagination/model/index.ts +8 -0
  709. package/src/domains/job/core/pagination/services/PaginationService.spec.ts +248 -0
  710. package/src/domains/job/core/pagination/services/PaginationService.ts +142 -0
  711. package/src/domains/job/core/pagination/services/index.ts +1 -0
  712. package/src/domains/job/core/pagination/utils/PaginationUtils.spec.ts +263 -0
  713. package/src/domains/job/core/pagination/utils/PaginationUtils.ts +156 -0
  714. package/src/domains/job/core/pagination/utils/index.ts +1 -0
  715. package/src/domains/job/errors/BadRequestError.ts +19 -0
  716. package/src/domains/job/errors/Error.constants.ts +34 -0
  717. package/src/domains/job/errors/ErrorWithHttpStatusCode.ts +16 -0
  718. package/src/domains/job/errors/ExecutionStatusError.ts +3 -0
  719. package/src/domains/job/errors/InternalServerError.ts +19 -0
  720. package/src/domains/job/errors/NotFoundError.ts +19 -0
  721. package/src/domains/job/errors/NotImplementedError.ts +19 -0
  722. package/src/domains/job/errors/UnprocessableContent.ts +19 -0
  723. package/src/domains/job/errors/index.ts +8 -0
  724. package/src/domains/job/index.ts +21 -0
  725. package/src/domains/job/manifest/JobManifestTypes.ts +145 -0
  726. package/src/domains/job/manifest/JobManifestV1.spec.ts +148 -0
  727. package/src/domains/job/manifest/JobManifestV1.ts +60 -0
  728. package/src/domains/job/manifest/index.ts +5 -0
  729. package/src/domains/job/manifest/mocks/JobManifest.mock.ts +35 -0
  730. package/src/domains/job/manifest/mocks/JobManifestDto.mock.ts +46 -0
  731. package/src/domains/job/manifest/mocks/JobManifestRecord.mock.ts +37 -0
  732. package/src/domains/job/manifest/mocks/JobManifestRequest.mock.ts +30 -0
  733. package/src/domains/job/model/Base/Base.ts +44 -0
  734. package/src/domains/job/model/Base/index.ts +1 -0
  735. package/src/domains/job/model/Job/Job.ts +98 -0
  736. package/src/domains/job/model/Job/index.ts +5 -0
  737. package/src/domains/job/model/Job/mocks/Job.mock.ts +26 -0
  738. package/src/domains/job/model/Job/mocks/JobDto.mock.ts +37 -0
  739. package/src/domains/job/model/Job/mocks/JobRecord.mock.ts +28 -0
  740. package/src/domains/job/model/Job/mocks/JobRequest.mock.ts +20 -0
  741. package/src/domains/job/model/JobContext/JobContext.ts +101 -0
  742. package/src/domains/job/model/JobContext/index.ts +5 -0
  743. package/src/domains/job/model/JobContext/mocks/JobContext.mock.ts +34 -0
  744. package/src/domains/job/model/JobContext/mocks/JobContextDto.mock.ts +46 -0
  745. package/src/domains/job/model/JobContext/mocks/JobContextRecord.mock.ts +32 -0
  746. package/src/domains/job/model/JobContext/mocks/JobContextRequest.mock.ts +26 -0
  747. package/src/domains/job/model/JobExecution/JobExecution.ts +220 -0
  748. package/src/domains/job/model/JobExecution/index.ts +5 -0
  749. package/src/domains/job/model/JobExecution/mocks/JobExecution.mock.ts +43 -0
  750. package/src/domains/job/model/JobExecution/mocks/JobExecutionDto.mock.ts +62 -0
  751. package/src/domains/job/model/JobExecution/mocks/JobExecutionRecord.mock.ts +47 -0
  752. package/src/domains/job/model/JobExecution/mocks/JobExecutionRequest.mock.ts +26 -0
  753. package/src/domains/job/repository/AbstractRepository.ts +219 -0
  754. package/src/domains/job/repository/JobContextRepository/JobContextRepository.spec.ts +301 -0
  755. package/src/domains/job/repository/JobContextRepository/JobContextRepository.ts +168 -0
  756. package/src/domains/job/repository/JobExecutionRepository/JobExecutionRepository.spec.ts +371 -0
  757. package/src/domains/job/repository/JobExecutionRepository/JobExecutionRepository.ts +293 -0
  758. package/src/domains/job/repository/JobManifestRepository/JobManifestRepository.spec.ts +222 -0
  759. package/src/domains/job/repository/JobManifestRepository/JobManifestRepository.ts +120 -0
  760. package/src/domains/job/repository/JobRepository/JobRepository.spec.ts +337 -0
  761. package/src/domains/job/repository/JobRepository/JobRepository.ts +188 -0
  762. package/src/domains/job/repository/index.ts +5 -0
  763. package/src/domains/job/repository/mocks/mockIoc.ts +42 -0
  764. package/src/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.defs.ts +40 -0
  765. package/src/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.spec.ts +95 -0
  766. package/src/domains/job/services/JobExecutionTaskService/JobExecutionTaskService.ts +138 -0
  767. package/src/domains/job/services/index.ts +1 -0
  768. package/src/domains/job/singletonProvider.ts +12 -0
  769. package/src/domains/job/transientProvider.ts +12 -0
  770. package/src/domains/job/utils/SlackClient/SlackClient.spec.ts +176 -0
  771. package/src/domains/job/utils/SlackClient/SlackClient.ts +132 -0
  772. package/src/domains/job/utils/SlackClient/types/SlackClient.types.ts +70 -0
  773. package/src/domains/job/utils/SortByTimeQueued/SortByTimeQueued.spec.ts +28 -0
  774. package/src/domains/job/utils/SortByTimeQueued/SortByTimeQueued.ts +21 -0
  775. package/src/domains/job/utils/index.ts +3 -0
  776. package/src/domains/manifest/AbstractManifest.ts +57 -0
  777. package/src/domains/manifest/ManifestModel.ts +9 -0
  778. package/src/domains/manifest/ManifestV1.spec.ts +436 -0
  779. package/src/domains/manifest/ManifestV1.ts +146 -0
  780. package/src/domains/manifest/errors/ManifestLocationError.ts +9 -0
  781. package/src/domains/manifest/errors/ManifestValidationError.ts +7 -0
  782. package/src/domains/manifest/index.ts +18 -0
  783. package/src/domains/manifest/services/AbstractManifestService.spec.ts +427 -0
  784. package/src/domains/manifest/services/AbstractManifestService.ts +316 -0
  785. package/src/domains/manifest/services/ComponentFunctionService.spec.ts +683 -0
  786. package/src/domains/manifest/services/ComponentFunctionService.ts +178 -0
  787. package/src/domains/manifest/services/ComponentInputValidationService.ts +22 -0
  788. package/src/domains/manifest/services/ComponentSchemaValidationService.ts +22 -0
  789. package/src/domains/manifest/services/JobFunctionService.spec.ts +165 -0
  790. package/src/domains/manifest/services/JobFunctionService.ts +25 -0
  791. package/src/domains/manifest/services/ManifestServiceForDev.spec.ts +199 -0
  792. package/src/domains/manifest/services/ManifestServiceForDev.ts +96 -0
  793. package/src/domains/manifest/services/ManifestServiceForProduction.spec.ts +90 -0
  794. package/src/domains/manifest/services/ManifestServiceForProduction.ts +98 -0
  795. package/src/domains/manifest/utils/assertFuncEntryFilesAreValid.ts +19 -0
  796. package/src/domains/manifest/utils/assertStaticFilesAreValid.ts +37 -0
  797. package/src/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.spec.ts +121 -0
  798. package/src/domains/manifest/utils/assertStaticFilesHaveAbsolutePath.ts +15 -0
  799. package/src/domains/manifest/utils/getAndAssertJobManifestVersion.spec.ts +145 -0
  800. package/src/domains/manifest/utils/getAndAssertJobManifestVersion.ts +31 -0
  801. package/src/domains/manifest/utils/getAndAssertManifestVersion.spec.ts +134 -0
  802. package/src/domains/manifest/utils/getAndAssertManifestVersion.ts +27 -0
  803. package/src/domains/manifest/utils/isValidManifestVersion.spec.ts +19 -0
  804. package/src/domains/manifest/utils/isValidManifestVersion.ts +9 -0
  805. package/src/domains/url/convertFunctionStaticFilesToFqdn.spec.ts +24 -0
  806. package/src/domains/url/convertFunctionStaticFilesToFqdn.ts +25 -0
  807. package/src/domains/url/convertFunctionStaticFilesToFqdnForPreview.spec.ts +48 -0
  808. package/src/domains/url/convertFunctionStaticFilesToFqdnForPreview.ts +25 -0
  809. package/src/domains/url/index.ts +1 -0
  810. package/src/index.ts +10 -0
  811. package/src/jest-global-setup.ts +20 -0
  812. package/src/migrations/20220704054051_initial.sql +19 -0
  813. package/src/migrations/20220718172237_adding_component_sets.sql +23 -0
  814. package/src/migrations/20220728113941_add_env_vars_field.sql +1 -0
  815. package/src/migrations/20220817113300_removing_null_props_from_jsonb.sql +41 -0
  816. package/src/migrations/20221027151225_dummy.sql +2 -0
  817. package/src/migrations/20221117151200_add_detail_columns_to_component_version.js +49 -0
  818. package/src/migrations/20221220151200_add_required_to_manifests.js +61 -0
  819. package/src/migrations/20221222151200_add_required_to_manifests.js +138 -0
  820. package/src/migrations/20223525103556_component_set_rule.sql +19 -0
  821. package/src/migrations/20230111095522_update_environment_property.js +72 -0
  822. package/src/migrations/20230203084900_ensure_static_root_exists.js +57 -0
  823. package/src/migrations/20230210143300_lowercase_all_uri_names.js +106 -0
  824. package/src/migrations/20230217151212_component_set_component_version_updates.sql +38 -0
  825. package/src/migrations/20230218121212_add_component_set_rules.js +31 -0
  826. package/tsconfig.json +16 -0
@@ -0,0 +1,178 @@
1
+ import path from 'node:path/posix';
2
+ import { ManifestModel, Manifest } from '../ManifestModel';
3
+ import { BadRequestError, never } from '@squiz/dx-common-lib';
4
+ import { MANIFEST_MODELS } from '@squiz/dx-json-schema-lib';
5
+ import {
6
+ ComponentSchemaValidationService,
7
+ ComponentSchemaValidationServiceFactory,
8
+ } from './ComponentSchemaValidationService';
9
+ import {
10
+ ComponentInputValidationService,
11
+ ComponentInputValidationServiceFactory,
12
+ } from './ComponentInputValidationService';
13
+
14
+ type FunctionOutputTypes = ManifestModel['functions'][number]['output'];
15
+ type ComponentFunction = MANIFEST_MODELS.v1.ComponentFunction;
16
+ type HtmlStaticFile = MANIFEST_MODELS.v1.HtmlStaticFile;
17
+
18
+ export class ComponentFunctionService {
19
+ private schemaValidationService: ComponentSchemaValidationService = ComponentSchemaValidationServiceFactory.create();
20
+ private inputValidationService: ComponentInputValidationService = ComponentInputValidationServiceFactory.create();
21
+
22
+ static buildFileUrl(
23
+ filepath: string,
24
+ manifest: Manifest,
25
+ params: { _componentSet: string } | { _previewKey: string },
26
+ rootUrl: string,
27
+ ): string {
28
+ try {
29
+ // URL.canParse is added in node 19.9. Instead catch an invalid URL error
30
+ const url = new URL(filepath);
31
+ return url.href;
32
+ } catch (_) {
33
+ const searchParams = new URLSearchParams(params);
34
+ const normalizedFilepath = path
35
+ .normalize(filepath)
36
+ .replace(/^[/.]+/, '')
37
+ .replace(/\?.*$/, '');
38
+ return `${rootUrl.replace(/\/$/, '')}/s/${manifest.id}/${normalizedFilepath}?${searchParams.toString()}`;
39
+ }
40
+ }
41
+
42
+ public getFunctionDefinitionFromManifest(functionName: string, manifest: Manifest): ComponentFunction | undefined {
43
+ const componentFunctionDefinition = manifest.getModel().functions.find((f) => f.name === functionName);
44
+
45
+ return componentFunctionDefinition;
46
+ }
47
+
48
+ public prepareComponentFunctionForWebResponse(
49
+ func: ComponentFunction,
50
+ manifest: Manifest,
51
+ componentSet: string,
52
+ rootUrl: string,
53
+ ): ComponentFunction {
54
+ if (func.output.responseType === 'html') {
55
+ func.output.staticFiles = func.output.staticFiles?.map((f: HtmlStaticFile) => ({
56
+ ...f,
57
+ file: {
58
+ ...f.file,
59
+ filepath: ComponentFunctionService.buildFileUrl(
60
+ f.file.filepath,
61
+ manifest,
62
+ { _componentSet: componentSet },
63
+ rootUrl,
64
+ ),
65
+ },
66
+ }));
67
+ }
68
+
69
+ return func;
70
+ }
71
+
72
+ public prepareManifestForWebResponse(manifest: Manifest, componentSet: string, rootUrl: string): ManifestModel {
73
+ const manifestModel = manifest.getModel();
74
+ const manifestForWeb: ManifestModel = {
75
+ ...manifestModel,
76
+ functions: manifestModel.functions.map((f) =>
77
+ this.prepareComponentFunctionForWebResponse(f, manifest, componentSet, rootUrl),
78
+ ),
79
+ };
80
+ return manifestForWeb;
81
+ }
82
+
83
+ public prepareComponentFunctionForPreview(
84
+ func: ComponentFunction,
85
+ manifest: Manifest,
86
+ previewKey: string,
87
+ rootUrl: string,
88
+ ): ComponentFunction {
89
+ if (func.output.responseType === 'html') {
90
+ func.output.staticFiles = func.output.staticFiles?.map((f: HtmlStaticFile) => ({
91
+ ...f,
92
+ file: {
93
+ ...f.file,
94
+ filepath: ComponentFunctionService.buildFileUrl(
95
+ f.file.filepath,
96
+ manifest,
97
+ { _previewKey: previewKey },
98
+ rootUrl,
99
+ ),
100
+ },
101
+ }));
102
+ }
103
+ return func;
104
+ }
105
+
106
+ public prepareManifestForPreview(manifest: Manifest, previewKey: string, rootUrl: string): ManifestModel {
107
+ const manifestModel = manifest.getModel();
108
+ const manifestForPreview: ManifestModel = {
109
+ ...manifestModel,
110
+ functions: manifestModel.functions.map((f) =>
111
+ this.prepareComponentFunctionForPreview(f, manifest, previewKey, rootUrl),
112
+ ),
113
+ };
114
+
115
+ return manifestForPreview;
116
+ }
117
+
118
+ /**
119
+ * Asserts the provided input matches the input schema of the component function before
120
+ * any resolution through the render pipeline.
121
+ * @param input Input value which has not been resolved through render pipeline
122
+ * @param componentFunctionDefinition
123
+ */
124
+ public assertInputValidForComponentFunction(input: unknown, componentFunctionDefinition: ComponentFunction) {
125
+ if (input === undefined) {
126
+ throw new BadRequestError(`input value for ${componentFunctionDefinition.name} cannot be undefined`);
127
+ }
128
+
129
+ this.schemaValidationService.validateInput(input, componentFunctionDefinition.input);
130
+ }
131
+
132
+ /**
133
+ * Asserts the provided input matches the input schema of the component function after
134
+ * resolution through the render pipeline.
135
+ * @param input Input value which has been resolved through render pipeline
136
+ * @param componentFunctionDefinition
137
+ */
138
+ public assertRenderInputValidForComponentFunction(input: unknown, componentFunctionDefinition: ComponentFunction) {
139
+ if (input === undefined) {
140
+ throw new BadRequestError(`input value for ${componentFunctionDefinition.name} cannot be undefined`);
141
+ }
142
+ this.inputValidationService.validateInput(input, componentFunctionDefinition.input);
143
+ }
144
+
145
+ public assertOutputValidForComponentFunction(output: unknown, componentFunctionDefinition: ComponentFunction) {
146
+ if (componentFunctionDefinition === undefined) {
147
+ throw new Error(`input value for ${componentFunctionDefinition} cannot be undefined`);
148
+ }
149
+ if (output === undefined) {
150
+ throw new Error(`input value for ${componentFunctionDefinition.name} cannot be undefined`);
151
+ }
152
+
153
+ const outputSchema = this.getOutputValidationSchema(componentFunctionDefinition.output);
154
+ this.schemaValidationService.validateInput(output, outputSchema);
155
+ }
156
+
157
+ protected getOutputValidationSchema(func: FunctionOutputTypes): object {
158
+ const responseType = func.responseType;
159
+
160
+ switch (responseType) {
161
+ case 'html':
162
+ return { type: 'string', minLength: 0 };
163
+
164
+ case 'json': {
165
+ const jsonFunc = func;
166
+
167
+ if (jsonFunc.definition) {
168
+ return jsonFunc.definition;
169
+ }
170
+
171
+ throw new Error('definition is missing for the json');
172
+ }
173
+
174
+ default:
175
+ never(responseType);
176
+ }
177
+ }
178
+ }
@@ -0,0 +1,22 @@
1
+ import {
2
+ JSONSchemaService,
3
+ SquizImageType,
4
+ SquizLinkType,
5
+ TypeResolver,
6
+ ComponentInputFormattedTextType,
7
+ ComponentInputMetaSchema,
8
+ } from '@squiz/dx-json-schema-lib';
9
+
10
+ export type ComponentInputValidationService = JSONSchemaService<
11
+ SquizImageType | ComponentInputFormattedTextType | SquizLinkType,
12
+ never
13
+ >;
14
+
15
+ export class ComponentInputValidationServiceFactory {
16
+ public static create(): ComponentInputValidationService {
17
+ return new JSONSchemaService(
18
+ new TypeResolver([SquizImageType, ComponentInputFormattedTextType, SquizLinkType]),
19
+ ComponentInputMetaSchema,
20
+ );
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ import {
2
+ JSONSchemaService,
3
+ SquizImageType,
4
+ SquizLinkType,
5
+ TypeResolver,
6
+ ManifestV1MetaSchema,
7
+ BaseFormattedTextType,
8
+ } from '@squiz/dx-json-schema-lib';
9
+
10
+ export type ComponentSchemaValidationService = JSONSchemaService<
11
+ SquizImageType | SquizLinkType | BaseFormattedTextType,
12
+ never
13
+ >;
14
+
15
+ export class ComponentSchemaValidationServiceFactory {
16
+ public static create(): ComponentSchemaValidationService {
17
+ return new JSONSchemaService(
18
+ new TypeResolver([SquizImageType, BaseFormattedTextType, SquizLinkType]),
19
+ ManifestV1MetaSchema,
20
+ );
21
+ }
22
+ }
@@ -0,0 +1,165 @@
1
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
+ import { ManifestModel } from '../ManifestModel';
3
+ import { JobFunctionService } from './JobFunctionService';
4
+ import { ManifestV1 } from '../ManifestV1';
5
+ import { MANIFEST_MODELS } from '@squiz/dx-json-schema-lib';
6
+
7
+ type ComponentFunction = MANIFEST_MODELS.v1.ComponentFunction;
8
+
9
+ describe('JobFunctionService', () => {
10
+ const service = new JobFunctionService();
11
+ const manifestPath = '';
12
+ const manifestModel: ManifestModel = {
13
+ $schema: './manifest-schemas/v1.json',
14
+
15
+ name: 'hello',
16
+ version: '1.0.1',
17
+ namespace: 'foo',
18
+ displayName: 'some display name',
19
+ description: 'some description',
20
+
21
+ mainFunction: 'hello',
22
+
23
+ functions: [
24
+ {
25
+ entry: 'whatever.js',
26
+ name: 'hello',
27
+
28
+ input: {
29
+ type: 'object',
30
+ properties: {
31
+ hello: { type: 'string' },
32
+ },
33
+
34
+ required: ['hello'],
35
+ },
36
+
37
+ output: {
38
+ responseType: 'html',
39
+ },
40
+
41
+ queryParameters: {
42
+ foo: {
43
+ required: false,
44
+ },
45
+ },
46
+ },
47
+
48
+ {
49
+ entry: 'whatever.js',
50
+ name: 'static-files',
51
+
52
+ input: {
53
+ type: 'object',
54
+ properties: {
55
+ hello: { type: 'string' },
56
+ },
57
+
58
+ required: ['hello'],
59
+ },
60
+
61
+ output: {
62
+ responseType: 'html',
63
+
64
+ staticFiles: [
65
+ {
66
+ file: {
67
+ filepath: './something.png',
68
+ },
69
+ location: 'header',
70
+ },
71
+
72
+ {
73
+ file: {
74
+ filepath: './sub/sub-dir.png',
75
+ },
76
+ location: 'header',
77
+ },
78
+
79
+ {
80
+ file: {
81
+ filepath: './sub/../sub-dir-transverse-up.png',
82
+ },
83
+ location: 'header',
84
+ },
85
+
86
+ {
87
+ file: {
88
+ filepath: '../sub-dir-transverse-up-past-root.png',
89
+ },
90
+ location: 'header',
91
+ },
92
+
93
+ {
94
+ file: {
95
+ filepath: '/absolute/path.png',
96
+ },
97
+ location: 'header',
98
+ },
99
+ {
100
+ file: {
101
+ filepath: 'no-prefix.png',
102
+ },
103
+ location: 'header',
104
+ },
105
+ ],
106
+ },
107
+ },
108
+
109
+ {
110
+ entry: 'whatever.js',
111
+ name: 'hello-json',
112
+
113
+ input: {
114
+ type: 'object',
115
+ properties: {
116
+ hello: { type: 'string' },
117
+ },
118
+
119
+ required: ['hello'],
120
+ },
121
+
122
+ output: {
123
+ responseType: 'json',
124
+ definition: {
125
+ type: 'object',
126
+ properties: {
127
+ prop: { type: 'string' },
128
+ obj: { type: 'object', properties: { 'sub-prop': { type: 'number' } }, required: ['sub-prop'] },
129
+ },
130
+ additionalProperties: false,
131
+ required: ['prop', 'obj'],
132
+ },
133
+ },
134
+ },
135
+ ],
136
+ };
137
+
138
+ describe('assertInputValidForJobFunction', () => {
139
+ const manifest = new ManifestV1(JSON.parse(JSON.stringify(manifestModel)), manifestPath);
140
+ const jobFunc = manifest.getModel().functions.find((f) => f.name === 'hello') as ComponentFunction;
141
+
142
+ it('should validate the input for the job function', (): void => {
143
+ const input = {
144
+ // required property
145
+ hello: 'world',
146
+ };
147
+
148
+ expect(() => service.assertInputValidForJobFunction(input, jobFunc)).not.toThrow();
149
+ });
150
+
151
+ it("should throw an error if the input to a component function doesn't meet the schema", () => {
152
+ const input = {};
153
+
154
+ expect(() => service.assertInputValidForJobFunction(input, jobFunc)).toThrowErrorMatchingInlineSnapshot(
155
+ `"failed validation: The required property \`hello\` is missing at \`#\`"`,
156
+ );
157
+ });
158
+
159
+ it('should throw an error if input is undefined', () => {
160
+ expect(() => service.assertInputValidForJobFunction(undefined, jobFunc)).toThrowErrorMatchingInlineSnapshot(
161
+ `"input value for hello cannot be undefined"`,
162
+ );
163
+ });
164
+ });
165
+ });
@@ -0,0 +1,25 @@
1
+ import { BadRequestError } from '@squiz/dx-common-lib';
2
+ import { MANIFEST_MODELS } from '@squiz/dx-json-schema-lib';
3
+ import {
4
+ ComponentSchemaValidationService,
5
+ ComponentSchemaValidationServiceFactory,
6
+ } from './ComponentSchemaValidationService';
7
+
8
+ type JobFunction = MANIFEST_MODELS.JobV1.JobFunction;
9
+
10
+ export class JobFunctionService {
11
+ private schemaValidationService: ComponentSchemaValidationService = ComponentSchemaValidationServiceFactory.create();
12
+
13
+ /**
14
+ * Asserts the provided input matches the input schema of the job function
15
+ * @param input
16
+ * @param jobFunctionDefinition
17
+ */
18
+ public assertInputValidForJobFunction(input: unknown, jobFunctionDefinition: JobFunction) {
19
+ if (input === undefined) {
20
+ throw new BadRequestError(`input value for ${jobFunctionDefinition.name} cannot be undefined`);
21
+ }
22
+
23
+ this.schemaValidationService.validateInput(input, jobFunctionDefinition.input);
24
+ }
25
+ }
@@ -0,0 +1,199 @@
1
+ import { getLogger } from '@squiz/dx-logger-lib';
2
+ import path from 'path';
3
+ import { ManifestServiceForDev } from './ManifestServiceForDev';
4
+ import fs from 'fs-extra';
5
+
6
+ const COMPONENT_ROOT = process.env.DATA_MOUNT_POINT!;
7
+
8
+ const logger = getLogger({ name: 'test', format: 'json' });
9
+
10
+ const warnSpy = jest.spyOn(logger, 'warn');
11
+
12
+ describe('ManifestServiceForDev', () => {
13
+ const service = new ManifestServiceForDev(COMPONENT_ROOT, logger);
14
+
15
+ beforeAll(() => {
16
+ if (fs.existsSync(path.join(COMPONENT_ROOT, 'unit-test-components/test-component/1.1.4/bad-dir'))) {
17
+ fs.rmSync(path.join(COMPONENT_ROOT, 'unit-test-components/test-component/1.1.4/bad-dir'), { recursive: true });
18
+ }
19
+ });
20
+
21
+ it('finds a component in subdirectory including version', async () => {
22
+ const componentDirectory = path.resolve(COMPONENT_ROOT, 'unit-test-components', 'test-component', '1.0.0');
23
+ const resolvedComponents = await service.getManifestPath('unit-test-components', 'test-component', '1.0.0');
24
+ expect(resolvedComponents).toEqual(path.join(componentDirectory, 'manifest.json'));
25
+ });
26
+
27
+ it('finds a component in a sub directory not including version', async () => {
28
+ const componentDirectory = path.resolve(COMPONENT_ROOT, 'unit-test-components', 'no-version-struct');
29
+ const resolvedComponents = await service.getManifestPath('unit-test-components', 'no-version-struct', '1.0.0');
30
+ expect(resolvedComponents).toEqual(path.join(componentDirectory, 'manifest.json'));
31
+ });
32
+
33
+ it('finds all components in the root directory', async () => {
34
+ const resolvedComponents = await service.listAllComponentManifests();
35
+
36
+ const allowedPrefixes = [
37
+ 'test-component',
38
+ 'test-environment-variables',
39
+ 'test-malicious-code',
40
+ 'test-npm-modules',
41
+ 'test-static-files',
42
+ ];
43
+
44
+ expect(
45
+ resolvedComponents
46
+ .filter((a) => allowedPrefixes.some((b) => a.getName().startsWith(`unit-test-components/${b}`)))
47
+ .map((a) => `${a.getName()} ${a.getVersion()}`)
48
+ .sort(),
49
+ ).toEqual([
50
+ 'unit-test-components/test-component 0.0.0',
51
+ 'unit-test-components/test-component 1.0.0',
52
+ 'unit-test-components/test-component 1.0.10',
53
+ 'unit-test-components/test-component 1.0.3',
54
+ 'unit-test-components/test-component 1.0.4',
55
+ 'unit-test-components/test-component 1.0.5',
56
+ 'unit-test-components/test-component 1.0.6',
57
+ 'unit-test-components/test-component 1.0.7',
58
+ 'unit-test-components/test-component 1.0.8',
59
+ 'unit-test-components/test-component 1.0.9',
60
+ 'unit-test-components/test-component 1.1.0',
61
+ 'unit-test-components/test-component 1.1.2',
62
+ 'unit-test-components/test-component 1.1.4',
63
+ 'unit-test-components/test-component 1.2.0',
64
+ 'unit-test-components/test-component 1.3.0',
65
+ 'unit-test-components/test-environment-variables 1.0.0',
66
+ 'unit-test-components/test-environment-variables 1.0.1',
67
+ 'unit-test-components/test-environment-variables 1.0.2',
68
+ 'unit-test-components/test-environment-variables 1.0.3',
69
+ 'unit-test-components/test-environment-variables 1.0.4',
70
+ 'unit-test-components/test-malicious-code 1.0.0',
71
+ 'unit-test-components/test-malicious-code 1.1.0',
72
+ 'unit-test-components/test-malicious-code 1.2.0',
73
+ 'unit-test-components/test-malicious-code 1.3.0',
74
+ 'unit-test-components/test-npm-modules 1.0.0',
75
+ 'unit-test-components/test-npm-modules 2.0.0',
76
+ 'unit-test-components/test-npm-modules 3.0.0',
77
+ 'unit-test-components/test-npm-modules 3.1.0',
78
+ 'unit-test-components/test-static-files 1.0.0',
79
+ 'unit-test-components/test-static-files 1.0.1',
80
+ 'unit-test-components/test-static-files 1.0.2',
81
+ 'unit-test-components/test-static-files 1.0.3',
82
+ 'unit-test-components/test-static-files 1.0.4',
83
+ 'unit-test-components/test-static-files 1.0.5',
84
+ 'unit-test-components/test-static-files 1.0.6',
85
+ 'unit-test-components/test-static-files 1.0.7',
86
+ 'unit-test-components/test-static-files 1.0.8',
87
+ ]);
88
+ });
89
+
90
+ it('should find log warnings on all manifests that fail validation', async () => {
91
+ await service.listAllComponentManifests();
92
+
93
+ expect(
94
+ warnSpy.mock.calls
95
+ .filter((a) => {
96
+ // Get rid of the random fixtures
97
+ const message = a[0] as unknown as string;
98
+ return !message.includes('/fixtures/');
99
+ })
100
+ .map((a) => {
101
+ const message = a[0] as unknown as string;
102
+ // get rid of user specific paths from test snapshot
103
+ return message.replace(COMPONENT_ROOT, '');
104
+ })
105
+ .sort(),
106
+ ).toMatchInlineSnapshot(`
107
+ [
108
+ "found manifest /dx-team/cornponent/0.0.3/manifest.json, but failed to load manifest because: Invalid preview data for preview "render-with-data": failed validation: Value \`[{"tag":"p","type":"tag","children":[{"type":"text","value":"This is some "},{"type":"text","value":"text"}]}]\` in \`#/my-prop/formattedText\` does not match any given oneof schema,
109
+ Value \`{"text":[{"tag":"p","type":"tag","children":[{"type":"text","value":"This is some "},{"type":"text","value":"text"}]}]}\` in \`#/my-prop/arr\` does not match any given oneof schema",
110
+ "found manifest /unit-test-components/test-component/1.0.2/manifest.json, but failed schema validation because: Could not determine manifest version. Your manifest must have a $schema property defined.",
111
+ "found manifest /unit-test-components/test-component/1.0.3/manifest.json, but failed to load manifest because: "main's" entry file "missing-entry-file.js" is inaccessible",
112
+ "found manifest /unit-test-components/test-component/1.0.5/manifest.json, but failed to load manifest because: "test-component 1.0.5" main function could not be found in function list",
113
+ "found manifest /unit-test-components/test-component/1.0.6/manifest.json, but failed to load manifest because: access to component "file-accessing-outside-parent-func's" entry file "../1.0.4/render-json.js" outside the parent directory in "test-component 1.0.6" is not allowed",
114
+ "found manifest /unit-test-components/test-component/1.1.1/manifest.json, but failed schema validation because: failed validation: Value in \`#/functions/0/name\` should match \`^[a-z][a-z0-9_\\-]+$\`, but received \`invalid-function-name-!!!!\`",
115
+ "found manifest /unit-test-components/test-component/1.1.2/manifest.json, but failed to load manifest because: function main-output-has-static defines static files but manifest has no staticFiles.locationRoot defined",
116
+ "found manifest /unit-test-components/test-component/1.1.4/manifest.json, but failed to load manifest because: static root bad-dir from "test-component 1.1.4" is not accessible",
117
+ "found manifest /unit-test-components/test-component/1.2.0/manifest.json, but failed to load manifest because: Invalid preview data for preview "test-preview": failed validation: The required property \`something\` is missing at \`#\`",
118
+ "found manifest /unit-test-components/test-icon-component/1.0.1/manifest.json, but failed schema validation because: failed validation: Expected given value \`not_a_valid_id\` in #/icon/id\` to be one of \`[10k, 10mp, 11mp, 123, 12mp, ... 2233 more]\`,
119
+ Value \`{"type":"hex","value":"(255,255,255)"}\` in \`#/icon/color\` does not match any given oneof schema",
120
+ "found manifest /unit-test-components/test-icon-component/1.0.2/manifest.json, but failed schema validation because: failed validation: Expected given value \`not_a_valid_id\` in #/icon/id\` to be one of \`[10k, 10mp, 11mp, 123, 12mp, ... 2233 more]\`,
121
+ The required property \`color\` is missing at \`#/icon\`",
122
+ "found manifest /unit-test-components/test-load/1.0.7/manifest.json, but failed to load manifest because: Invalid preview data for preview "preview1": Unknown Preview Configuration Type",
123
+ "found manifest /unit-test-components/test-preview-component/1.0.0/manifest.json, but failed to load manifest because: Invalid preview data for preview "invalid-preview-data": failed validation: Expected \`not-an-integer\` (string) in \`#/integerValue\` to be of type \`number\`,
124
+ The required property \`nested\` is missing at \`#\`",
125
+ "found manifest /unit-test-components/test-preview-component/1.0.7/manifest.json, but failed to load manifest because: Invalid preview data for preview "preview-json-doesnt-exist": Preview inputData file "missing.json" does not exist",
126
+ "found manifest /unit-test-components/test-preview-component/1.1.0/manifest.json, but failed to load manifest because: Invalid preview data for preview "preview-inline": failed validation: Value \`[{"type":"tag","tag":"p","children":[{"type":"text","value":"This is a paragraph"},{"type":"tag","tag":"span","children":[{"type":"text","value":" with a span"}]}]}]\` in \`#/formattedText\` does not match any given oneof schema",
127
+ "found manifest /unit-test-components/test-preview-component/1.1.2/manifest.json, but failed to load manifest because: Mocked URI object file "./non-existent-uri.json" does not exist",
128
+ "found manifest /unit-test-components/test-preview-component/1.1.3/manifest.json, but failed to load manifest because: Mocked URI object file "../1.0.0/manifest.json" is outside the component directory",
129
+ "found manifest /unit-test-components/test-preview-component/1.2.1/manifest.json, but failed to load manifest because: Invalid preview data for preview "preview-js-doesnt-exist": Preview inputData file "missing.js" does not exist",
130
+ "found manifest /unit-test-components/test-preview-component/1.2.2/manifest.json, but failed to load manifest because: Invalid preview data for preview "preview-json-doesnt-exist": Preview inputData file "missing.json" does not exist",
131
+ "found manifest /unit-test-components/test-preview-component/1.2.3/manifest.json, but failed to load manifest because: Invalid preview data for preview "preview-json-outside-of-root": Preview inputData file "../preview-data.json" is outside the component directory",
132
+ "found manifest /unit-test-components/test-static-files/1.0.2/manifest.json, but failed to load manifest because: "main's" static file "static-files-library/static-file-does-not-exist.js" is inaccessible",
133
+ "found manifest /unit-test-components/test-static-files/1.0.3/manifest.json, but failed to load manifest because: access to a static file locationRoot outside the parent directory in "test-static-files 1.0.3" is not allowed",
134
+ "found manifest /unit-test-components/test-static-files/1.0.4/manifest.json, but failed to load manifest because: access to a static file "../../static-files-library/static-library-file.js" for "main" outside the parent directory in "test-static-files 1.0.4" is not allowed",
135
+ "found manifest /unit-test-components/test-static-files/1.0.5/manifest.json, but failed to load manifest because: function main defines static files but manifest has no staticFiles.locationRoot defined",
136
+ "found manifest /unit-test-components/test-static-files/1.0.6/manifest.json, but failed to load manifest because: function main defines static files but manifest has no staticFiles.locationRoot defined",
137
+ "found manifest /unit-test-components/test-static-files/1.0.8/manifest.json, but failed to load manifest because: function main defines static files but manifest has no staticFiles.locationRoot defined",
138
+ ]
139
+ `);
140
+ });
141
+
142
+ describe('Manifest refreshes correctly', () => {
143
+ it('should update data on loadManifest when given manifest data is valid', async () => {
144
+ const manifestPath = await service.getManifestPath('refresh-test-components', 'test-refresh', '1.0.0');
145
+ const componentDirectory = path.resolve(COMPONENT_ROOT, 'unit-test-components', 'test-refresh', '1.0.0');
146
+ const originalManifestData = fs.readFileSync(componentDirectory + '/manifest.json', 'utf8');
147
+ const newManifestData = fs.readFileSync(componentDirectory + '/manifest-modified.json', 'utf8');
148
+ fs.writeFileSync(manifestPath, newManifestData);
149
+ const manifest = await service.loadManifest('refresh-test-components', 'test-refresh', '1.0.0');
150
+ expect(manifest.getName()).toEqual('refresh-test-components/test-refresh');
151
+ expect(manifest.getVersion()).toEqual('1.0.0');
152
+ expect(manifest.getModel()).toMatchInlineSnapshot(`
153
+ {
154
+ "$schema": "http://localhost:3000/schemas/v1.json#",
155
+ "description": "some-description-modified",
156
+ "displayName": "some-display-name-modified",
157
+ "functions": [
158
+ {
159
+ "entry": "main.js",
160
+ "input": {
161
+ "properties": {
162
+ "something": {
163
+ "type": "string",
164
+ },
165
+ },
166
+ "required": [
167
+ "something",
168
+ ],
169
+ "type": "object",
170
+ },
171
+ "name": "main-modified",
172
+ "output": {
173
+ "responseType": "html",
174
+ },
175
+ },
176
+ ],
177
+ "mainFunction": "main-modified",
178
+ "name": "test-refresh",
179
+ "namespace": "refresh-test-components",
180
+ "version": "1.0.0",
181
+ }
182
+ `);
183
+ fs.writeFileSync(manifestPath, originalManifestData);
184
+ });
185
+ it('should not update data correctly on loadManifest when given manifest data is invalid', async () => {
186
+ const manifestPath = await service.getManifestPath('refresh-test-components', 'test-refresh', '1.0.1');
187
+ const componentDirectory = path.resolve(COMPONENT_ROOT, 'unit-test-components', 'test-refresh', '1.0.1');
188
+ const originalManifestData = fs.readFileSync(componentDirectory + '/manifest.json', 'utf8');
189
+ const newManifestData = fs.readFileSync(componentDirectory + '/manifest-invalid.json', 'utf8');
190
+ fs.writeFileSync(manifestPath, newManifestData);
191
+ await expect(
192
+ service.loadManifest('refresh-test-components', 'test-refresh', '1.0.1'),
193
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
194
+ `""test-refresh 1.0.1" main function could not be found in function list"`,
195
+ );
196
+ fs.writeFileSync(manifestPath, originalManifestData);
197
+ });
198
+ });
199
+ });