@stack-spot/portal-network 0.158.0 → 0.159.0-beta.2

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 (147) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/dist/api/codeShift.d.ts +110 -196
  3. package/dist/api/codeShift.d.ts.map +1 -1
  4. package/dist/api/codeShift.js +37 -94
  5. package/dist/api/codeShift.js.map +1 -1
  6. package/dist/api-addresses.d.ts +32 -0
  7. package/dist/api-addresses.d.ts.map +1 -1
  8. package/dist/api-addresses.js +53 -0
  9. package/dist/api-addresses.js.map +1 -1
  10. package/dist/client/account.d.ts +7 -0
  11. package/dist/client/account.d.ts.map +1 -1
  12. package/dist/client/account.js +12 -3
  13. package/dist/client/account.js.map +1 -1
  14. package/dist/client/agent-tools.d.ts +89 -3
  15. package/dist/client/agent-tools.d.ts.map +1 -1
  16. package/dist/client/agent-tools.js +135 -4
  17. package/dist/client/agent-tools.js.map +1 -1
  18. package/dist/client/agent.d.ts +5 -49
  19. package/dist/client/agent.d.ts.map +1 -1
  20. package/dist/client/agent.js +2 -65
  21. package/dist/client/agent.js.map +1 -1
  22. package/dist/client/ai.d.ts +7 -0
  23. package/dist/client/ai.d.ts.map +1 -1
  24. package/dist/client/ai.js +12 -3
  25. package/dist/client/ai.js.map +1 -1
  26. package/dist/client/api-management.d.ts.map +1 -1
  27. package/dist/client/api-management.js +2 -2
  28. package/dist/client/api-management.js.map +1 -1
  29. package/dist/client/cloud-account.d.ts.map +1 -1
  30. package/dist/client/cloud-account.js +2 -2
  31. package/dist/client/cloud-account.js.map +1 -1
  32. package/dist/client/cloud-platform-horizon.d.ts.map +1 -1
  33. package/dist/client/cloud-platform-horizon.js +2 -2
  34. package/dist/client/cloud-platform-horizon.js.map +1 -1
  35. package/dist/client/cloud-platform.d.ts.map +1 -1
  36. package/dist/client/cloud-platform.js +2 -2
  37. package/dist/client/cloud-platform.js.map +1 -1
  38. package/dist/client/cloud-runtimes.d.ts.map +1 -1
  39. package/dist/client/cloud-runtimes.js +2 -2
  40. package/dist/client/cloud-runtimes.js.map +1 -1
  41. package/dist/client/cloud-services.d.ts.map +1 -1
  42. package/dist/client/cloud-services.js +2 -2
  43. package/dist/client/cloud-services.js.map +1 -1
  44. package/dist/client/code-shift.d.ts +25 -67
  45. package/dist/client/code-shift.d.ts.map +1 -1
  46. package/dist/client/code-shift.js +32 -75
  47. package/dist/client/code-shift.js.map +1 -1
  48. package/dist/client/content.d.ts.map +1 -1
  49. package/dist/client/content.js +2 -2
  50. package/dist/client/content.js.map +1 -1
  51. package/dist/client/data-integration.d.ts.map +1 -1
  52. package/dist/client/data-integration.js +2 -2
  53. package/dist/client/data-integration.js.map +1 -1
  54. package/dist/client/discovery.d.ts.map +1 -1
  55. package/dist/client/discovery.js +2 -2
  56. package/dist/client/discovery.js.map +1 -1
  57. package/dist/client/event-bus.d.ts.map +1 -1
  58. package/dist/client/event-bus.js +2 -2
  59. package/dist/client/event-bus.js.map +1 -1
  60. package/dist/client/gen-ai-inference.d.ts +9 -0
  61. package/dist/client/gen-ai-inference.d.ts.map +1 -1
  62. package/dist/client/gen-ai-inference.js +12 -3
  63. package/dist/client/gen-ai-inference.js.map +1 -1
  64. package/dist/client/insights.d.ts.map +1 -1
  65. package/dist/client/insights.js +2 -2
  66. package/dist/client/insights.js.map +1 -1
  67. package/dist/client/notification.d.ts.map +1 -1
  68. package/dist/client/notification.js +2 -2
  69. package/dist/client/notification.js.map +1 -1
  70. package/dist/client/runtime-manager.d.ts.map +1 -1
  71. package/dist/client/runtime-manager.js +2 -2
  72. package/dist/client/runtime-manager.js.map +1 -1
  73. package/dist/client/secrets.d.ts.map +1 -1
  74. package/dist/client/secrets.js +2 -2
  75. package/dist/client/secrets.js.map +1 -1
  76. package/dist/client/types.d.ts +5 -4
  77. package/dist/client/types.d.ts.map +1 -1
  78. package/dist/client/workflow.d.ts.map +1 -1
  79. package/dist/client/workflow.js +2 -2
  80. package/dist/client/workflow.js.map +1 -1
  81. package/dist/client/workspace-ai.d.ts +1 -4
  82. package/dist/client/workspace-ai.d.ts.map +1 -1
  83. package/dist/client/workspace-ai.js +2 -2
  84. package/dist/client/workspace-ai.js.map +1 -1
  85. package/dist/client/workspace-manager.d.ts.map +1 -1
  86. package/dist/client/workspace-manager.js +2 -2
  87. package/dist/client/workspace-manager.js.map +1 -1
  88. package/dist/client/workspace-search.d.ts.map +1 -1
  89. package/dist/client/workspace-search.js +2 -2
  90. package/dist/client/workspace-search.js.map +1 -1
  91. package/dist/client/workspace.d.ts.map +1 -1
  92. package/dist/client/workspace.js +2 -2
  93. package/dist/client/workspace.js.map +1 -1
  94. package/dist/error/DefaultAPIError.d.ts +1 -1
  95. package/dist/error/DefaultAPIError.d.ts.map +1 -1
  96. package/dist/error/DefaultAPIError.js +27 -12
  97. package/dist/error/DefaultAPIError.js.map +1 -1
  98. package/dist/error/types.d.ts +19 -0
  99. package/dist/error/types.d.ts.map +1 -0
  100. package/dist/error/types.js +2 -0
  101. package/dist/error/types.js.map +1 -0
  102. package/dist/index.d.ts +1 -1
  103. package/dist/index.d.ts.map +1 -1
  104. package/dist/index.js +1 -1
  105. package/dist/index.js.map +1 -1
  106. package/dist/network/NetworkClient.d.ts +6 -0
  107. package/dist/network/NetworkClient.d.ts.map +1 -1
  108. package/dist/network/NetworkClient.js +10 -1
  109. package/dist/network/NetworkClient.js.map +1 -1
  110. package/package.json +1 -1
  111. package/readme.md +1 -1
  112. package/src/api/account.ts +1 -0
  113. package/src/api/agent-tools.ts +3 -0
  114. package/src/api/agent.ts +2 -0
  115. package/src/api/codeShift.ts +257 -481
  116. package/src/api/notification.ts +2 -0
  117. package/src/api-addresses.ts +71 -0
  118. package/src/client/account.ts +12 -3
  119. package/src/client/agent-tools.ts +103 -5
  120. package/src/client/agent.ts +2 -68
  121. package/src/client/ai.ts +8 -2
  122. package/src/client/api-management.ts +2 -2
  123. package/src/client/cloud-account.ts +2 -2
  124. package/src/client/cloud-platform-horizon.ts +2 -2
  125. package/src/client/cloud-platform.ts +2 -2
  126. package/src/client/cloud-runtimes.ts +2 -2
  127. package/src/client/cloud-services.ts +2 -2
  128. package/src/client/code-shift.ts +21 -59
  129. package/src/client/content.ts +2 -2
  130. package/src/client/data-integration.ts +2 -2
  131. package/src/client/discovery.ts +2 -2
  132. package/src/client/event-bus.ts +2 -2
  133. package/src/client/gen-ai-inference.ts +8 -3
  134. package/src/client/insights.ts +2 -2
  135. package/src/client/notification.ts +2 -2
  136. package/src/client/runtime-manager.ts +2 -2
  137. package/src/client/secrets.ts +2 -2
  138. package/src/client/types.ts +7 -5
  139. package/src/client/workflow.ts +2 -2
  140. package/src/client/workspace-ai.ts +2 -2
  141. package/src/client/workspace-manager.ts +2 -2
  142. package/src/client/workspace-search.ts +2 -2
  143. package/src/client/workspace.ts +2 -2
  144. package/src/error/DefaultAPIError.ts +35 -12
  145. package/src/error/types.ts +21 -0
  146. package/src/index.ts +1 -1
  147. package/src/network/NetworkClient.ts +11 -1
