@itentialopensource/adapter-azure_devops 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. package/AUTH.md +39 -0
  2. package/BROKER.md +199 -0
  3. package/CALLS.md +169 -0
  4. package/CHANGELOG.md +17 -2
  5. package/CODE_OF_CONDUCT.md +12 -17
  6. package/CONTRIBUTING.md +88 -74
  7. package/ENHANCE.md +69 -0
  8. package/PROPERTIES.md +641 -0
  9. package/README.md +221 -571
  10. package/SUMMARY.md +9 -0
  11. package/SYSTEMINFO.md +11 -0
  12. package/TROUBLESHOOT.md +47 -0
  13. package/adapter.js +11999 -57
  14. package/adapterBase.js +1007 -253
  15. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/README.md +59 -0
  16. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/specificCallScript.js +97 -0
  17. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/update.js +532 -0
  18. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/adapter.js +11651 -0
  19. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/AnnotatedTags/action.json +43 -0
  20. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/AnnotatedTags/mockdatafiles/mockdata.json +20817 -0
  21. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/AnnotatedTags/schema.json +125 -0
  22. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Blobs/action.json +43 -0
  23. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Blobs/mockdatafiles/mockdata.json +20817 -0
  24. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Blobs/schema.json +125 -0
  25. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/CherryPicks/action.json +64 -0
  26. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/CherryPicks/mockdatafiles/mockdata.json +20817 -0
  27. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/CherryPicks/schema.json +125 -0
  28. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Commits/action.json +85 -0
  29. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Commits/mockdatafiles/mockdata.json +20817 -0
  30. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Commits/schema.json +125 -0
  31. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Diffs/action.json +23 -0
  32. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Diffs/mockdatafiles/mockdata.json +20817 -0
  33. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Diffs/schema.json +125 -0
  34. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Forks/action.json +85 -0
  35. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Forks/mockdatafiles/mockdata.json +20817 -0
  36. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Forks/schema.json +125 -0
  37. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/ImportRequests/action.json +84 -0
  38. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/ImportRequests/mockdatafiles/mockdata.json +20817 -0
  39. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/ImportRequests/schema.json +125 -0
  40. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Items/action.json +43 -0
  41. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Items/mockdatafiles/mockdata.json +20817 -0
  42. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Items/schema.json +125 -0
  43. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/MergeBases/action.json +23 -0
  44. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/MergeBases/mockdatafiles/mockdata.json +20817 -0
  45. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/MergeBases/schema.json +125 -0
  46. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Merges/action.json +43 -0
  47. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Merges/mockdatafiles/mockdata.json +20817 -0
  48. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Merges/schema.json +125 -0
  49. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PolicyConfigurations/action.json +23 -0
  50. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PolicyConfigurations/mockdatafiles/mockdata.json +20817 -0
  51. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PolicyConfigurations/schema.json +125 -0
  52. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestAttachments/action.json +84 -0
  53. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestAttachments/mockdatafiles/mockdata.json +20817 -0
  54. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestAttachments/schema.json +125 -0
  55. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestCommentLikes/action.json +63 -0
  56. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestCommentLikes/mockdatafiles/mockdata.json +20817 -0
  57. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestCommentLikes/schema.json +125 -0
  58. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestCommits/action.json +44 -0
  59. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestCommits/mockdatafiles/mockdata.json +20817 -0
  60. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestCommits/schema.json +125 -0
  61. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestIterationChanges/action.json +23 -0
  62. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestIterationChanges/mockdatafiles/mockdata.json +20817 -0
  63. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestIterationChanges/schema.json +125 -0
  64. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestIterationStatuses/action.json +104 -0
  65. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestIterationStatuses/mockdatafiles/mockdata.json +20817 -0
  66. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestIterationStatuses/schema.json +125 -0
  67. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestIterations/action.json +44 -0
  68. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestIterations/mockdatafiles/mockdata.json +20817 -0
  69. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestIterations/schema.json +125 -0
  70. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestLabels/action.json +84 -0
  71. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestLabels/mockdatafiles/mockdata.json +20817 -0
  72. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestLabels/schema.json +125 -0
  73. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestProperties/action.json +43 -0
  74. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestProperties/mockdatafiles/mockdata.json +20817 -0
  75. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestProperties/schema.json +125 -0
  76. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestQuery/action.json +22 -0
  77. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestQuery/mockdatafiles/mockdata.json +20817 -0
  78. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestQuery/schema.json +125 -0
  79. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestReviewers/action.json +164 -0
  80. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestReviewers/mockdatafiles/mockdata.json +20817 -0
  81. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestReviewers/schema.json +125 -0
  82. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestShare/action.json +22 -0
  83. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestShare/mockdatafiles/mockdata.json +20817 -0
  84. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestShare/schema.json +125 -0
  85. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestStatuses/action.json +104 -0
  86. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestStatuses/mockdatafiles/mockdata.json +20817 -0
  87. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestStatuses/schema.json +125 -0
  88. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestThreadComments/action.json +104 -0
  89. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestThreadComments/mockdatafiles/mockdata.json +20817 -0
  90. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestThreadComments/schema.json +125 -0
  91. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestThreads/action.json +84 -0
  92. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestThreads/mockdatafiles/mockdata.json +20817 -0
  93. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestThreads/schema.json +125 -0
  94. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestWorkItems/action.json +23 -0
  95. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestWorkItems/mockdatafiles/mockdata.json +20817 -0
  96. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequestWorkItems/schema.json +125 -0
  97. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequests/action.json +126 -0
  98. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequests/mockdatafiles/mockdata.json +20817 -0
  99. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/PullRequests/schema.json +125 -0
  100. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Pushes/action.json +64 -0
  101. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Pushes/mockdatafiles/mockdata.json +20817 -0
  102. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Pushes/schema.json +125 -0
  103. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Refs/action.json +63 -0
  104. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Refs/mockdatafiles/mockdata.json +20817 -0
  105. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Refs/schema.json +125 -0
  106. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/RefsFavorites/action.json +84 -0
  107. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/RefsFavorites/mockdatafiles/mockdata.json +20817 -0
  108. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/RefsFavorites/schema.json +125 -0
  109. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Repositories/action.json +186 -0
  110. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Repositories/mockdatafiles/mockdata.json +20817 -0
  111. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Repositories/schema.json +125 -0
  112. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Reverts/action.json +64 -0
  113. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Reverts/mockdatafiles/mockdata.json +20817 -0
  114. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Reverts/schema.json +125 -0
  115. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Stats/action.json +23 -0
  116. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Stats/mockdatafiles/mockdata.json +20817 -0
  117. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Stats/schema.json +125 -0
  118. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Statuses/action.json +43 -0
  119. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Statuses/mockdatafiles/mockdata.json +20817 -0
  120. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Statuses/schema.json +125 -0
  121. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Suggestions/action.json +23 -0
  122. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Suggestions/mockdatafiles/mockdata.json +20817 -0
  123. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Suggestions/schema.json +125 -0
  124. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Trees/action.json +23 -0
  125. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Trees/mockdatafiles/mockdata.json +20817 -0
  126. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/entities/Trees/schema.json +125 -0
  127. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/methods.json +74975 -0
  128. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/pronghorn.json +11730 -0
  129. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/test/integration/adapterTestIntegration.js +5493 -0
  130. package/adapter_modifications/archive/UPD-2022-04-29T13:05:13.710Z/updateFiles/components/test/unit/adapterTestUnit.js +10889 -0
  131. package/entities/.generic/action.json +105 -0
  132. package/entities/.generic/schema.json +6 -1
  133. package/entities/AnnotatedTags/action.json +45 -0
  134. package/entities/AnnotatedTags/schema.json +20 -0
  135. package/entities/Blobs/action.json +45 -0
  136. package/entities/Blobs/schema.json +20 -0
  137. package/entities/CherryPicks/action.json +66 -0
  138. package/entities/CherryPicks/schema.json +21 -0
  139. package/entities/Commits/action.json +87 -0
  140. package/entities/Commits/mockdatafiles/commitsGetCommitsBatch-default.json +707 -0
  141. package/entities/Commits/mockdatafiles/commitsGetPushCommits-default.json +336 -0
  142. package/entities/Commits/schema.json +22 -0
  143. package/entities/Diffs/action.json +25 -0
  144. package/entities/Diffs/schema.json +19 -0
  145. package/entities/Forks/action.json +87 -0
  146. package/entities/Forks/mockdatafiles/forksGetForkSyncRequests-default.json +200 -0
  147. package/entities/Forks/mockdatafiles/forksList-default.json +102 -0
  148. package/entities/Forks/schema.json +22 -0
  149. package/entities/ImportRequests/action.json +86 -0
  150. package/entities/ImportRequests/mockdatafiles/importRequestsQuery-default.json +91 -0
  151. package/entities/ImportRequests/schema.json +22 -0
  152. package/entities/Items/action.json +45 -0
  153. package/entities/Items/mockdatafiles/itemsGetItemsBatch-default.json +5 -0
  154. package/entities/Items/mockdatafiles/itemsList-default.json +40 -0
  155. package/entities/Items/schema.json +20 -0
  156. package/entities/MergeBases/action.json +25 -0
  157. package/entities/MergeBases/mockdatafiles/mergeBasesList-default.json +580 -0
  158. package/entities/MergeBases/schema.json +19 -0
  159. package/entities/Merges/action.json +45 -0
  160. package/entities/Merges/schema.json +20 -0
  161. package/entities/PolicyConfigurations/action.json +25 -0
  162. package/entities/PolicyConfigurations/mockdatafiles/policyConfigurationsGet-default.json +20 -0
  163. package/entities/PolicyConfigurations/schema.json +19 -0
  164. package/entities/PullRequestAttachments/action.json +86 -0
  165. package/entities/PullRequestAttachments/mockdatafiles/pullRequestAttachmentsList-default.json +159 -0
  166. package/entities/PullRequestAttachments/schema.json +22 -0
  167. package/entities/PullRequestCommentLikes/action.json +65 -0
  168. package/entities/PullRequestCommentLikes/mockdatafiles/pullRequestCommentLikesList-default.json +10 -0
  169. package/entities/PullRequestCommentLikes/schema.json +21 -0
  170. package/entities/PullRequestCommits/action.json +46 -0
  171. package/entities/PullRequestCommits/mockdatafiles/pullRequestCommitsGetPullRequestCommits-default.json +818 -0
  172. package/entities/PullRequestCommits/mockdatafiles/pullRequestCommitsGetPullRequestIterationCommits-default.json +813 -0
  173. package/entities/PullRequestCommits/schema.json +20 -0
  174. package/entities/PullRequestIterationChanges/action.json +25 -0
  175. package/entities/PullRequestIterationChanges/schema.json +19 -0
  176. package/entities/PullRequestIterationStatuses/action.json +106 -0
  177. package/entities/PullRequestIterationStatuses/mockdatafiles/pullRequestIterationStatusesList-default.json +71 -0
  178. package/entities/PullRequestIterationStatuses/schema.json +23 -0
  179. package/entities/PullRequestIterations/action.json +46 -0
  180. package/entities/PullRequestIterations/mockdatafiles/pullRequestIterationsList-default.json +2403 -0
  181. package/entities/PullRequestIterations/schema.json +20 -0
  182. package/entities/PullRequestLabels/action.json +86 -0
  183. package/entities/PullRequestLabels/mockdatafiles/pullRequestLabelsList-default.json +20 -0
  184. package/entities/PullRequestLabels/schema.json +22 -0
  185. package/entities/PullRequestProperties/action.json +45 -0
  186. package/entities/PullRequestProperties/schema.json +20 -0
  187. package/entities/PullRequestQuery/action.json +24 -0
  188. package/entities/PullRequestQuery/schema.json +19 -0
  189. package/entities/PullRequestReviewers/action.json +166 -0
  190. package/entities/PullRequestReviewers/mockdatafiles/pullRequestReviewersCreatePullRequestReviewers-default.json +10 -0
  191. package/entities/PullRequestReviewers/mockdatafiles/pullRequestReviewersList-default.json +10 -0
  192. package/entities/PullRequestReviewers/schema.json +26 -0
  193. package/entities/PullRequestShare/action.json +24 -0
  194. package/entities/PullRequestShare/schema.json +19 -0
  195. package/entities/PullRequestStatuses/action.json +106 -0
  196. package/entities/PullRequestStatuses/mockdatafiles/pullRequestStatusesList-default.json +48 -0
  197. package/entities/PullRequestStatuses/schema.json +23 -0
  198. package/entities/PullRequestThreadComments/action.json +106 -0
  199. package/entities/PullRequestThreadComments/mockdatafiles/pullRequestThreadCommentsList-default.json +215 -0
  200. package/entities/PullRequestThreadComments/schema.json +23 -0
  201. package/entities/PullRequestThreads/action.json +86 -0
  202. package/entities/PullRequestThreads/mockdatafiles/pullRequestThreadsList-default.json +395 -0
  203. package/entities/PullRequestThreads/schema.json +22 -0
  204. package/entities/PullRequestWorkItems/action.json +25 -0
  205. package/entities/PullRequestWorkItems/mockdatafiles/pullRequestWorkItemsList-default.json +18 -0
  206. package/entities/PullRequestWorkItems/schema.json +19 -0
  207. package/entities/PullRequests/action.json +128 -0
  208. package/entities/PullRequests/mockdatafiles/pullRequestsGetPullRequests-default.json +6555 -0
  209. package/entities/PullRequests/mockdatafiles/pullRequestsGetPullRequestsByProject-default.json +5929 -0
  210. package/entities/PullRequests/schema.json +24 -0
  211. package/entities/Pushes/action.json +66 -0
  212. package/entities/Pushes/mockdatafiles/pushesList-default.json +34 -0
  213. package/entities/Pushes/schema.json +21 -0
  214. package/entities/Refs/action.json +65 -0
  215. package/entities/Refs/mockdatafiles/refsList-default.json +500 -0
  216. package/entities/Refs/mockdatafiles/refsUpdateRefs-default.json +13 -0
  217. package/entities/Refs/schema.json +21 -0
  218. package/entities/RefsFavorites/action.json +86 -0
  219. package/entities/RefsFavorites/mockdatafiles/refsFavoritesList-default.json +35 -0
  220. package/entities/RefsFavorites/schema.json +22 -0
  221. package/entities/Repositories/action.json +188 -0
  222. package/entities/Repositories/mockdatafiles/repositoriesGetDeletedRepositories-default.json +54 -0
  223. package/entities/Repositories/mockdatafiles/repositoriesGetRecycleBinRepositories-default.json +28 -0
  224. package/entities/Repositories/mockdatafiles/repositoriesList-default.json +123 -0
  225. package/entities/Repositories/schema.json +27 -0
  226. package/entities/Reverts/action.json +66 -0
  227. package/entities/Reverts/schema.json +21 -0
  228. package/entities/Stats/action.json +25 -0
  229. package/entities/Stats/mockdatafiles/statsList-default.json +195 -0
  230. package/entities/Stats/schema.json +19 -0
  231. package/entities/Statuses/action.json +45 -0
  232. package/entities/Statuses/mockdatafiles/statusesList-default.json +94 -0
  233. package/entities/Statuses/schema.json +20 -0
  234. package/entities/Suggestions/action.json +25 -0
  235. package/entities/Suggestions/mockdatafiles/suggestionsList-default.json +14 -0
  236. package/entities/Suggestions/schema.json +19 -0
  237. package/entities/Trees/action.json +25 -0
  238. package/entities/Trees/schema.json +19 -0
  239. package/error.json +6 -0
  240. package/package.json +5 -3
  241. package/previousVersion.zip +0 -0
  242. package/pronghorn.json +49635 -378
  243. package/propertiesDecorators.json +14 -0
  244. package/propertiesSchema.json +421 -0
  245. package/refs?service=git-upload-pack +0 -0
  246. package/report/adapterInfo.json +10 -0
  247. package/report/updateReport1653439219306.json +120 -0
  248. package/sampleProperties.json +90 -1
  249. package/test/integration/adapterTestBasicGet.js +1 -1
  250. package/test/integration/adapterTestIntegration.js +4869 -105
  251. package/test/unit/adapterBaseTestUnit.js +30 -25
  252. package/test/unit/adapterTestUnit.js +11057 -159
  253. package/utils/adapterInfo.js +206 -0
  254. package/utils/entitiesToDB.js +12 -57
  255. package/utils/patches2bundledDeps.js +90 -0
  256. package/utils/pre-commit.sh +3 -0
  257. package/utils/tbScript.js +35 -20
  258. package/utils/tbUtils.js +59 -35
  259. package/utils/testRunner.js +16 -16
  260. package/versions.json +135 -0
