@stack-spot/portal-network 1.0.0-betaadp.2 → 1.0.0-dev.1768422812092

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 (230) hide show
  1. package/CHANGELOG.md +633 -0
  2. package/dist/api/account.d.ts +413 -277
  3. package/dist/api/account.d.ts.map +1 -1
  4. package/dist/api/account.js +261 -176
  5. package/dist/api/account.js.map +1 -1
  6. package/dist/api/accountAssetManager.d.ts +309 -0
  7. package/dist/api/accountAssetManager.d.ts.map +1 -0
  8. package/dist/api/accountAssetManager.js +169 -0
  9. package/dist/api/accountAssetManager.js.map +1 -0
  10. package/dist/api/agent-tools.d.ts +243 -149
  11. package/dist/api/agent-tools.d.ts.map +1 -1
  12. package/dist/api/agent-tools.js +77 -5
  13. package/dist/api/agent-tools.js.map +1 -1
  14. package/dist/api/agent.d.ts +55 -55
  15. package/dist/api/agent.d.ts.map +1 -1
  16. package/dist/api/ai.d.ts +487 -98
  17. package/dist/api/ai.d.ts.map +1 -1
  18. package/dist/api/ai.js +427 -146
  19. package/dist/api/ai.js.map +1 -1
  20. package/dist/api/cloudPlatform.d.ts +374 -221
  21. package/dist/api/cloudPlatform.d.ts.map +1 -1
  22. package/dist/api/cloudPlatform.js +299 -93
  23. package/dist/api/cloudPlatform.js.map +1 -1
  24. package/dist/api/cloudPlatformHorizon.d.ts +178 -9
  25. package/dist/api/cloudPlatformHorizon.d.ts.map +1 -1
  26. package/dist/api/cloudPlatformHorizon.js +69 -1
  27. package/dist/api/cloudPlatformHorizon.js.map +1 -1
  28. package/dist/api/codeShift.d.ts +1125 -83
  29. package/dist/api/codeShift.d.ts.map +1 -1
  30. package/dist/api/codeShift.js +538 -16
  31. package/dist/api/codeShift.js.map +1 -1
  32. package/dist/api/dataIntegration.d.ts +291 -1
  33. package/dist/api/dataIntegration.d.ts.map +1 -1
  34. package/dist/api/dataIntegration.js +254 -0
  35. package/dist/api/dataIntegration.js.map +1 -1
  36. package/dist/api/discover.d.ts +380 -0
  37. package/dist/api/discover.d.ts.map +1 -0
  38. package/dist/api/discover.js +256 -0
  39. package/dist/api/discover.js.map +1 -0
  40. package/dist/api/edpBfa.d.ts +215 -0
  41. package/dist/api/edpBfa.d.ts.map +1 -0
  42. package/dist/api/edpBfa.js +87 -0
  43. package/dist/api/edpBfa.js.map +1 -0
  44. package/dist/api/genAiInference.d.ts +22 -2
  45. package/dist/api/genAiInference.d.ts.map +1 -1
  46. package/dist/api/genAiInference.js +22 -3
  47. package/dist/api/genAiInference.js.map +1 -1
  48. package/dist/api/workflows.d.ts +68 -5
  49. package/dist/api/workflows.d.ts.map +1 -1
  50. package/dist/api/workflows.js +16 -0
  51. package/dist/api/workflows.js.map +1 -1
  52. package/dist/api/workspaceManager.d.ts +16 -10
  53. package/dist/api/workspaceManager.d.ts.map +1 -1
  54. package/dist/api/workspaceManager.js +10 -0
  55. package/dist/api/workspaceManager.js.map +1 -1
  56. package/dist/api-addresses.d.ts +20 -18
  57. package/dist/api-addresses.d.ts.map +1 -1
  58. package/dist/api-addresses.js +81 -21
  59. package/dist/api-addresses.js.map +1 -1
  60. package/dist/apis-itau.json +241 -0
  61. package/dist/apis.json +18 -2
  62. package/dist/client/account-asset-manager.d.ts +112 -0
  63. package/dist/client/account-asset-manager.d.ts.map +1 -0
  64. package/dist/client/account-asset-manager.js +160 -0
  65. package/dist/client/account-asset-manager.js.map +1 -0
  66. package/dist/client/account.d.ts +265 -242
  67. package/dist/client/account.d.ts.map +1 -1
  68. package/dist/client/account.js +80 -34
  69. package/dist/client/account.js.map +1 -1
  70. package/dist/client/agent-tools.d.ts +166 -119
  71. package/dist/client/agent-tools.d.ts.map +1 -1
  72. package/dist/client/agent-tools.js +62 -11
  73. package/dist/client/agent-tools.js.map +1 -1
  74. package/dist/client/agent.d.ts +46 -46
  75. package/dist/client/agent.d.ts.map +1 -1
  76. package/dist/client/ai.d.ts +266 -79
  77. package/dist/client/ai.d.ts.map +1 -1
  78. package/dist/client/ai.js +262 -20
  79. package/dist/client/ai.js.map +1 -1
  80. package/dist/client/api-management.d.ts +10 -1
  81. package/dist/client/api-management.d.ts.map +1 -1
  82. package/dist/client/api-management.js +11 -2
  83. package/dist/client/api-management.js.map +1 -1
  84. package/dist/client/cloud-account.d.ts +13 -13
  85. package/dist/client/cloud-platform-horizon.d.ts +38 -19
  86. package/dist/client/cloud-platform-horizon.d.ts.map +1 -1
  87. package/dist/client/cloud-platform-horizon.js +19 -1
  88. package/dist/client/cloud-platform-horizon.js.map +1 -1
  89. package/dist/client/cloud-platform.d.ts +213 -46
  90. package/dist/client/cloud-platform.d.ts.map +1 -1
  91. package/dist/client/cloud-platform.js +168 -33
  92. package/dist/client/cloud-platform.js.map +1 -1
  93. package/dist/client/cloud-runtimes.d.ts +4 -4
  94. package/dist/client/cloud-services.d.ts +17 -17
  95. package/dist/client/cloud-services.d.ts.map +1 -1
  96. package/dist/client/code-shift.d.ts +535 -162
  97. package/dist/client/code-shift.d.ts.map +1 -1
  98. package/dist/client/code-shift.js +296 -7
  99. package/dist/client/code-shift.js.map +1 -1
  100. package/dist/client/content.d.ts +127 -132
  101. package/dist/client/content.d.ts.map +1 -1
  102. package/dist/client/data-integration.d.ts +92 -53
  103. package/dist/client/data-integration.d.ts.map +1 -1
  104. package/dist/client/data-integration.js +38 -2
  105. package/dist/client/data-integration.js.map +1 -1
  106. package/dist/client/discover.d.ts +84 -0
  107. package/dist/client/discover.d.ts.map +1 -0
  108. package/dist/client/discover.js +359 -0
  109. package/dist/client/discover.js.map +1 -0
  110. package/dist/client/edp-bfa.d.ts +16 -0
  111. package/dist/client/edp-bfa.d.ts.map +1 -0
  112. package/dist/client/edp-bfa.js +24 -0
  113. package/dist/client/edp-bfa.js.map +1 -0
  114. package/dist/client/event-bus.d.ts.map +1 -1
  115. package/dist/client/gen-ai-inference.d.ts +20 -20
  116. package/dist/client/insights.d.ts +7 -7
  117. package/dist/client/notification.d.ts +17 -10
  118. package/dist/client/notification.d.ts.map +1 -1
  119. package/dist/client/notification.js +10 -1
  120. package/dist/client/notification.js.map +1 -1
  121. package/dist/client/runtime-manager.d.ts +8 -8
  122. package/dist/client/secrets.d.ts.map +1 -1
  123. package/dist/client/secrets.js +1 -1
  124. package/dist/client/secrets.js.map +1 -1
  125. package/dist/client/types.d.ts +50 -7
  126. package/dist/client/types.d.ts.map +1 -1
  127. package/dist/client/workflow.d.ts +10 -10
  128. package/dist/client/workspace-ai.d.ts +53 -53
  129. package/dist/client/workspace-ai.d.ts.map +1 -1
  130. package/dist/client/workspace-ai.js +3 -7
  131. package/dist/client/workspace-ai.js.map +1 -1
  132. package/dist/client/workspace-manager.d.ts +115 -76
  133. package/dist/client/workspace-manager.d.ts.map +1 -1
  134. package/dist/client/workspace-manager.js +47 -2
  135. package/dist/client/workspace-manager.js.map +1 -1
  136. package/dist/client/workspace-search.d.ts +2 -2
  137. package/dist/client/workspace.d.ts +58 -105
  138. package/dist/client/workspace.d.ts.map +1 -1
  139. package/dist/error/DefaultAPIError.d.ts.map +1 -1
  140. package/dist/error/DefaultAPIError.js.map +1 -1
  141. package/dist/error/StackspotAPIError.d.ts +3 -4
  142. package/dist/error/StackspotAPIError.d.ts.map +1 -1
  143. package/dist/error/StackspotAPIError.js +3 -3
  144. package/dist/error/StackspotAPIError.js.map +1 -1
  145. package/dist/error/dictionary/accountAssetManager.d.ts +11 -0
  146. package/dist/error/dictionary/accountAssetManager.d.ts.map +1 -0
  147. package/dist/error/dictionary/accountAssetManager.js +11 -0
  148. package/dist/error/dictionary/accountAssetManager.js.map +1 -0
  149. package/dist/error/dictionary/cloud-platform.d.ts +76 -8
  150. package/dist/error/dictionary/cloud-platform.d.ts.map +1 -1
  151. package/dist/error/dictionary/cloud-platform.js +80 -12
  152. package/dist/error/dictionary/cloud-platform.js.map +1 -1
  153. package/dist/error/dictionary/workspace-ai.d.ts +9 -0
  154. package/dist/error/dictionary/workspace-ai.d.ts.map +1 -0
  155. package/dist/error/dictionary/workspace-ai.js +9 -0
  156. package/dist/error/dictionary/workspace-ai.js.map +1 -0
  157. package/dist/index.d.ts +6 -4
  158. package/dist/index.d.ts.map +1 -1
  159. package/dist/index.js +5 -3
  160. package/dist/index.js.map +1 -1
  161. package/dist/network/NetworkClient.d.ts +4 -2
  162. package/dist/network/NetworkClient.d.ts.map +1 -1
  163. package/dist/network/NetworkClient.js +16 -4
  164. package/dist/network/NetworkClient.js.map +1 -1
  165. package/dist/network/types.d.ts +2 -0
  166. package/dist/network/types.d.ts.map +1 -1
  167. package/dist/utils/StreamedJson.d.ts +3 -1
  168. package/dist/utils/StreamedJson.d.ts.map +1 -1
  169. package/dist/utils/StreamedJson.js +23 -3
  170. package/dist/utils/StreamedJson.js.map +1 -1
  171. package/package.dev.json +3 -0
  172. package/package.json +10 -9
  173. package/package.stg.json +3 -0
  174. package/readme.md +40 -1
  175. package/src/api/account.ts +701 -540
  176. package/src/api/accountAssetManager.ts +771 -0
  177. package/src/api/agent-tools.ts +332 -151
  178. package/src/api/ai.ts +891 -170
  179. package/src/api/cloudPlatform.ts +667 -298
  180. package/src/api/cloudPlatformHorizon.ts +412 -9
  181. package/src/api/codeShift.ts +2088 -97
  182. package/src/api/dataIntegration.ts +635 -1
  183. package/src/api/discover.ts +601 -0
  184. package/src/api/edpBfa.ts +472 -0
  185. package/src/api/genAiInference.ts +47 -4
  186. package/src/api/workflows.ts +100 -5
  187. package/src/api/workspaceManager.ts +25 -10
  188. package/src/api-addresses.ts +113 -38
  189. package/src/apis-itau.json +241 -0
  190. package/src/apis.json +18 -2
  191. package/src/client/account-asset-manager.ts +100 -0
  192. package/src/client/account.ts +71 -40
  193. package/src/client/agent-tools.ts +57 -17
  194. package/src/client/ai.ts +232 -20
  195. package/src/client/api-management.ts +7 -2
  196. package/src/client/cloud-platform-horizon.ts +12 -4
  197. package/src/client/cloud-platform.ts +101 -27
  198. package/src/client/code-shift.ts +196 -8
  199. package/src/client/data-integration.ts +28 -1
  200. package/src/client/discover.ts +319 -0
  201. package/src/client/edp-bfa.ts +24 -0
  202. package/src/client/notification.ts +6 -1
  203. package/src/client/secrets.ts +1 -1
  204. package/src/client/types.ts +55 -9
  205. package/src/client/workspace-ai.ts +19 -23
  206. package/src/client/workspace-manager.ts +31 -2
  207. package/src/error/DefaultAPIError.ts +5 -5
  208. package/src/error/StackspotAPIError.ts +4 -4
  209. package/src/error/dictionary/accountAssetManager.ts +12 -0
  210. package/src/error/dictionary/cloud-platform.ts +80 -12
  211. package/src/error/dictionary/workspace-ai.ts +10 -0
  212. package/src/index.ts +7 -4
  213. package/src/network/NetworkClient.ts +18 -6
  214. package/src/network/types.ts +3 -0
  215. package/src/utils/StreamedJson.tsx +19 -4
  216. package/dist/api/discovery.d.ts +0 -494
  217. package/dist/api/discovery.d.ts.map +0 -1
  218. package/dist/api/discovery.js +0 -205
  219. package/dist/api/discovery.js.map +0 -1
  220. package/dist/client/adp-mock.d.ts +0 -89
  221. package/dist/client/adp-mock.d.ts.map +0 -1
  222. package/dist/client/adp-mock.js +0 -246
  223. package/dist/client/adp-mock.js.map +0 -1
  224. package/dist/client/discovery.d.ts +0 -110
  225. package/dist/client/discovery.d.ts.map +0 -1
  226. package/dist/client/discovery.js +0 -133
  227. package/dist/client/discovery.js.map +0 -1
  228. package/src/api/discovery.ts +0 -729
  229. package/src/client/adp-mock.ts +0 -244
  230. package/src/client/discovery.ts +0 -73