@@ -3,15 +3,12 @@ import { HttpError } from '@oazapfts/runtime'
3
3
  import {
4
4
  checkRoleRouteV1RolesRoleGet,
5
5
  createAccountSettingsV1SettingsPut,
6
- createApplicationsBatchServiceV1ApplicationsBatchPost,
7
- createApplicationServiceV1ApplicationsPost,
8
6
  createIntegrationServiceV1IntegrationsPost,
9
7
  createModuleServiceV1ModulesPost,
10
8
  createProgramGroupServiceV1ProgramGroupsPost,
11
9
  createReposBatchServiceV1ReposBatchPost,
12
10
  createRepositoryServiceV1ReposPost,
13
11
  defaults,
14
- deleteApplicationServiceV1ApplicationsApplicationIdDelete,
15
12
  deleteIntegrationServiceV1IntegrationsIntegrationIdDelete,
16
13
  deleteProgramGroupServiceV1ProgramGroupsProgramGroupIdDelete,
17
14
  deleteRepositoryServiceV1ReposRepositoryIdDelete,
@@ -19,14 +16,12 @@ import {
19
16
  downloadReportV1ReportsReportIdDownloadGet,
20
17
  downloadSearchReposScmServiceV1ReposSearchScmSearchRepoIdDownloadGet,
21
18
  getAccountSettingsV1SettingsGet,
22
- getApplicationByIdServiceV1ApplicationsApplicationIdGet,
23
19
  getIntegrationByIdServiceV1IntegrationsIntegrationIdGet,
24
20
  getProgramGroupByIdServiceV1ProgramGroupsProgramGroupIdGet,
21
+ getReportPullRequestContentV1ReportsReportIdPullRequestGet,
25
22
  getReportV1ReportsReportIdGet,
26
23
  getRepositoryByIdServiceV1ReposRepositoryIdGet,
27
24
  getStatusSearchReposScmServiceV1ReposSearchScmSearchRepoIdStatusGet,
28
- listApplicationReportV1ApplicationsApplicationIdReportsGet,
29
- listApplicationServiceV1ApplicationsGet,
30
25
  listIntegrationServiceV1IntegrationsGet,
31
26
  listModulesServiceV1ModulesGet,
32
27
  listProgramGroupReportServiceV1ProgramGroupsProgramGroupIdReportsGet,
@@ -35,57 +30,28 @@ import {
35
30
  listRepositoryServiceV1ReposGet,
36
31
  listTagsServiceV1TagsGet,
37
32
  searchReposScmServiceV1ReposSearchScmGet,
38
- updateApplicationServiceV1ApplicationsApplicationIdPut,
39
33
  updateIntegrationServiceV1IntegrationsIntegrationIdPut,
34
+ updateProgramGroupComponentsServiceV1ProgramGroupsProgramGroupIdComponentsPut,
40
35
  updateProgramGroupServiceV1ProgramGroupsProgramGroupIdPut,
41
36
  updateRepositoryServiceV1ReposRepositoryIdPut,
37
+ validateScmUrlServiceV1ReposValidateScmUrlPost,
42
38
  } from '../api/codeShift'
43
- import apis from '../apis.json'
44
39
  import { DefaultAPIError } from '../error/DefaultAPIError'
45
40
  import { codeShiftDictionary } from '../error/dictionary/code-shift'
46
41
  import { StackspotAPIError } from '../error/StackspotAPIError'
47
42
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
48
43
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
44
+ import { getApiAddresses } from '../api-addresses'
49
45
 
50
46
  class CodeShift extends ReactQueryNetworkClient {
51
47
  constructor() {
52
- super(apis.codeShift.url, defaults)
48
+ super(getApiAddresses().codeShift.url, defaults)
53
49
  }
54
50
 
55
51
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
56
52
  return new DefaultAPIError(error.data, error.status, codeShiftDictionary, error.headers)
57
53
  }
58
54
 
59
- /**
60
- * @deprecated use createRepository instead
61
- * Creates a code shift application.
62
- */
63
- createApplication = this.mutation(removeAuthorizationParam(createApplicationServiceV1ApplicationsPost))
64
- /**
65
- * @deprecated use createRepositoriesBatch instead
66
- * Creates a code shift application in batch.
67
- */
68
- createApplicationBatch = this.mutation(removeAuthorizationParam(createApplicationsBatchServiceV1ApplicationsBatchPost))
69
- /**
70
- * @deprecated use repositories instead
71
- * Gets code shift applications.
72
- */
73
- applications = this.query(removeAuthorizationParam(listApplicationServiceV1ApplicationsGet))
74
- /**
75
- * @deprecated use repository instead
76
- * Gets code shift application
77
- */
78
- application = this.query(removeAuthorizationParam(getApplicationByIdServiceV1ApplicationsApplicationIdGet))
79
- /**
80
- * @deprecated use updateRepository instead
81
- * Updates a code shift application
82
- */
83
- updateApplication = this.mutation(removeAuthorizationParam(updateApplicationServiceV1ApplicationsApplicationIdPut))
84
- /**
85
- * @deprecated use deleteRepository instead
86
- * Deletes a code shift application.
87
- */
88
- deleteImportedApp = this.mutation(removeAuthorizationParam(deleteApplicationServiceV1ApplicationsApplicationIdDelete))
89
55
  /**
90
56
  * Creates a repository.
91
57
  */
@@ -110,6 +76,10 @@ class CodeShift extends ReactQueryNetworkClient {
110
76
  * Updates a repository
111
77
  */
112
78
  updateRepository = this.mutation(removeAuthorizationParam(updateRepositoryServiceV1ReposRepositoryIdPut))
79
+ /**
80
+ * Get a report for a pull request by id.
81
+ */
82
+ getReportPullRequestContent = this.query(removeAuthorizationParam(getReportPullRequestContentV1ReportsReportIdPullRequestGet))
113
83
  /**
114
84
  * Gets modules.
115
85
  */
@@ -122,11 +92,6 @@ class CodeShift extends ReactQueryNetworkClient {
122
92
  * Generates a report.
123
93
  */
124
94
  generateReport = this.mutation(removeAuthorizationParam(dispatchModuleServiceV1ModulesDispatchesPost))
125
- /**
126
- * @deprecated use repositoryReports instead
127
- * Gets reports.
128
- */
129
- reports = this.query(removeAuthorizationParam(listApplicationReportV1ApplicationsApplicationIdReportsGet))
130
95
  /**
131
96
  * Gets repository reports.
132
97
  */
@@ -164,67 +129,64 @@ class CodeShift extends ReactQueryNetworkClient {
164
129
  * We do not use opa in this api, so this is the fn needed to check permissions.
165
130
  */
166
131
  validateRolePermissions = this.query(removeAuthorizationParam(checkRoleRouteV1RolesRoleGet))
167
-
168
132
  /**
169
133
  * Creates an integration
170
134
  */
171
135
  createIntegration = this.mutation(removeAuthorizationParam(createIntegrationServiceV1IntegrationsPost))
172
-
173
136
  /**
174
137
  * Lists integrations
175
138
  */
176
139
  listIntegration = this.query(removeAuthorizationParam(listIntegrationServiceV1IntegrationsGet))
177
-
178
140
  /**
179
141
  * Gets an integration by id
180
142
  */
181
143
  getIntegrationById = this.query(removeAuthorizationParam(getIntegrationByIdServiceV1IntegrationsIntegrationIdGet))
182
-
183
144
  /**
184
145
  * Updates an integration
185
146
  */
186
147
  updateIntegration = this.mutation(removeAuthorizationParam(updateIntegrationServiceV1IntegrationsIntegrationIdPut))
187
-
188
148
  /**
189
149
  * Deletes an integration
190
150
  */
191
151
  deleteIntegration = this.mutation(removeAuthorizationParam(deleteIntegrationServiceV1IntegrationsIntegrationIdDelete))
192
-
193
152
  /**
194
153
  * Creates a program group.
195
154
  */
196
155
  createProgramGroup = this.mutation(removeAuthorizationParam(createProgramGroupServiceV1ProgramGroupsPost))
197
-
198
156
  /**
199
157
  * Gets list of program groups.
200
158
  */
201
159
  listProgramGroups = this.query(removeAuthorizationParam(listProgramGroupServiceV1ProgramGroupsGet))
202
-
203
160
  /**
204
161
  * Gets a program group by id.
205
162
  */
206
163
  getProgramGroupById = this.query(removeAuthorizationParam(getProgramGroupByIdServiceV1ProgramGroupsProgramGroupIdGet))
207
-
208
164
  /**
209
- * List Program Group Report Service
210
- */
165
+ * List Program Group Report Service
166
+ */
211
167
  listProgramGroupReport = this.query(removeAuthorizationParam(listProgramGroupReportServiceV1ProgramGroupsProgramGroupIdReportsGet))
212
-
213
168
  /**
214
169
  * Updates a program group.
215
170
  */
216
171
  updateProgramGroup = this.mutation(removeAuthorizationParam(updateProgramGroupServiceV1ProgramGroupsProgramGroupIdPut))
217
-
172
+ /**
173
+ * Updates a program group components.
174
+ */
175
+ updateProgramGroupComponents = this.mutation(
176
+ removeAuthorizationParam(updateProgramGroupComponentsServiceV1ProgramGroupsProgramGroupIdComponentsPut),
177
+ )
218
178
  /**
219
179
  * Deletes a program group.
220
180
  */
221
181
  deleteProgramGroup = this.mutation(removeAuthorizationParam(deleteProgramGroupServiceV1ProgramGroupsProgramGroupIdDelete))
222
-
223
182
  /**
224
183
  * Gets list of tags.
225
184
  */
226
185
  tags = this.query(removeAuthorizationParam(listTagsServiceV1TagsGet))
227
-
186
+ /**
187
+ * Validates a SCM URL.
188
+ */
189
+ validateSCMUrl = this.mutation(removeAuthorizationParam(validateScmUrlServiceV1ReposValidateScmUrlPost))
228
190
  }
229
191
 
230
192
  export const codeShiftClient = new CodeShift()
@@ -96,19 +96,19 @@ import {
96
96
  updateStudio,
97
97
  updateStudioTabs,
98
98
  } from '../api/content'
99
- import apis from '../apis.json'
100
99
  import { DefaultAPIError } from '../error/DefaultAPIError'
101
100
  import { cntDictionary } from '../error/dictionary/cnt'
102
101
  import { StackspotAPIError } from '../error/StackspotAPIError'
103
102
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
104
103
  import { OperationObject } from '../network/types'
105
104
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
105
+ import { getApiAddresses } from '../api-addresses'
106
106
 
107
107
  const getStudiosWithoutAuthorization = removeAuthorizationParam(getStudios)
108
108
 
109
109
  class ContentClient extends ReactQueryNetworkClient {
110
110
  constructor() {
111
- super(apis.content.url, defaults)
111
+ super(getApiAddresses().content.url, defaults)
112
112
  }
113
113
 
114
114
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -25,17 +25,17 @@ import {
25
25
  splitUploadedFileV1FileUploadFileUploadIdSplitPost,
26
26
  updateKsV1KnowledgeSourcesSlugPatch,
27
27
  } from '../api/dataIntegration'
28
- import apis from '../apis.json'
29
28
  import { DefaultAPIError } from '../error/DefaultAPIError'
30
29
  import { baseDictionary } from '../error/dictionary/base'
31
30
  import { FileUploadError } from '../error/FileUploadError'
32
31
  import { StackspotAPIError } from '../error/StackspotAPIError'
33
32
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
34
33
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
34
+ import { getApiAddresses } from '../api-addresses'
35
35
 
36
36
  class DataIntegrationClient extends ReactQueryNetworkClient {
37
37
  constructor() {
38
- super(apis.dataIntegration.url, defaults)
38
+ super(getApiAddresses().dataIntegration.url, defaults)
39
39
  }
40
40
 
41
41
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -1,16 +1,16 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import { attach, createHypothesis, defaults, deleteV1DocumentsByDocumentIdHypothesesAndHypothesisNumber, download, findHypothesisByNumber, getAll, getById, list1, list2, listAllDocumentsWithHypotheses, listHypothesis, listVersions, upload } from '../api/discovery'
3
- import apis from '../apis.json'
4
3
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
4
  import { baseDictionary } from '../error/dictionary/base'
6
5
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
6
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
7
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
8
+ import { getApiAddresses } from '../api-addresses'
9
9
 
10
10
  class DiscoveryClient extends ReactQueryNetworkClient {
11
11
 
12
12
  constructor() {
13
- super(apis.discovery.url, defaults)
13
+ super(getApiAddresses().discovery.url, defaults)
14
14
  }
15
15
 
16
16
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -2,11 +2,11 @@ import { HttpError } from '@oazapfts/runtime'
2
2
  import { CompletablePromise } from '@stack-spot/opa'
3
3
  import { cloneDeep } from 'lodash'
4
4
  import { defaults, EventProcessingResponse, Event as EventType, sendEvents } from '../api/eventBus'
5
- import apis from '../apis.json'
6
5
  import { DefaultAPIError } from '../error/DefaultAPIError'
7
6
  import { baseDictionary } from '../error/dictionary/base'
8
7
  import { StackspotAPIError } from '../error/StackspotAPIError'
9
8
  import { NetworkClient } from '../network/NetworkClient'
9
+ import { getApiAddresses } from '../api-addresses'
10
10
 
11
11
  export const EVENTS_STORAGE_IDENTIFIER = 'eventsError'
12
12
  const DEFER_MS = 5000
@@ -17,7 +17,7 @@ class EventBusClient extends NetworkClient {
17
17
  private lock = false
18
18
 
19
19
  constructor() {
20
- super(apis.eventBus.url)
20
+ super(getApiAddresses().eventBus.url)
21
21
  defaults.baseUrl = ''
22
22
  defaults.fetch = (...args) => this.fetch(...args)
23
23
  }
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { HttpError } from '@oazapfts/runtime'
3
- import { addSelfHostedModelV1LlmModelsPost, defaults, deleteModelResourcesV1LlmResourcesResourceIdDelete, deleteV1LlmModelsModelIdDelete, getModelV1LlmModelsModelIdGet, listLlmProvidersV1LlmProvidersGet, listModelsV1LlmModelsGet, saveOrUpdateModelResourcesV1LlmModelsModelIdResourcesPut, toggleModelStatusV1LlmModelsModelIdPatch, updateV1LlmModelsModelIdPut } from '../api/genAiInference'
4
- import apis from '../apis.json'
3
+ import { getApiAddresses } from '../api-addresses'
4
+ import { addSelfHostedModelV1LlmModelsPost, agentChatV1AgentAgentIdChatPost, defaults, deleteModelResourcesV1LlmResourcesResourceIdDelete, deleteV1LlmModelsModelIdDelete, getModelV1LlmModelsModelIdGet, listLlmProvidersV1LlmProvidersGet, listModelsV1LlmModelsGet, saveOrUpdateModelResourcesV1LlmModelsModelIdResourcesPut, toggleModelStatusV1LlmModelsModelIdPatch, updateV1LlmModelsModelIdPut } from '../api/genAiInference'
5
5
  import { DefaultAPIError } from '../error/DefaultAPIError'
6
6
  import { inferenceDictionary } from '../error/dictionary/ai-inference'
7
7
  import { StackspotAPIError } from '../error/StackspotAPIError'
@@ -10,7 +10,7 @@ import { removeAuthorizationParam } from '../utils/remove-authorization-param'
10
10
 
11
11
  class GenAiInference extends ReactQueryNetworkClient {
12
12
  constructor() {
13
- super(apis.genAiInference.url, defaults)
13
+ super(getApiAddresses().genAiInference.url, defaults)
14
14
  }
15
15
 
16
16
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -55,6 +55,11 @@ class GenAiInference extends ReactQueryNetworkClient {
55
55
  * Deletes a specific model resource by resource ID.
56
56
  */
57
57
  deleteModelResource = this.mutation(removeAuthorizationParam(deleteModelResourcesV1LlmResourcesResourceIdDelete))
58
+
59
+ /**
60
+ * Interaction with a specific AI agent
61
+ */
62
+ sendAgentMessage = this.mutation(agentChatV1AgentAgentIdChatPost)
58
63
  }
59
64
 
60
65
  export const genAiInferenceClient = new GenAiInference()
@@ -1,15 +1,15 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import { defaults, downloadAccountData, getDashboardAccount } from '../api/insights'
3
- import apis from '../apis.json'
4
3
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
4
  import { baseDictionary } from '../error/dictionary/base'
6
5
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
6
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
7
+ import { getApiAddresses } from '../api-addresses'
8
8
 
9
9
  class InsightsClient extends ReactQueryNetworkClient {
10
10
 
11
11
  constructor() {
12
- super(apis.insights.url, defaults)
12
+ super(getApiAddresses().insights.url, defaults)
13
13
  }
14
14
 
15
15
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -1,15 +1,15 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import { commit, committedNotifications, defaults, findAll } from '../api/notification'
3
- import apis from '../apis.json'
4
3
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
4
  import { baseDictionary } from '../error/dictionary/base'
6
5
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
6
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
7
+ import { getApiAddresses } from '../api-addresses'
8
8
 
9
9
  class NotificationClient extends ReactQueryNetworkClient {
10
10
 
11
11
  constructor() {
12
- super(apis.notification.url, defaults)
12
+ super(getApiAddresses().notification.url, defaults)
13
13
  }
14
14
 
15
15
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -1,14 +1,14 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import { defaults, getAppInfo, getAppsInRealm, getPluginDeployments, getRunByUlid, getRunsOnAllEnvs, getRunsOnEnv, getRunsRunning, getRunTaskPlugins, getRunTasks, runRollbackApp1, runRollbackInfra1 } from '../api/apiRuntime'
3
- import apis from '../apis.json'
4
3
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
4
  import { rteDictionary } from '../error/dictionary/rte'
6
5
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
6
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
7
+ import { getApiAddresses } from '../api-addresses'
8
8
 
9
9
  class RuntimeManagerClient extends ReactQueryNetworkClient {
10
10
  constructor() {
11
- super(apis.apiRuntime.url, defaults)
11
+ super(getApiAddresses().apiRuntime.url, defaults)
12
12
  }
13
13
 
14
14
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -1,15 +1,15 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
 
3
3
  import { createKey, defaults, deleteKey, deleteSecretValue, editKey, encrypt, getAll1, getAvailability, updateSecretValue } from '../api/secrets'
4
- import apis from '../apis.json'
5
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
6
5
  import { secretsDictionary } from '../error/dictionary/secrets'
7
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
8
7
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
+ import { getApiAddresses } from '../api-addresses'
9
9
 
10
10
  class SecretClient extends ReactQueryNetworkClient {
11
11
  constructor() {
12
- super(apis.secrets.url, defaults)
12
+ super(getApiAddresses().secrets.url, defaults)
13
13
  }
14
14
 
15
15
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -1,7 +1,6 @@
1
1
  import { RequestOpts } from '@oazapfts/runtime'
2
2
  import { AccountScmInfoSaveRequest, AccountScmInfoUpdateRequest, AccountScmStatusResponse, GroupsFromResourceResponse, MembersFromResourceResponse } from '../api/account'
3
- import { AgentResponse, VisibilityLevel } from '../api/agent'
4
- import { HttpMethod } from '../api/agent-tools'
3
+ import { AgentVisibilityLevelEnum, HttpMethod, ListAgentResponse, VisibilityLevelEnum } from '../api/agent-tools'
5
4
  import { ChatRequest, ChatResponse3, ContentDependencyResponse, ConversationHistoryResponse, ConversationResponse, DependencyResponse } from '../api/ai'
6
5
  import { ConnectAccountRequestV2, ManagedAccountProvisionRequest } from '../api/cloudAccount'
7
6
  import { AllocationCostRequest, AllocationCostResponse, ChargePeriod, getAllocationCostFilters, ManagedService, ServiceResource } from '../api/cloudServices'
@@ -220,6 +219,7 @@ export interface WorkspaceAiMembersPermissions {
220
219
  totalPages: number,
221
220
  }
222
221
 
222
+
223
223
  export interface WorkspaceAiGroupsPermissions extends GroupsFromResourceResponse {
224
224
  actions: Action[],
225
225
  }
@@ -358,12 +358,14 @@ export type FixVariables<
358
358
 
359
359
  export type ReplaceResult<T extends (...args: any[]) => Promise<any>, Fix> = (...args: Parameters<T>) => Promise<Fix>
360
360
 
361
- export interface AgentResponseWithBuiltIn extends AgentResponse {
361
+ export interface AgentResponseWithBuiltIn extends Omit<ListAgentResponse, 'conversation_starter' | 'avatar'> {
362
362
  builtIn?: boolean,
363
363
  spaceName?: string,
364
- }
364
+ conversation_starter?: string[] | null,
365
+ avatar?: string | null | undefined,
366
+ }
365
367
 
366
- export type AgentVisibilityLevel = VisibilityLevel | 'BUILT-IN' | 'ALL'
368
+ export type AgentVisibilityLevel = AgentVisibilityLevelEnum | VisibilityLevelEnum
367
369
 
368
370
  export interface AgentToolsOpenAPIPreview {
369
371
  name: string,
@@ -1,15 +1,15 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import { createApiServiceWorkflowsCreateApiDispatchPost, defaults, getExecutionDispatchRequestServiceWorkflowsExecutionIdRequestGet, getExecutionStatusServiceWorkflowsExecutionStatusExecutionIdGet, healthCheckServiceWorkflowsHealthCheckDispatchPost, runActionServiceWorkflowsRunActionDispatchPost, v1AcceptWorkflowExecutionJobSuspendedServiceV1ExecutionsExecutionIdJobsJobIdAcceptPost, v1GetWorkflowExecutionAttemptsV1ExecutionsExecutionIdAttemptsGet, v1GetWorkflowExecutionJobDetailServiceV1ExecutionsExecutionIdJobsJobIdGet, v1GetWorkflowExecutionJobGraphServiceV1ExecutionsExecutionIdGet, v1RefuseWorkflowExecutionJobSuspendedServiceV1ExecutionsExecutionIdJobsJobIdRefusePost, v1RetryWorkflowExecutionV1ExecutionsExecutionIdRetryPost } from '../api/workflows'
3
- import apis from '../apis.json'
4
3
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
4
  import { actionDictionary } from '../error/dictionary/action'
6
5
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
6
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
7
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
8
+ import { getApiAddresses } from '../api-addresses'
9
9
 
10
10
  class WorkflowClient extends ReactQueryNetworkClient {
11
11
  constructor() {
12
- super(apis.workflows.url, defaults)
12
+ super(getApiAddresses().workflows.url, defaults)
13
13
  }
14
14
 
15
15
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -22,15 +22,15 @@ import {
22
22
  updateWorkspaceV1WorkspacesWorkspaceIdPatch,
23
23
  useShareableLinkV1ShareShareIdPatch,
24
24
  } from '../api/workspace-ai'
25
- import apis from '../apis.json'
26
25
  import { StackspotAPIError } from '../error/StackspotAPIError'
27
26
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
28
27
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
29
28
  import { FixedAddResourceToWorkspaceAi, FixedWorkspaceAiPermissions, ReplaceResult } from './types'
29
+ import { getApiAddresses } from '../api-addresses'
30
30
 
31
31
  class WorkspaceAiClient extends ReactQueryNetworkClient {
32
32
  constructor() {
33
- super(apis['workspace-ai'].url, defaults)
33
+ super(getApiAddresses()['workspace-ai'].url, defaults)
34
34
  }
35
35
 
36
36
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -72,7 +72,6 @@ import {
72
72
  workspaceVariableControllerfindByName,
73
73
  workspaceVariableControllerupsert,
74
74
  } from '../api/workspaceManager'
75
- import apis from '../apis.json'
76
75
  import { DefaultAPIError } from '../error/DefaultAPIError'
77
76
  import { workspaceDictionary } from '../error/dictionary/workspace'
78
77
  import { StackspotAPIError } from '../error/StackspotAPIError'
@@ -80,10 +79,11 @@ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
80
79
  import { contentClient } from './content'
81
80
  import { FixedFullInputContextResponse, FixedPaginatedActivityResponse, FixedPluginForAppCreationV2Response, FixedWorkflowForCreationResponse, ReplaceResult } from './types'
82
81
  import { workspaceClient } from './workspace'
82
+ import { getApiAddresses } from '../api-addresses'
83
83
 
84
84
  class WorkspaceManagerClient extends ReactQueryNetworkClient {
85
85
  constructor() {
86
- super(apis.workspaceManager.url, defaults)
86
+ super(getApiAddresses().workspaceManager.url, defaults)
87
87
  }
88
88
 
89
89
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -1,14 +1,14 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import { clearUserHistory, defaults, deleteUserHistoryItem, getUserHistory, search } from '../api/workspaceSearchEngine'
3
- import apis from '../apis.json'
4
3
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
4
  import { baseDictionary } from '../error/dictionary/base'
6
5
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
6
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
7
+ import { getApiAddresses } from '../api-addresses'
8
8
 
9
9
  class WorkspaceSearchClient extends ReactQueryNetworkClient {
10
10
  constructor() {
11
- super(apis.workspaceSearchEngine.url, defaults)
11
+ super(getApiAddresses().workspaceSearchEngine.url, defaults)
12
12
  }
13
13
 
14
14
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -82,16 +82,16 @@ import {
82
82
  workspaceVariableV2Controllerupsert,
83
83
  } from '../api/workspace'
84
84
 
85
- import apis from '../apis.json'
86
85
  import { DefaultAPIError } from '../error/DefaultAPIError'
87
86
  import { workspaceDictionary } from '../error/dictionary/workspace'
88
87
  import { StackspotAPIError } from '../error/StackspotAPIError'
89
88
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
90
89
  import { OperationObject } from '../network/types'
90
+ import { getApiAddresses } from '../api-addresses'
91
91
 
92
92
  class WorkspaceClient extends ReactQueryNetworkClient {
93
93
  constructor() {
94
- super(apis.workspace.url, defaults)
94
+ super(getApiAddresses().workspace.url, defaults)
95
95
  }
96
96
 
97
97
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -1,6 +1,5 @@
1
1
  import { Dictionary, Language } from '@stack-spot/portal-translate'
2
2
  import { every, isString } from 'lodash'
3
- import { ErrorResponse, ValidationDetails } from '../api/account'
4
3
  import { actionDetails } from './dictionary/action-details'
5
4
  import { baseDictionary } from './dictionary/base'
6
5
  import { cntFields } from './dictionary/cnt-fields'
@@ -8,6 +7,7 @@ import { workspaceDetails } from './dictionary/workspace-details'
8
7
  import { workspaceFields } from './dictionary/workspace-fields'
9
8
  import { ignoredTitleErrorCodes } from './IgnoredErrorCodes'
10
9
  import { ErrorDetailsProperties, StackspotAPIError } from './StackspotAPIError'
10
+ import { ErrorResponse, LanguageSuggestedMessageKeys, ValidationDetails } from './types'
11
11
 
12
12
  // these details don't say anything the status already doesn't and we'd better use local translations for them.
13
13
  const ignoredDescriptions = [
@@ -35,6 +35,11 @@ function getValues(detail: ValidationDetails) {
35
35
  return detail.values && every(detail.values, isString) ? `\n${detail.values.join('\n')}` : ''
36
36
  }
37
37
 
38
+ function getSuggestedMessages(suggestedMessage: ErrorResponse['suggestedMessages'] | null | undefined, language?: Language) {
39
+ const parseLanguage: Record<Language, LanguageSuggestedMessageKeys> = { pt: 'ptBr', en: 'enUs' }
40
+ return suggestedMessage?.[parseLanguage?.[language || 'en']]
41
+ }
42
+
38
43
  const UNIT_REGEX_TEMPLATE = /{\d}/g
39
44
  const RANGE_REGEX_TEMPLATE = /{1-n}/g
40
45
 
@@ -61,21 +66,39 @@ function createMessage(status: number, raw: ErrorResponse, dictionary: Dictionar
61
66
  const dictDetails = (detailsDictionary[api?.toLowerCase() as keyof typeof detailsDictionary] ?? {})[language || 'en']
62
67
  const dictionaryDetails = raw.code && dictDetails ? dictDetails[raw.code] : {}
63
68
 
64
- if (!raw.validationDetails?.length) return { description: title, ...dictionaryDetails }
69
+ if (raw?.validationDetails?.length) {
65
70
 
66
- const details = raw.validationDetails?.map((detail) => {
67
- const dict: Record<string, string> = (fieldDictionary[api?.toLowerCase() as keyof typeof fieldDictionary] ?? {})[language || 'en'] ?? {}
68
- const codeTranslatedMessage = raw.code !== detail.code && dictionary[language || 'en'][detail.code]
71
+ const suggestedMessages = raw.validationDetails.map((detail) =>
72
+ getSuggestedMessages(detail?.suggestedMessages, language)).filter((msg) => !!msg)
69
73
 
70
- if (codeTranslatedMessage && containsNumberInBraces(codeTranslatedMessage) && (detail.values?.length || detail.field?.length)) {
71
- const value = detail.values?.length ? detail.values : (detail.field ? [detail.field] : [])
72
- return interpolateErrors(codeTranslatedMessage, value, dict)
74
+ if (suggestedMessages.length) {
75
+ return { description: suggestedMessages.join('\n'), ...dictionaryDetails }
73
76
  }
74
77
 
75
- const name = dict[detail.code] || detail.field || codeTranslatedMessage || detail.details || ''
76
- return `${name}${getValues(detail)}`
77
- })?.filter(d => !!d)
78
- return { description: details ? `${title}\n${details?.join('\n')}` : title, ...dictionaryDetails }
78
+ const details = raw.validationDetails?.map((detail) => {
79
+ const dict: Record<string, string> =
80
+ (fieldDictionary[api?.toLowerCase() as keyof typeof fieldDictionary] ?? {})[language || 'en'] ?? {}
81
+ const codeTranslatedMessage = raw.code !== detail.code && dictionary[language || 'en'][detail.code]
82
+
83
+ if (codeTranslatedMessage && containsNumberInBraces(codeTranslatedMessage) && (detail.values?.length || detail.field?.length)) {
84
+ const value = detail.values?.length ? detail.values : (detail.field ? [detail.field] : [])
85
+ return interpolateErrors(codeTranslatedMessage, value, dict)
86
+ }
87
+
88
+ const name = dict[detail.code] || detail.field || codeTranslatedMessage || detail.details || ''
89
+ return `${name}${getValues(detail)}`
90
+ })?.filter(d => !!d)
91
+ return { description: details ? `${title}\n${details?.join('\n')}` : title, ...dictionaryDetails }
92
+ }
93
+
94
+ if (raw?.suggestedMessages) {
95
+ const suggestedMessages = getSuggestedMessages(raw?.suggestedMessages, language)
96
+ if (suggestedMessages) {
97
+ return { description: suggestedMessages, ...dictionaryDetails }
98
+ }
99
+ }
100
+
101
+ return { description: title, ...dictionaryDetails }
79
102
  }
80
103
 
81
104
  /**
@@ -0,0 +1,21 @@
1
+ export type LanguageSuggestedMessageKeys = 'ptBr' | 'enUs';
2
+
3
+ export type SuggestedMessage = {
4
+ [key in LanguageSuggestedMessageKeys]: string | null
5
+ };
6
+
7
+ export type ValidationDetails = {
8
+ code: string,
9
+ field?: string,
10
+ details?: string,
11
+ values?: string[],
12
+ suggestedMessages?: SuggestedMessage | null,
13
+ };
14
+
15
+ export type ErrorResponse = {
16
+ code: string,
17
+ status: number,
18
+ details: string,
19
+ validationDetails?: ValidationDetails[],
20
+ suggestedMessages?: SuggestedMessage | null,
21
+ };
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { CancelledError } from '@tanstack/react-query'
2
- export { apiAddresses } from './api-addresses'
2
+ export { apiAddresses, getApiAddresses, getBaseUrlWithOverride, setApisOverride } from './api-addresses'
3
3
  export { accountClient } from './client/account'
4
4
  export { agentClient } from './client/agent'
5
5
  export { agentToolsClient } from './client/agent-tools'