@@ -0,0 +1,532 @@
1
+ /* eslint-disable */
2
+
3
+ const fs = require('fs-extra');
4
+ const path = require('path');
5
+ const { spawn } = require('child_process');
6
+
7
+ const folder = process.argv[2];
8
+
9
+ /**
10
+ *
11
+ * This is the file to run in order to update your existing adapter.
12
+ * Make sure the zip is in the adapter's top level directory, then navigate there in the terminal and run 'node update'.
13
+ */
14
+
15
+ /**
16
+ * @summary the main function to be run in this file.
17
+ * @function run
18
+ */
19
+ function run() {
20
+
21
+ // To ensure that the names of each group are brought in.
22
+ console.log('Updating...\n');
23
+ const names = JSON.parse(fs.readFileSync(path.join(__dirname, `./${folder}/components/methods.json`), 'utf8'));
24
+ const toDeleteNames = names.toDelByName.map(d => d.fnName);
25
+ const toAppendNames = names.toAppByName.map(d => d.fnName);
26
+ const toAppByName = names.toAppByName.map(d => ({name: d.name, fnName: d.fnName, parameters: d.func.parameters}));
27
+ const toUpdateNames = [];
28
+ toDeleteNames.forEach((n) => {
29
+ toAppendNames.forEach((a) => {
30
+ if (n === a && !toUpdateNames.includes(n)) {
31
+ toUpdateNames.push(n);
32
+ }
33
+ });
34
+ });
35
+
36
+ // Creating copy of this object to be used later.
37
+ const curAppByName = JSON.parse(JSON.stringify(toAppByName));
38
+
39
+ // This object will contain any methods we attempt to add but already exist in the adapter, marking them for versioning.
40
+ const reAddingMethods = {};
41
+ const reAddingEmitMethods = {};
42
+
43
+ const adapterName = __dirname.split('/')[__dirname.split('/').length - 2].split('-')[1];
44
+ // Note that this assumes that the adapter name starts with 'adapter-'; if it does not, this will have to be edited.
45
+
46
+ // Filtering out and adding functions to the pronghorn.
47
+ if (fs.existsSync(path.join(__dirname, '../pronghorn.json'))) {
48
+ let pFile = JSON.parse(fs.readFileSync(path.join(__dirname, '../pronghorn.json'), 'utf8'));
49
+ pFile.methods = pFile.methods.filter(m => !toDeleteNames.includes(m.name));
50
+ //console.log(pFile.methods);
51
+ const methsToAdd = JSON.parse(fs.readFileSync(path.join(__dirname, `./${folder}/components/pronghorn.json`)));
52
+ methsToAdd.forEach((m) => {
53
+ //console.log(m.input);
54
+ if (toUpdateNames.includes(m.name)) {
55
+ pFile.methods.push(m);
56
+ }
57
+ // loop through methods and check signatures for versioning
58
+ let version = false;
59
+ let alreadyExists = false;
60
+ pFile.methods.forEach((pm) => {
61
+ if (pm.name === m.name) {
62
+ alreadyExists = true;
63
+ if (pm.input.length !== m.input.length) {
64
+ version = true;
65
+ } else {
66
+ for (let x = 0; x < m.input.length; x++) {
67
+ if (pm.input[x].name !== m.input[x].name || pm.input[x].required !== m.input[x].required || pm.input[x].type !== m.input[x].type) {
68
+ version = true;
69
+ }
70
+ }
71
+ }
72
+ }
73
+ });
74
+ if (version) {
75
+ // add for versioning
76
+ reAddingMethods[m.name] = {};
77
+ reAddingEmitMethods[m.name] = {};
78
+ reAddingMethods[m.name].pronghorn = m;
79
+ } else if (toAppendNames.includes(m.name) && !alreadyExists && !version) {
80
+ pFile.methods.push(m);
81
+ }
82
+ });
83
+ fs.writeFileSync(path.join(__dirname, '../pronghorn.json'), JSON.stringify(pFile, null, 2));
84
+ } else {
85
+ console.log('Your pronghorn.json file is missing; are you sure your adapter works?');
86
+ return;
87
+ }
88
+ if (fs.existsSync(path.join(__dirname, '../test/unit/adapterTestUnit.js'))) {
89
+ let uFile = fs.readFileSync(path.join(__dirname, '../test/unit/adapterTestUnit.js'), 'utf8');
90
+ const last = uFile.split('\n').slice(uFile.split('\n').length - 3).join('\n');
91
+ let list = uFile.split('\n').slice(0, uFile.split('\n').length - 3).join('\n').split(/(?=\n {4}describe\()/g).filter((u) => {
92
+ let remain = true;
93
+ toDeleteNames.forEach((n) => {
94
+ if (u.indexOf('#'.concat(n, ' - ')) >= 0 || u.indexOf('#'.concat(n, 'Emit - ')) >= 0) {
95
+ remain = false;
96
+ }
97
+ });
98
+ return remain;
99
+ });
100
+ list = list.join('');
101
+ let uChanges = fs.readFileSync(path.join(__dirname, `./${folder}/components/test/unit/adapterTestUnit.js`), 'utf8');
102
+ const units = uChanges.split(/(?=\n {4}describe\()/g);
103
+ if (units.length > 0) {
104
+ list = list.concat('\n');
105
+ }
106
+ units.forEach((un) => {
107
+ const u = un.replace(/Test-append-adapter/g, `Test-${adapterName}-adapter`); // See above about adapter name starting with 'adapter-'.
108
+ let remain = true;
109
+ toAppendNames.forEach((n) => {
110
+ if (list.includes('#'.concat(n, ' - ')) && u.includes('#'.concat(n, ' - '))) {
111
+ remain = false;
112
+ if (reAddingMethods[n] && !reAddingMethods[n].unit) {
113
+ reAddingMethods[n].unit = u;
114
+ }
115
+ } else if (list.includes('#'.concat(n, 'Emit - ')) && u.includes('#'.concat(n, 'Emit - '))) {
116
+ remain = false;
117
+ if (reAddingEmitMethods[n] && !reAddingEmitMethods[n].unit) {
118
+ reAddingEmitMethods[n].unit = u;
119
+ }
120
+ }
121
+ });
122
+ if (remain) {
123
+ list = list.concat(u);
124
+ }
125
+ });
126
+ list = list.replace('\n\n\n ', '\n\n ').concat(last);
127
+ fs.writeFileSync(path.join(__dirname, '../test/unit/adapterTestUnit.js'), list);
128
+ } else {
129
+ console.log('Your unit test file does not exist, will not delete or add any tests.');
130
+ }
131
+
132
+ if (fs.existsSync(path.join(__dirname, '../test/integration/adapterTestIntegration.js'))) {
133
+ let iFile = fs.readFileSync(path.join(__dirname, '../test/integration/adapterTestIntegration.js'), 'utf8');
134
+ const last = iFile.split('\n').slice(iFile.split('\n').length - 3).join('\n');
135
+ let list = iFile.split('\n').slice(0, iFile.split('\n').length - 3).join('\n').split(/(?=\n {4}describe\()|(?=\n {4}const [a-zA-Z]+)/g).filter((i) => {
136
+ let remain = true;
137
+ toDeleteNames.forEach((n) => {
138
+ if (i.indexOf('#'.concat(n, ' - ')) >= 0 || i.indexOf('#'.concat(n, 'Emit - ')) >= 0) {
139
+ remain = false;
140
+ }
141
+ });
142
+ return remain;
143
+ });
144
+ list = list.join('');
145
+
146
+ let iChanges = fs.readFileSync(path.join(__dirname, `./${folder}/components/test/integration/adapterTestIntegration.js`), 'utf8');
147
+ const integrations = iChanges.split(/(?=\n {4}describe\()|(?=\n {4}const [a-zA-Z]+)/g);
148
+ if (integrations.length > 0) {
149
+ list = list.concat('\n');
150
+ }
151
+ integrations.forEach((integ) => {
152
+ const i = integ.replace(/Test-append/g, `Test-${adapterName}`);
153
+ let remain = true;
154
+ // This portion determines if this part is a body parameter or test. Note that both body parameters and tests are both versioned if necessary.
155
+ let bodyParamMatch = i.match(/const [a-zA-Z]+BodyParam/g);
156
+ if (bodyParamMatch && list.match(bodyParamMatch[0])) {
157
+ if (reAddingMethods && !reAddingMethods.bodyParams) {
158
+ reAddingMethods.bodyParams = [];
159
+ }
160
+ reAddingMethods.bodyParams.push(i);
161
+ return;
162
+ }
163
+ toAppendNames.forEach((n) => {
164
+ if (list.includes('#'.concat(n, ' - ')) && i.includes('#'.concat(n, ' - '))) {
165
+ remain = false;
166
+ if (reAddingMethods[n] && !reAddingMethods[n].integration) {
167
+ reAddingMethods[n].integration = i;
168
+ }
169
+ } else if (list.includes('#'.concat(n, 'Emit - ')) && i.includes('#'.concat(n, 'Emit - '))) {
170
+ remain = false;
171
+ if (reAddingEmitMethods[n] && !reAddingEmitMethods[n].integration) {
172
+ reAddingEmitMethods[n].integration = i;
173
+ }
174
+ }
175
+ });
176
+ if (remain) {
177
+ list = list.concat(i);
178
+ }
179
+ });
180
+ list = list.replace('\n\n\n ', '\n\n ').concat(last);
181
+ fs.writeFileSync(path.join(__dirname, '../test/integration/adapterTestIntegration.js'), list);
182
+ } else {
183
+ console.log('Your integration test file does not exist, will not delete or add any tests.');
184
+ }
185
+
186
+ const uEntitiesDir = path.join(__dirname, `./${folder}/components/entities/`);
187
+ const uEntities = fs.readdirSync(uEntitiesDir, { withFileTypes: true })
188
+ .filter(files => files.isDirectory())
189
+ .map(files => files.name);
190
+
191
+ const entitiesDir = path.join(__dirname, '../entities');
192
+ const entities = fs.readdirSync(entitiesDir, { withFileTypes: true })
193
+ .filter(files => files.isDirectory())
194
+ .map(files => files.name);
195
+ const filtered = [];
196
+ entities.forEach((e) => {
197
+ if (!filtered.includes(e)) {
198
+ filtered.push(e);
199
+ }
200
+ });
201
+ if (!fs.existsSync(path.join(__dirname, '../entities'))) {
202
+ fs.mkdirSync(path.join(__dirname, '../entities'));
203
+ }
204
+
205
+ uEntities.forEach((e) => {
206
+ // If an entity that may attempt to have an action removed from it does not exist, it will be created with no actions in it. If it remains that way, a user can go and delete it later.
207
+ if (!fs.existsSync(path.join(__dirname, `../entities/${e}`))) {
208
+ fs.mkdirSync(path.join(__dirname, `../entities/${e}`));
209
+ fs.writeFileSync(path.join(__dirname, `../entities/${e}/action.json`), "{\n \"actions\": [\n ]\n}\n");
210
+ fs.writeFileSync(path.join(__dirname, `../entities/${e}/schema.json`), "{\n \"$id\": \"schema.json\",\n \"type\": \"object\",\n \"schema\": \"http://json-schema.org/draft-07/schema#\",\n \"translate\": false,\n \"dynamicfields\": true,\n \"properties\": {\n \"ph_request_type\": {\n \"type\": \"string\",\n \"description\": \"type of request (internal to adapter)\",\n \"default\": \"\",\n \"enum\": [\n ],\n \"external_name\": \"ph_request_type\"\n }\n },\n \"definitions\": {}\n}\n");
211
+ }
212
+ if (!fs.existsSync(path.join(__dirname, `../entities/${e}/action.json`))) {
213
+ fs.writeFileSync(path.join(__dirname, `../entities/${e}/action.json`), "{\n \"actions\": [\n ]\n}\n");
214
+ }
215
+ if (!fs.existsSync(path.join(__dirname, `../entities/${e}/schema.json`))) {
216
+ fs.writeFileSync(path.join(__dirname, `../entities/${e}/schema.json`), "{\n \"$id\": \"schema.json\",\n \"type\": \"object\",\n \"schema\": \"http://json-schema.org/draft-07/schema#\",\n \"translate\": false,\n \"dynamicfields\": true,\n \"properties\": {\n \"ph_request_type\": {\n \"type\": \"string\",\n \"description\": \"type of request (internal to adapter)\",\n \"default\": \"\",\n \"enum\": [\n ],\n \"external_name\": \"ph_request_type\"\n }\n },\n \"definitions\": {}\n}\n");
217
+ }
218
+ // The entities that will have functions deleted from them.
219
+ const thisEntityNames = names.toDelByName.filter(n => n.name === e).map(n => n.fnName);
220
+
221
+ // The entities that will have functions appended to them.
222
+ const thisMethodEntity = curAppByName.filter(n => n.name === e).map(n => n.fnName);
223
+
224
+ let aFile = JSON.parse(fs.readFileSync(path.join(__dirname, `../entities/${e}/action.json`), 'utf8'));
225
+ const aCopy = JSON.parse(JSON.stringify(aFile));
226
+ aFile.actions = aFile.actions.filter(a => !thisEntityNames.includes(a.name));
227
+
228
+ if (fs.readFileSync(path.join(__dirname, `./${folder}/components/entities/${e}/action.json`), 'utf8') !== '[]') {
229
+ let acts = JSON.parse(fs.readFileSync(path.join(__dirname, `./${folder}/components/entities/${e}/action.json`), 'utf8'));
230
+ acts.forEach((a) => {
231
+ if (reAddingMethods && Object.keys(reAddingMethods).includes(a.name)) {
232
+ reAddingMethods[a.name].action = a;
233
+ } else if (thisMethodEntity.includes(a.name) && !aFile.actions.map(ac => ac.name).includes(a.name)) {
234
+ aFile.actions.push(a);
235
+ }
236
+ });
237
+ fs.writeFileSync(path.join(__dirname, `../entities/${e}/action.json`), JSON.stringify(aFile, null, 2));
238
+ }
239
+
240
+ let sFile = JSON.parse(fs.readFileSync(path.join(__dirname, `../entities/${e}/schema.json`), 'utf8'));
241
+ sFile.properties.ph_request_type.enum = sFile.properties.ph_request_type.enum.filter(p => !thisEntityNames.includes(p));
242
+ if (fs.readFileSync(path.join(__dirname, `./${folder}/components/entities/${e}/schema.json`), 'utf8') !== '[]') {
243
+ let sches = JSON.parse(fs.readFileSync(path.join(__dirname, `./${folder}/components/entities/${e}/schema.json`), 'utf8')).properties.ph_request_type.enum;
244
+ sches.forEach((s) => {
245
+ if (reAddingMethods && Object.keys(reAddingMethods).includes(s)) {
246
+ reAddingMethods[s].schema = s;
247
+ } else if (thisMethodEntity.includes(s) && !sFile.properties.ph_request_type.enum.includes(s)) {
248
+ sFile.properties.ph_request_type.enum.push(s);
249
+ }
250
+ });
251
+ fs.writeFileSync(path.join(__dirname, `../entities/${e}/schema.json`), JSON.stringify(sFile, null, 2));
252
+ }
253
+
254
+ if (!fs.existsSync(path.join(__dirname, `../entities/${e}/mockdatafiles`))) {
255
+ fs.mkdirSync(path.join(__dirname, `../entities/${e}/mockdatafiles`));
256
+ }
257
+ const mock = JSON.parse(fs.readFileSync(path.join(__dirname, `./${folder}/components/entities/${e}/mockdatafiles/mockdata.json`), 'utf8'));
258
+ mock.forEach((m) => {
259
+ if (m.entity === e) {
260
+ // Currently do not have a .id field in the mock data (will always end in -default); future improvement.
261
+ const fileName = m.name || m.function.concat(m.id || '-default.json');
262
+ if (!fs.existsSync(path.join(__dirname, `../entities/${e}/mockdatafiles/${fileName}`)) || toUpdateNames.includes(m.function) || !aCopy.actions.map(ac => ac.name).includes(m.function)) {
263
+ fs.writeFileSync(path.join(__dirname, `../entities/${e}/mockdatafiles/${fileName}`), JSON.stringify(m.contents, null, 2));
264
+ }
265
+ }
266
+ });
267
+ // thisEntityNames.forEach((n) => {
268
+ // console.log(`We are not currently deleting existing mock data. path entities/${e}/mockdatafiles/${n}-default.json is intact if it exists.`);
269
+ // });
270
+ });
271
+
272
+ if (fs.existsSync(path.join(__dirname, '../adapter.js'))) {
273
+ let adFile = fs.readFileSync(path.join(__dirname, '../adapter.js'), 'utf8');
274
+ let splitArray = adFile.split('}\n\nmodule');
275
+ //if (splitArray[1] === undefined) {
276
+ //splitArray = adFile.split('}\nmodule');
277
+ //}
278
+
279
+ // const last = adFile.split('\n').slice(adFile.split('\n').length - 4).join('\n');
280
+ let list = adFile.split('\n').slice(0, adFile.split('\n').length - 4).join('\n').split(/(?=\n {2}\/\*\*\n {3}\* @summary)/g).filter((u) => {
281
+ let remain = true;
282
+ toDeleteNames.forEach((n) => {
283
+ if (u.indexOf('\n '.concat(n, '(')) >= 0) {
284
+ remain = false;
285
+ } else if (reAddingMethods && Object.keys(reAddingMethods).includes(n)) {
286
+ remain = false;
287
+ reAddingMethods[n].adapter = u;
288
+ }
289
+ });
290
+ return remain;
291
+ }).join('');
292
+ let adChanges = fs.readFileSync(path.join(__dirname, `./${folder}/components/adapter.js`), 'utf8');
293
+ const adMethods = adChanges.split(/(?=\n {2}\/\*\*\n {3}\* @function)/g);
294
+ if (adMethods.length > 0) {
295
+ list = list.concat('\n');
296
+ }
297
+ adMethods.forEach((a) => {
298
+ let remain = true;
299
+ //console.log(toAppendNames);
300
+
301
+ toAppendNames.forEach((n) => {
302
+ if (list.includes(n.concat('(')) && a.includes(n.concat('('))) {
303
+ let checkPrefix = a.split('@function ');
304
+ checkPrefix = checkPrefix[1].split('\n');
305
+ checkPrefix = checkPrefix[0];
306
+ if (checkPrefix === n) {
307
+ remain = false;
308
+ if (reAddingMethods[n] && !reAddingMethods[n].adapter) {
309
+ reAddingMethods[n].adapter = a;
310
+ }
311
+ }
312
+ }
313
+ });
314
+ /**
315
+ toAppendNames.forEach((n) => {
316
+ if (list.includes(n.concat('(')) && a.includes(n.concat('('))) {
317
+ remain = false;
318
+ if (reAddingMethods[n] && !reAddingMethods[n].adapter) {
319
+ reAddingMethods[n].adapter = a;
320
+ }
321
+ }
322
+ });
323
+ **/
324
+ if (remain) {
325
+ list = list.concat(a);
326
+ }
327
+ });
328
+ list = list.concat('}\n\nmodule', splitArray[1]);
329
+ fs.writeFileSync(path.join(__dirname, '../adapter.js'), list);
330
+ }
331
+
332
+ // This is the object to be used in determining what version to assign methods that already exist.
333
+ let versionList = {};
334
+ if (fs.existsSync(path.join(__dirname, '../versions.json'))) {
335
+ versionList = JSON.parse(fs.readFileSync(path.join(__dirname, '../versions.json'), 'utf8'));
336
+ }
337
+
338
+ const newAdapter = fs.readFileSync(path.join(__dirname, '../adapter.js'), 'utf8');
339
+ const methods = newAdapter.match(/\n {2}[a-zA-Z]+\(/g).map(s => s.substr(3, s.length - 4));
340
+ let aRet = fs.readFileSync(path.join(__dirname, '../adapter.js'), 'utf8');
341
+ let versionedAdapters = "";
342
+ methods.forEach((m) => {
343
+ if (['constructor', 'hasEntity', 'verifyCapability', 'updateEntityCache'].includes(m)) {
344
+ versionList[m] = -1;
345
+ return;
346
+ // Those are the default methods: should not ever change unless by user directly or itential update.
347
+ } else if (!Object.keys(versionList).includes(m)) {
348
+ versionList[m] = 0;
349
+ // This method does not yet exist, it will be added as the original (version 0).
350
+ }
351
+ // console.log(reAddingMethods['uploadFile']);
352
+ if (typeof reAddingMethods[m] !== 'undefined') {
353
+ versionList[m] += 1;
354
+ const newMethodName = `${m}__v${versionList[m]}`; // The old name, double underscore then v(version#)
355
+ //console.log(newMethodName);
356
+ // The below code replaces all existences of the previous name with the new one in the relevant files, then performs an append as it would if this were a unique method.
357
+ const ph = JSON.parse(fs.readFileSync(path.join(__dirname, '../pronghorn.json'), 'utf8'));
358
+ reAddingMethods[m].pronghorn.name = newMethodName;
359
+ reAddingMethods[m].pronghorn.route.path = `\/${newMethodName}`;
360
+ ph.methods.push(reAddingMethods[m].pronghorn);
361
+ fs.writeFileSync(path.join(__dirname, '../pronghorn.json'), JSON.stringify(ph, null, 2));
362
+
363
+ const uFile = fs.readFileSync(path.join(__dirname, '../test/unit/adapterTestUnit.js'), 'utf8');
364
+ const uLast = uFile.split('\n').slice(uFile.split('\n').length - 3).join('\n');
365
+
366
+ if (typeof reAddingMethods[m].unit !== 'undefined') {
367
+ reAddingMethods[m].unit = reAddingMethods[m].unit.replace(`#${m} `, `#${newMethodName} `).replace(`\.${m} `, `\.${newMethodName} `).replace(` ${m} `, ` ${newMethodName} `);
368
+ const re = new RegExp(`\\.${m}\\(`, 'g');
369
+ const re1 = new RegExp(`-${m}\\'`, 'g');
370
+ reAddingMethods[m].unit = reAddingMethods[m].unit.replace(re, `\.${newMethodName}\(`);
371
+ reAddingMethods[m].unit = reAddingMethods[m].unit.replace(re1, `-${newMethodName}\'`);
372
+ const uRet = uFile.split('\n').slice(0, uFile.split('\n').length - 3).join('\n').concat('\n', reAddingMethods[m].unit, uLast);
373
+ fs.writeFileSync(path.join(__dirname, '../test/unit/adapterTestUnit.js'), uRet);
374
+ }
375
+
376
+ const iFile = fs.readFileSync(path.join(__dirname, '../test/integration/adapterTestIntegration.js'), 'utf8');
377
+ const iLast = iFile.split('\n').slice(iFile.split('\n').length - 3).join('\n');
378
+
379
+ if (typeof reAddingMethods[m].integration !== 'undefined') {
380
+ reAddingMethods[m].integration = reAddingMethods[m].integration.replace(`#${m} - `, `#${newMethodName} - `).replace(`\.${m}\(`, `\.${newMethodName}\(`).replace(`\'${m}\'`, `\'${newMethodName}\'`).concat(reAddingMethods[m].integration.endsWith('\n') ? '' : '\n');
381
+
382
+ // check for typeof undefined
383
+ if (typeof reAddingMethods.bodyParams !== 'undefined') {
384
+ reAddingMethods.bodyParams.forEach((b) => {
385
+ const varName = b.split(' = ')[0].substring(10);
386
+ if (reAddingMethods[m].integration.match(new RegExp(varName.concat(',')))) {
387
+ const nb = b.replace(varName, `${varName}__v${versionList[m]}`);
388
+ reAddingMethods[m].integration = nb.concat(reAddingMethods[m].integration);
389
+ reAddingMethods[m].integration = reAddingMethods[m].integration.replace(new RegExp(varName.concat(','), 'g'), varName.concat(`__v${versionList[m]},`));
390
+ }
391
+ });
392
+ }
393
+
394
+ const iRet = iFile.split('\n').slice(0, iFile.split('\n').length - 3).join('\n').concat('\n', reAddingMethods[m].integration, iLast);
395
+ fs.writeFileSync(path.join(__dirname, '../test/integration/adapterTestIntegration.js'), iRet);
396
+ }
397
+
398
+ const thisMethodEntity = curAppByName.filter(a => a.fnName === m)[0].name;
399
+ const action = JSON.parse(fs.readFileSync(path.join(__dirname, `../entities/${thisMethodEntity}/action.json`)));
400
+
401
+ if (typeof reAddingMethods[m].action !== 'undefined') {
402
+ reAddingMethods[m].action.name = newMethodName;
403
+ reAddingMethods[m].action.responseObjects.forEach((r) => {
404
+ r.mockFile = r.mockFile.replace(m, newMethodName);
405
+ });
406
+ action.actions.push(reAddingMethods[m].action);
407
+ fs.writeFileSync(path.join(__dirname, `../entities/${thisMethodEntity}/action.json`), JSON.stringify(action, null, 2));
408
+ }
409
+ if (fs.readFileSync(path.join(__dirname, `./${folder}/components/entities/${thisMethodEntity}/schema.json`), 'utf8') !== '[]') {
410
+ const schema = JSON.parse(fs.readFileSync(path.join(__dirname, `../entities/${thisMethodEntity}/schema.json`)));
411
+ reAddingMethods[m].schema = newMethodName;
412
+ schema.properties.ph_request_type.enum.push(reAddingMethods[m].schema);
413
+ fs.writeFileSync(path.join(__dirname, `../entities/${thisMethodEntity}/schema.json`), JSON.stringify(schema, null, 2));
414
+ }
415
+
416
+ const mock = JSON.parse(fs.readFileSync(path.join(__dirname, `./${folder}/components/entities/${thisMethodEntity}/mockdatafiles/mockdata.json`), 'utf8'));
417
+ mock.forEach((mo) => {
418
+ const moc = mo;
419
+ if (moc.function === m && thisMethodEntity === moc.entity) {
420
+ moc.name = moc.name.replace(m, newMethodName);
421
+ moc.function = newMethodName;
422
+ fs.writeFileSync(path.join(__dirname, `../entities/${thisMethodEntity}/mockdatafiles/${moc.name}`), JSON.stringify(moc.contents, null, 2));
423
+ }
424
+ });
425
+
426
+ if (typeof reAddingMethods[m].adapter !== 'undefined') {
427
+ reAddingMethods[m].adapter = reAddingMethods[m].adapter.replace(`\n ${m}(`, `\n ${newMethodName}(`).replace(`\@function ${m}`, `\@function ${newMethodName}`).replace(`adapter-${m}\'`, `adapter-${newMethodName}\'`).replace(new RegExp(`\'${m}\'`, 'g'), `\'${newMethodName}\'`);
428
+ versionedAdapters = versionedAdapters.concat('\n', reAddingMethods[m].adapter).replace(/\n{2,}/, '\n');
429
+ }
430
+ }
431
+
432
+ if (reAddingEmitMethods[m]) {
433
+ const newMethodName = `${m}__v${versionList[m]}`;
434
+ const newEmitMethodName = `${m}Emit__v${versionList[m]}`; // The old name, double underscore then v(version#)
435
+
436
+ const uFile = fs.readFileSync(path.join(__dirname, '../test/unit/adapterTestUnit.js'), 'utf8');
437
+ const uLast = uFile.split('\n').slice(uFile.split('\n').length - 3).join('\n');
438
+
439
+ if (typeof reAddingEmitMethods[m].unit !== 'undefined') {
440
+ reAddingEmitMethods[m].unit = reAddingEmitMethods[m].unit.replace(`#${m}Emit `, `#${newEmitMethodName} `).replace(`\.${m}Emit `, `\.${newEmitMethodName} `).replace(` ${m}Emit `, ` ${newEmitMethodName} `).replace(`\.${m}Emit\(`, `\.${newEmitMethodName}\(`).replace(`-${m}\'`, `-${newMethodName}\'`);
441
+ const uRet = uFile.split('\n').slice(0, uFile.split('\n').length - 3).join('\n').concat(reAddingEmitMethods[m].unit, uLast);
442
+ fs.writeFileSync(path.join(__dirname, '../test/unit/adapterTestUnit.js'), uRet);
443
+ }
444
+
445
+ const iFile = fs.readFileSync(path.join(__dirname, '../test/integration/adapterTestIntegration.js'), 'utf8');
446
+ const iLast = iFile.split('\n').slice(iFile.split('\n').length - 3).join('\n');
447
+
448
+ if (typeof reAddingEmitMethods[m].integration !== 'undefined') {
449
+ reAddingEmitMethods[m].integration = reAddingEmitMethods[m].integration.replace(`#${m}Emit - `, `#${newEmitMethodName} - `).replace(`\.${m}Emit\(`, `\.${newEmitMethodName}\(`).replace(`\'${m}Emit\'`, `\'${newEmitMethodName}\'`).concat(reAddingEmitMethods[m].integration.endsWith('\n') ? '' : '\n');
450
+
451
+ // check for typeof undefined
452
+ if (typeof reAddingEmitMethods.bodyParams !== 'undefined') {
453
+ reAddingEmitMethods.bodyParams.forEach((b) => {
454
+ const varName = b.split(' = ')[0].substring(10);
455
+ if (reAddingEmitMethods[m].integration.match(new RegExp(varName.concat(',')))) {
456
+ const nb = b.replace(varName, `${varName}__v${versionList[m]}`);
457
+ reAddingEmitMethods[m].integration = nb.concat(reAddingEmitMethods[m].integration);
458
+ reAddingEmitMethods[m].integration = reAddingEmitMethods[m].integration.replace(new RegExp(varName.concat(','), 'g'), varName.concat(`__v${versionList[m]},`));
459
+ }
460
+ });
461
+ }
462
+
463
+ const iRet = iFile.split('\n').slice(0, iFile.split('\n').length - 3).join('\n').concat('\n', reAddingEmitMethods[m].integration, iLast);
464
+ fs.writeFileSync(path.join(__dirname, '../test/integration/adapterTestIntegration.js'), iRet);
465
+ }
466
+ }
467
+ });
468
+
469
+
470
+ // Read in the adapter.js file and add the versioned adapters to the end. String manipulation to add correct brackets & export
471
+ if (versionedAdapters != "") {
472
+ let finalAdapter = fs.readFileSync(path.join(__dirname, '../adapter.js'), 'utf8');
473
+ const splitArray = finalAdapter.split('}\n\nmodule');
474
+ // const aFinal = finalAdapter.split('\n').slice(finalAdapter.split('\n').length - 4).join('\n')
475
+ // finalAdapter = finalAdapter.replace(aFinal, "");
476
+ // const adapterNameCaps = adapterName.charAt(0).toUpperCase() + adapterName.slice(1);
477
+ finalAdapter = splitArray[0].concat(versionedAdapters, '}\n\nmodule', splitArray[1]);
478
+
479
+ // write the new adapter.js and updated versions.json
480
+ fs.writeFileSync(path.join(__dirname, '../adapter.js'), finalAdapter);
481
+
482
+ }
483
+
484
+ fs.writeFileSync(path.join(__dirname, '../versions.json'), JSON.stringify(versionList, null, 2));
485
+
486
+ // Here, the lint, unit, and integration tests are run to ensure the operations succeeded. If not, the user may have to go and fix things.
487
+ console.log('Update Done\n')
488
+ console.log('Linting...\n');
489
+ const lint = spawn('npm', ['run', 'lint'], {
490
+ cwd: path.join(__dirname, '..')
491
+ });
492
+ let testLintErr = '';
493
+ lint.stderr.on('data', (err) => {
494
+ testLintErr = testLintErr.concat(err);
495
+ });
496
+ let testLintOut = '';
497
+ lint.stdout.on('data', (out) => {
498
+ testLintOut = testLintOut.concat(out);
499
+ });
500
+ lint.on('close', (code) => {
501
+ console.log(`Lint exited with code ${code}`);
502
+ if (code == 0) {
503
+ console.log('Lint test passed with no errors');
504
+ console.log('\n\nRunning unit and integration tests...\n\n');
505
+ } else {
506
+ console.log(testLintErr);
507
+ console.log('\n\nRunning unit and integration tests...\n\n')
508
+ }
509
+ });
510
+
511
+ const tests = spawn('npm', ['run', 'test'], {
512
+ cwd: path.join(__dirname, '..')
513
+ });
514
+ let testErr = '';
515
+ tests.stderr.on('data', (err) => {
516
+ testErr = testErr.concat(err);
517
+ });
518
+ let testOut = '';
519
+ tests.stdout.on('data', (out) => {
520
+ testOut = testOut.concat(out);
521
+ });
522
+ tests.on('close', (code) => {
523
+ console.log(`Tests exited with code ${code}`);
524
+ if (code === 0) {
525
+ console.log(testOut);
526
+ } else {
527
+ console.log(testErr);
528
+ }
529
+ });
530
+ }
531
+
532
+ run();