@@ -48,10 +48,42 @@ import {
48
48
  updateRepositoryServiceV1ReposRepositoryIdPut,
49
49
  validateScmUrlServiceV1ReposValidateScmUrlPost,
50
50
  listUserServiceV1UsersGet,
51
+ analyticsProgramGroupsDetailsV1AnalyticsProgramGroupsDetailsGet,
52
+ analyticsProgramGroupsDetailsDownloadV1AnalyticsProgramGroupsDetailsDownloadGet,
53
+ getModuleInputsV1ModulesModuleIdInputsGet,
54
+ analyticsRepositoryDetailedReportDownloadV1AnalyticsRepositoriesDetailsDownloadGet,
55
+ analyticsRepositoryDetailedReportV1AnalyticsRepositoriesDetailsGet,
56
+ listRepositoryDownloadServiceV1ReposDownloadGet,
57
+ listProgramGroupDownloadServiceV1ProgramGroupsDownloadGet,
58
+ getModuleV1ModulesModuleIdGet,
59
+ analyticsProgramGroupsTargetDetailsV1AnalyticsProgramGroupsTargetDetailsGet,
60
+ analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet,
61
+ searchReposScmServiceV2ReposSearchScmPost,
62
+ importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost,
63
+ searchReposScmV2V2ReposSearchScmSearchIdGet,
64
+ analyticsRepositoryTargetDetailsV1AnalyticsRepositoriesTargetDetailsGet,
65
+ analyticsRepositoryTargetDetailsDownloadV1AnalyticsRepositoriesTargetDetailsDownloadGet,
66
+ putCustomerRatingReportV1ReportsReportIdCustomerRatingPut,
67
+ updateModuleServiceV1ModulesModuleIdPut,
68
+ downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet,
69
+ moduleFavoriteServiceAddV1ModulesModuleIdFavoritesPost,
70
+ moduleFavoriteServiceDeleteV1ModulesModuleIdFavoritesDelete,
71
+ patHealthCheckV1ScmPatHealthCheckGet,
72
+ getModuleDocsV1ModulesModuleIdDocsGet,
73
+ analyticsModuleExecutionTimesReportV1AnalyticsModulesExecutionTimesGet,
74
+ analyticsModuleExecutionTimesDownloadV1AnalyticsModulesExecutionTimesDownloadGet,
75
+ createReposBatchServiceV2ReposBatchPost,
76
+ getImportResultV2ReposBatchImportIdGet,
77
+ downloadImportResultV2ReposBatchImportIdDownloadGet,
78
+ deleteModuleServiceV1ModulesModuleIdDelete,
79
+ createRepositoryServiceV2ReposPost,
80
+ listRepositoryServiceV2ReposGet,
81
+ listModuleExecutionBatchActivitiesV1ActivitiesModuleExecutionBatchGet,
82
+ getModuleExecutionBatchActivitiesByIdV1ActivitiesModuleExecutionBatchModuleExecutionBatchIdGet,
51
83
  } from '../api/codeShift'
52
84
  import { DefaultAPIError } from '../error/DefaultAPIError'
53
85
  import { codeShiftDictionary } from '../error/dictionary/code-shift'
54
- import { StackspotAPIError } from '../error/StackspotAPIError'
86
+ import { StackspotAPIError } from '../error/StackspotAPIError'
55
87
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
56
88
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
57
89
  import { getApiAddresses } from '../api-addresses'
@@ -69,14 +101,34 @@ class CodeShift extends ReactQueryNetworkClient {
69
101
  * Creates a repository.
70
102
  */
71
103
  createRepository = this.mutation(removeAuthorizationParam(createRepositoryServiceV1ReposPost))
104
+ /**
105
+ * Creates a repository (v2).
106
+ */
107
+ createRepositoryV2 = this.mutation(removeAuthorizationParam(createRepositoryServiceV2ReposPost))
72
108
  /**
73
109
  * Creates repositories in batch.
74
110
  */
75
111
  createRepositoriesBatch = this.mutation(removeAuthorizationParam(createReposBatchServiceV1ReposBatchPost))
112
+ /**
113
+ * Imports repositories in batch.
114
+ */
115
+ createRepositoriesBatchV2 = this.mutation(removeAuthorizationParam(createReposBatchServiceV2ReposBatchPost))
116
+ /**
117
+ * Gets the status of a batch import.
118
+ */
119
+ getImportBatchResultsV2 = this.query(removeAuthorizationParam(getImportResultV2ReposBatchImportIdGet))
120
+ /**
121
+ * Downloads the import result for a batch.
122
+ */
123
+ downloadImportBatchResultsV2 = this.query(removeAuthorizationParam(downloadImportResultV2ReposBatchImportIdDownloadGet))
76
124
  /**
77
125
  * Gets list of repositories.
78
126
  */
79
127
  repositories = this.query(removeAuthorizationParam(listRepositoryServiceV1ReposGet))
128
+ /**
129
+ * Gets list of repositories (v2).
130
+ */
131
+ repositoriesV2 = this.query(removeAuthorizationParam(listRepositoryServiceV2ReposGet))
80
132
  /**
81
133
  * Gets a repository
82
134
  */
@@ -89,6 +141,10 @@ class CodeShift extends ReactQueryNetworkClient {
89
141
  * Updates a repository
90
142
  */
91
143
  updateRepository = this.mutation(removeAuthorizationParam(updateRepositoryServiceV1ReposRepositoryIdPut))
144
+ /**
145
+ * List Repository Download Service
146
+ */
147
+ repositoryDownload = this.query(removeAuthorizationParam(listRepositoryDownloadServiceV1ReposDownloadGet))
92
148
  /**
93
149
  * Get a report for a pull request by id.
94
150
  */
@@ -97,14 +153,42 @@ class CodeShift extends ReactQueryNetworkClient {
97
153
  * Gets modules.
98
154
  */
99
155
  modules = this.query(removeAuthorizationParam(listModulesServiceV1ModulesGet))
156
+ /**
157
+ * Gets module by id.
158
+ */
159
+ module = this.query(removeAuthorizationParam(getModuleV1ModulesModuleIdGet))
160
+ /**
161
+ * Deletes a module by id.
162
+ */
163
+ deleteModule = this.mutation(removeAuthorizationParam(deleteModuleServiceV1ModulesModuleIdDelete))
164
+ /**
165
+ * Add a module in favorites.
166
+ */
167
+ addFavoriteModule = this.mutation(removeAuthorizationParam(moduleFavoriteServiceAddV1ModulesModuleIdFavoritesPost))
168
+ /**
169
+ * Remove a module from favorites.
170
+ */
171
+ removeFavoriteModule = this.mutation(removeAuthorizationParam(moduleFavoriteServiceDeleteV1ModulesModuleIdFavoritesDelete))
172
+ /**
173
+ * Gets module inputs.
174
+ */
175
+ modulesInputs = this.query(removeAuthorizationParam(getModuleInputsV1ModulesModuleIdInputsGet))
100
176
  /**
101
177
  * Creates a module.
102
178
  */
103
179
  createModule = this.mutation(removeAuthorizationParam(createModuleServiceV1ModulesPost))
180
+ /**
181
+ * Updates a module.
182
+ */
183
+ updateModule = this.mutation(removeAuthorizationParam(updateModuleServiceV1ModulesModuleIdPut))
104
184
  /**
105
185
  * Generates a report.
106
186
  */
107
187
  generateReport = this.mutation(removeAuthorizationParam(dispatchModuleServiceV1ModulesDispatchesPost))
188
+ /**
189
+ * Gets module docs.
190
+ */
191
+ moduleDocs = this.query(removeAuthorizationParam(getModuleDocsV1ModulesModuleIdDocsGet))
108
192
  /**
109
193
  * Gets repository reports.
110
194
  */
@@ -117,6 +201,12 @@ class CodeShift extends ReactQueryNetworkClient {
117
201
  * Downloads a report as a csv file.
118
202
  */
119
203
  downloadReport = this.query(removeAuthorizationParam(downloadReportV1ReportsReportIdDownloadGet))
204
+ /**
205
+ * Put Customer Rating Report
206
+ */
207
+ updateReportRating = this.mutation(
208
+ removeAuthorizationParam(putCustomerRatingReportV1ReportsReportIdCustomerRatingPut),
209
+ )
120
210
  /**
121
211
  * Gets code shift settings
122
212
  */
@@ -134,9 +224,28 @@ class CodeShift extends ReactQueryNetworkClient {
134
224
  */
135
225
  searchRepositoryStatus = this.query(removeAuthorizationParam(getStatusSearchReposScmServiceV1ReposSearchScmSearchRepoIdStatusGet))
136
226
  /**
227
+ * @deprecated
137
228
  * Downloads file with found repositories
138
229
  */
139
230
  downloadSearchRepository = this.mutation(removeAuthorizationParam(downloadSearchReposScmServiceV1ReposSearchScmSearchRepoIdDownloadGet))
231
+ /**
232
+ * Searches for repositories (v2)
233
+ */
234
+ searchRepositoryV2 = this.mutation(removeAuthorizationParam(searchReposScmServiceV2ReposSearchScmPost))
235
+ /**
236
+ * Imports repositories (v2)
237
+ */
238
+ importRepositories = this.mutation(removeAuthorizationParam(importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost))
239
+ /**
240
+ * Gets repositories search by id (v2)
241
+ */
242
+ getRepositoriesBySearchId = this.query(removeAuthorizationParam(searchReposScmV2V2ReposSearchScmSearchIdGet))
243
+ /**
244
+ * Downloads file with found repositories (v2)
245
+ */
246
+ downloadSearchRepositoryV2 = this.mutation(
247
+ removeAuthorizationParam(downloadSearchReposScmV2V2ReposSearchScmSearchIdDownloadGet),
248
+ )
140
249
  /**
141
250
  * Validate if the user has permission.
142
251
  * We do not use opa in this api, so this is the fn needed to check permissions.
@@ -192,6 +301,10 @@ class CodeShift extends ReactQueryNetworkClient {
192
301
  * Deletes a program group.
193
302
  */
194
303
  deleteProgramGroup = this.mutation(removeAuthorizationParam(deleteProgramGroupServiceV1ProgramGroupsProgramGroupIdDelete))
304
+ /**
305
+ * List Program Group Download Service
306
+ */
307
+ programGroupDownload = this.query(removeAuthorizationParam(listProgramGroupDownloadServiceV1ProgramGroupsDownloadGet))
195
308
  /**
196
309
  * Gets list of tags.
197
310
  */
@@ -200,11 +313,14 @@ class CodeShift extends ReactQueryNetworkClient {
200
313
  * Validates a SCM URL.
201
314
  */
202
315
  validateSCMUrl = this.mutation(removeAuthorizationParam(validateScmUrlServiceV1ReposValidateScmUrlPost))
316
+ /**
317
+ * PAT Health Check
318
+ */
319
+ checkScmPatHealth = this.query(removeAuthorizationParam(patHealthCheckV1ScmPatHealthCheckGet))
203
320
  /**
204
321
  * Get Branches for a Repository
205
322
  */
206
323
  getBranches = this.query(removeAuthorizationParam(listBranchesServiceV1ReposBranchesGet))
207
-
208
324
  /**
209
325
  * General Report Success And Errors
210
326
  */
@@ -234,9 +350,11 @@ class CodeShift extends ReactQueryNetworkClient {
234
350
  removeAuthorizationParam(analyticsProgramGroupsLastReportStatusV1AnalyticsProgramGroupsLastReportStatusGet),
235
351
  )
236
352
  /**
237
- * Analytics Program Groups Usage
353
+ * Analytics Program Groups Last Report Status Download
238
354
  */
239
- analyticsProgramGroupsUsage = this.query(removeAuthorizationParam(analyticsProgramGroupsUsageV1AnalyticsProgramGroupsUsageGet))
355
+ analyticsProgramGroupsLastReportStatusDownload = this.query(
356
+ removeAuthorizationParam(analyticsProgramGroupsLastReportStatusDownloadV1AnalyticsProgramGroupsLastReportStatusDownloadGet),
357
+ )
240
358
  /**
241
359
  * Analytics User Usage
242
360
  */
@@ -252,11 +370,9 @@ class CodeShift extends ReactQueryNetworkClient {
252
370
  removeAuthorizationParam(analyticsRepositoryUsageDownloadV1AnalyticsRepositoriesUsageDownloadGet),
253
371
  )
254
372
  /**
255
- * Analytics Program Groups Last Report Status Download
373
+ * Analytics Program Groups Usage
256
374
  */
257
- analyticsProgramGroupsLastReportStatusDownload = this.query(
258
- removeAuthorizationParam(analyticsProgramGroupsLastReportStatusDownloadV1AnalyticsProgramGroupsLastReportStatusDownloadGet),
259
- )
375
+ analyticsProgramGroupsUsage = this.query(removeAuthorizationParam(analyticsProgramGroupsUsageV1AnalyticsProgramGroupsUsageGet))
260
376
  /**
261
377
  * Analytics Program Groups Usage Download
262
378
  */
@@ -269,6 +385,78 @@ class CodeShift extends ReactQueryNetworkClient {
269
385
  getUsersService = this.query(
270
386
  removeAuthorizationParam(listUserServiceV1UsersGet),
271
387
  )
388
+ /**
389
+ * Analytics Program Groups Details
390
+ */
391
+ analyticsProgramGroupsDetails = this.query(
392
+ removeAuthorizationParam(analyticsProgramGroupsDetailsV1AnalyticsProgramGroupsDetailsGet),
393
+ )
394
+ /**
395
+ * Analytics Program Groups Details Download
396
+ */
397
+ analyticsProgramGroupsDetailsDownload = this.query(
398
+ removeAuthorizationParam(analyticsProgramGroupsDetailsDownloadV1AnalyticsProgramGroupsDetailsDownloadGet),
399
+ )
400
+ /**
401
+ * Analytics Program Groups Details
402
+ */
403
+ analyticsRepositoryDetails = this.query(
404
+ removeAuthorizationParam(analyticsRepositoryDetailedReportV1AnalyticsRepositoriesDetailsGet),
405
+ )
406
+ /**
407
+ * Analytics Program Groups Details Download
408
+ */
409
+ analyticsRepositoryDetailsDownload = this.query(
410
+ removeAuthorizationParam(analyticsRepositoryDetailedReportDownloadV1AnalyticsRepositoriesDetailsDownloadGet),
411
+ )
412
+ /**
413
+ * Analytics Program Groups Target Details
414
+ */
415
+ analyticsProgramGroupsTargetDetails = this.query(
416
+ removeAuthorizationParam(analyticsProgramGroupsTargetDetailsV1AnalyticsProgramGroupsTargetDetailsGet),
417
+ )
418
+ /**
419
+ * Analytics Program Groups Target Details Download
420
+ */
421
+ analyticsProgramGroupsTargetDetailsDownload = this.query(
422
+ removeAuthorizationParam(analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet),
423
+ )
424
+ /**
425
+ * Analytics Repository Target Details
426
+ */
427
+ analyticsRepositoryTargetDetails = this.query(
428
+ removeAuthorizationParam(analyticsRepositoryTargetDetailsV1AnalyticsRepositoriesTargetDetailsGet),
429
+ )
430
+ /**
431
+ * Analytics Repository Target Details Download
432
+ */
433
+ analyticsRepositoryTargetDetailsDownload = this.query(
434
+ removeAuthorizationParam(analyticsRepositoryTargetDetailsDownloadV1AnalyticsRepositoriesTargetDetailsDownloadGet),
435
+ )
436
+ /**
437
+ * Analytics Modules Execution Times
438
+ */
439
+ analyticsModulesExecutionTimes = this.query(
440
+ removeAuthorizationParam(analyticsModuleExecutionTimesReportV1AnalyticsModulesExecutionTimesGet),
441
+ )
442
+ /**
443
+ * Analytics Modules Execution Times Download
444
+ */
445
+ analyticsModulesExecutionTimesDownload = this.query(
446
+ removeAuthorizationParam(analyticsModuleExecutionTimesDownloadV1AnalyticsModulesExecutionTimesDownloadGet),
447
+ )
448
+ /**
449
+ * List Module Execution Batch Activities
450
+ */
451
+ activitiesModuleExecutionBatch = this.query(
452
+ removeAuthorizationParam(listModuleExecutionBatchActivitiesV1ActivitiesModuleExecutionBatchGet),
453
+ )
454
+ /**
455
+ * Get Module Execution Batch Activity by ID
456
+ */
457
+ activityModuleExecutionBatch = this.query(
458
+ removeAuthorizationParam(getModuleExecutionBatchActivitiesByIdV1ActivitiesModuleExecutionBatchModuleExecutionBatchIdGet),
459
+ )
272
460
  }
273
461
 
274
462
  export const codeShiftClient = new CodeShift()
@@ -1,4 +1,5 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
+ import { getApiAddresses } from '../api-addresses'
2
3
  import {
3
4
  addFavoriteV1KnowledgeSourcesSlugFavoritePost,
4
5
  createKsV1KnowledgeSourcesPost,
@@ -10,10 +11,13 @@ import {
10
11
  findKsV1KnowledgeSourcesSlugGet,
11
12
  forkKsV1KnowledgeSourcesSlugForkPost,
12
13
  getFileUploadStatusV1FileUploadFileUploadIdGet,
14
+ getIndexedFilesV1KnowledgeSourcesKsSlugFilesGet,
13
15
  getUploadFormV1FileUploadFormPost,
14
16
  getUploadFormV2V2FileUploadFormPost,
15
17
  listKosV1KnowledgeSourcesKsSlugObjectsGet,
18
+ listKosV2KnowledgeSourcesKsSlugObjectsGet,
16
19
  listKsV1KnowledgeSourcesGet,
20
+ listKsV2KnowledgeSourcesGet,
17
21
  publishKsV1KnowledgeSourcesSlugPublishPost,
18
22
  resetKosV1KnowledgeSourcesKsSlugObjectsDelete,
19
23
  saveChunkedFilesDeprecatedV1FileUploadFileUploadIdPost,
@@ -31,7 +35,10 @@ import { FileUploadError } from '../error/FileUploadError'
31
35
  import { StackspotAPIError } from '../error/StackspotAPIError'
32
36
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
33
37
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
34
- import { getApiAddresses } from '../api-addresses'
38
+
39
+ const listKSV2WithoutAuthorization = removeAuthorizationParam(listKsV2KnowledgeSourcesGet)
40
+ const listKOV2WithoutAuthorization = removeAuthorizationParam(listKosV2KnowledgeSourcesKsSlugObjectsGet)
41
+
35
42
 
36
43
  class DataIntegrationClient extends ReactQueryNetworkClient {
37
44
  constructor() {
@@ -89,6 +96,17 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
89
96
  * List of knowledge sources
90
97
  */
91
98
  knowledgeSources = this.query(removeAuthorizationParam(listKsV1KnowledgeSourcesGet))
99
+ /**
100
+ * List of knowledge sources with pagination
101
+ */
102
+ knowledgeSourcesV2 = this.infiniteQuery(listKSV2WithoutAuthorization, {
103
+ accumulator: 'items',
104
+ getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
105
+ const size = variables.size ?? 1
106
+ const parsedLastPageParam = (lastPageParam as number) ?? variables.page ?? 1
107
+ return lastPage.items && lastPage.items.length < size ? undefined : parsedLastPageParam + 1
108
+ },
109
+ })
92
110
  /**
93
111
  * Adds the resource of type Knowledge Source to the list of favorites.
94
112
  */
@@ -101,6 +119,10 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
101
119
  * List knowledge objects from a knowledge source
102
120
  */
103
121
  listKnowledgeObjects = this.query(removeAuthorizationParam(listKosV1KnowledgeSourcesKsSlugObjectsGet))
122
+ /**
123
+ * List knowledge objects from a knowledge source with pagination
124
+ */
125
+ listKnowledgeObjectsV2 = this.infiniteQuery(listKOV2WithoutAuthorization, { accumulator: 'items' })
104
126
  /**
105
127
  * Get a knowledge object by id
106
128
  */
@@ -180,6 +202,11 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
180
202
  * Delete Knowledge Object from Knowledge Source
181
203
  */
182
204
  deleteKnowledgeObjectFromKnowledgeSource = this.mutation(removeAuthorizationParam(deleteKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdDelete))
205
+ /**
206
+ * Get Indexed Files
207
+ */
208
+ listIndexedProjectFiles = this.query(removeAuthorizationParam(getIndexedFilesV1KnowledgeSourcesKsSlugFilesGet))
209
+
183
210
  }
184
211
 
185
212
  export const dataIntegrationClient = new DataIntegrationClient()
@@ -0,0 +1,319 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import { findLast, last } from 'lodash'
3
+ import { getApiAddresses } from '../api-addresses'
4
+ import { ConversationResponse } from '../api/ai'
5
+ import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, fetchInsights, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, getInsightById, GetOpportunityResponse, AiChatRequest, refreshInsights } from '../api/discover'
6
+ import { DefaultAPIError } from '../error/DefaultAPIError'
7
+ import { StackspotAPIError } from '../error/StackspotAPIError'
8
+ import { StreamedJson } from '../utils/StreamedJson'
9
+ import { baseDictionary } from '../error/dictionary/base'
10
+ import { formatJson } from '../utils/string'
11
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
12
+ import { aiClient } from './ai'
13
+ import { ChatAgentTool, ChatResponseWithSteps, FixedChatResponse, StepChatStep } from './types'
14
+ import { agentToolsClient } from './agent-tools'
15
+
16
+ export interface ChatConversionDetails extends ConversationResponse {
17
+ opportunityName?: string,
18
+ hypothesisCount?: number,
19
+ }
20
+
21
+ class DiscoverClient extends ReactQueryNetworkClient {
22
+ constructor() {
23
+ super(getApiAddresses().discover.url, defaults)
24
+ }
25
+
26
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
27
+ return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
28
+ }
29
+
30
+ opportunities = this.query(getAll)
31
+
32
+ opportunity = this.query(getById)
33
+
34
+ hypotheses = this.query(getAll1)
35
+
36
+ hypothesisById = this.query(getById1)
37
+
38
+ documents = this.query(getAllByHypothesis)
39
+
40
+ document = this.query(getById2)
41
+
42
+ artifacts = this.query(getAll2)
43
+
44
+ createOpportunity = this.mutation(create)
45
+
46
+ createHypothesis = this.mutation(create1)
47
+
48
+ createDocument = this.mutation(create2)
49
+
50
+ deleteOpportunity = this.mutation(deleteById)
51
+
52
+ deleteHypothesis = this.mutation(deleteById1)
53
+
54
+ deleteDocument = this.mutation(deleteById2)
55
+
56
+ /**
57
+ * Fetch insights
58
+ */
59
+ insights = this.query(fetchInsights)
60
+ /**
61
+ * Refresh insights
62
+ */
63
+ refreshInsights = this.mutation(refreshInsights)
64
+ /**
65
+ * Get Insight by Id
66
+ */
67
+ insightById = this.query(getInsightById)
68
+
69
+ chats = this.query({
70
+ name: 'chats',
71
+ request: async (_signal, variables: { filter?: string, page?: number, size?: number }) => {
72
+ const opportunities = await this.opportunities.query({})
73
+
74
+ const opportunitiesByChatId: Record<string, any> = opportunities.content.reduce(
75
+ (acc, opp: GetOpportunityResponse) => {
76
+ if (opp.chatId) {
77
+ acc[opp.chatId] = opp
78
+ }
79
+ return acc
80
+ },
81
+ {} as Record<string, any>,
82
+ )
83
+
84
+ const chatsHistory = await aiClient.chats.query(
85
+ { ...variables, page: variables.page, size: variables.size ?? 40 },
86
+ )
87
+
88
+ const filteredItems = variables.filter
89
+ ? chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase()))
90
+ : chatsHistory
91
+
92
+ const enrichedChats = filteredItems?.map(chat => {
93
+ const relatedOpportunity = opportunitiesByChatId[chat.id]
94
+
95
+ return {
96
+ ...chat,
97
+ opportunityName: relatedOpportunity?.title ?? null,
98
+ hypothesisCount: relatedOpportunity?.hypotheses?.length ?? 0,
99
+ }
100
+ })
101
+
102
+ return enrichedChats as ChatConversionDetails[]
103
+ },
104
+ })
105
+
106
+ private static async toolsOfAgent(agentId?: string) {
107
+ try {
108
+ const agent = agentId ? await agentToolsClient.agent.query({ agentId }) : undefined
109
+ if (!agent) return []
110
+ const tools: (Omit<ChatAgentTool, 'duration' | 'prompt' | 'output'>)[] = []
111
+ agent.toolkits?.builtin_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
112
+ if (id) tools.push({ image: kit.image_url, id, name: name || id, description })
113
+ }))
114
+ agent.toolkits?.custom_toolkits?.forEach(kit => kit.tools?.forEach(({ id, name, description }) => {
115
+ if (id) tools.push({ image: kit.avatar ?? undefined, id, name: name || id, description })
116
+ }))
117
+ return tools
118
+ } catch {
119
+ return []
120
+ }
121
+ }
122
+
123
+
124
+ sendChatMessage(request: AiChatRequest & { agentId: string }, minChangeIntervalMS?: number): StreamedJson<ChatResponseWithSteps> {
125
+ const abortController = new AbortController()
126
+ const headers = {
127
+ 'Content-Type': 'application/json',
128
+ 'Accept': 'text/event-stream',
129
+ }
130
+ const events = this.stream(
131
+ this.resolveURL('/v2/ai/chat'),
132
+ { method: 'post', body: JSON.stringify(request), headers, signal: abortController.signal },
133
+ )
134
+ /**
135
+ * This function treats events in the streaming that deals with the execution of tools. Since these events are not concatenated like
136
+ * normal streamings of data, we need this separate function to deal with them. It transforms the internal data model of the
137
+ * StreamedJson object whenever an event is triggered.
138
+ */
139
+ async function transform(event: Partial<FixedChatResponse>, data: Partial<ChatResponseWithSteps>) {
140
+ const info = event.agent_info
141
+
142
+ if (!info) return
143
+
144
+ const tools = await DiscoverClient.toolsOfAgent(request.agentId)
145
+ data.steps = data.steps ? [...data.steps] : []
146
+
147
+ if (info.type === 'planning' && info.action === 'end') {
148
+ data.steps.push({
149
+ id: 'planning',
150
+ type: 'planning',
151
+ status: 'success',
152
+ duration: info.duration || 0,
153
+ steps: info.data?.steps?.map(s => s.goal) ?? [],
154
+ goal: info.data?.plan_goal ?? '',
155
+ })
156
+
157
+ info.data?.steps.forEach(s => data.steps?.push({
158
+ id: s.id,
159
+ type: 'step',
160
+ status: 'pending',
161
+ input: s.goal,
162
+ attempts: [{
163
+ tools: s.tools?.map(t => ({
164
+ ...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
165
+ executionId: t.tool_execution_id,
166
+ goal: t.goal,
167
+ })),
168
+ }],
169
+ }))
170
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
171
+ }
172
+
173
+ if (info.type === 'planning' && info.action === 'awaiting_approval') {
174
+ data.steps.push({
175
+ id: 'planning',
176
+ type: 'planning',
177
+ status: 'awaiting_approval',
178
+ user_question: info.data?.user_question,
179
+ duration: info.duration || 0,
180
+ steps: info.data?.steps?.map(s => s.goal) ?? [],
181
+ goal: info.data?.plan_goal ?? '',
182
+ })
183
+ info.data?.steps.forEach(s => data.steps?.push({
184
+ id: s.id,
185
+ type: 'step',
186
+ status: 'pending',
187
+ input: s.goal,
188
+ attempts: [{
189
+ tools: s.tools?.map(t => ({
190
+ ...(tools.find(({ id }) => id === t.tool_id) ?? { id: t.tool_id, name: t.tool_id }),
191
+ executionId: t.tool_execution_id,
192
+ goal: t.goal,
193
+ })),
194
+ }],
195
+ }))
196
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
197
+ }
198
+
199
+ if (info.type === 'step' && info.action === 'start') {
200
+ const step = data.steps.find(s => s.id === info.id)
201
+ if (step) step.status = 'running'
202
+ }
203
+
204
+ if (info.type === 'step' && info.action === 'end') {
205
+ const step = data.steps.find(s => s.id === info.id) as StepChatStep
206
+ if (step) {
207
+ step.status = 'success'
208
+ step.duration = info.duration
209
+ const lastToolId = last(step.attempts[0].tools)?.id
210
+ const lastAttemptOfLastTool = findLast(step.attempts.map(a => a.tools).flat(), t => t?.id === lastToolId)
211
+ step.output = lastAttemptOfLastTool?.output
212
+ }
213
+ }
214
+
215
+ if (info.type === 'tool' && info.action === 'awaiting_approval') {
216
+ const tool = tools.find(({ id }) => id === info.data?.tool_id)
217
+ data.steps.push({
218
+ id: info.id,
219
+ type: 'tool',
220
+ status: 'awaiting_approval',
221
+ duration: info.duration || 0,
222
+ input: info.data?.input,
223
+ user_question: info.data?.user_question,
224
+ attempts: [{
225
+ tools: [{
226
+ executionId: info.id,
227
+ id: info.data?.tool_id ?? '',
228
+ name: tool?.name ?? '',
229
+ goal: tool?.goal,
230
+ ...tool,
231
+ }],
232
+ }],
233
+ })
234
+ data.steps.push({ id: 'answer', type: 'answer', status: 'pending' })
235
+ }
236
+
237
+ if (info.type === 'tool' && info.action === 'start') {
238
+ const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
239
+ if (!info.data) return
240
+
241
+ //There might be a tool with status awaiting_approval, so we want to inform tool has already started
242
+ if (!currentStep || !currentStep.attempts[0].tools) {
243
+ const input = formatJson(info.data.input)
244
+ const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
245
+ data.steps.push({
246
+ id: info.id,
247
+ type: 'tool',
248
+ status: 'running',
249
+ duration: info.duration || 0,
250
+ input: info.data?.input,
251
+ user_question: info.data?.user_question,
252
+ attempts: [{
253
+ tools: [{ ...tool, executionId: info.id, input }],
254
+ }],
255
+ })
256
+ } else {
257
+ const toolInFirstAttempt = currentStep.attempts[0].tools?.find(t => t.executionId === info.id)
258
+ //One step might have multiple tools. When in an approval mode, we might not have all the tools in the array yet.
259
+ //So we make sure to add any tools that are not in there.
260
+ if (!toolInFirstAttempt) {
261
+ const input = formatJson(info.data.input)
262
+ const tool = tools?.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
263
+ currentStep.attempts[info.data.attempt - 1].tools?.push({
264
+ ...tool,
265
+ executionId: info.id,
266
+ input,
267
+ })
268
+ } else {
269
+ const input = formatJson(info.data.input)
270
+ if (info.data.attempt === 1) {
271
+ toolInFirstAttempt.input = input
272
+ } else {
273
+ const tool = tools.find(({ id }) => id === info.data?.tool_id) ?? { id: info.data?.tool_id, name: info.data?.tool_id }
274
+ currentStep.attempts[info.data.attempt - 1] ??= { tools: [] }
275
+ currentStep.attempts[info.data.attempt - 1].tools?.push({
276
+ ...tool,
277
+ executionId: info.id,
278
+ input,
279
+ })
280
+ }
281
+ }
282
+ }
283
+ }
284
+
285
+ if (info.type === 'tool' && info.action === 'end') {
286
+ const currentStep = data.steps.find(s => s.status === 'running') as StepChatStep
287
+ if (!currentStep || !info.data) return
288
+ const tool = currentStep.attempts[info.data.attempt - 1]?.tools?.find(t => t.executionId === info.id)
289
+ if (tool) {
290
+ tool.output = formatJson(info.data.output)
291
+ tool.duration = info.duration
292
+ }
293
+ }
294
+
295
+ if (info.type === 'final_answer' && info.action === 'start') {
296
+ const answerStep = last(data.steps)
297
+ if (answerStep) answerStep.status = 'running'
298
+ }
299
+
300
+ if (info.type === 'chat' && info.action === 'end') {
301
+ const answerStep = last(data.steps)
302
+ if (answerStep) {
303
+ answerStep.status = 'success'
304
+ answerStep.duration = info.duration
305
+ }
306
+ }
307
+ }
308
+
309
+ return new StreamedJson({
310
+ eventsPromise: events,
311
+ abortController,
312
+ minChangeIntervalMS,
313
+ ignoreKeys: ['agent_info'],
314
+ transform,
315
+ })
316
+ }
317
+ }
318
+
319
+ export const discoverClient = new DiscoverClient()