@stack-spot/portal-network 0.161.0 → 0.162.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.
- package/CHANGELOG.md +171 -0
- package/dist/api/agent-tools.d.ts +71 -5
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js +88 -6
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/ai.d.ts +4 -0
- package/dist/api/ai.d.ts.map +1 -1
- package/dist/api/ai.js.map +1 -1
- package/dist/api/codeShift.d.ts +412 -209
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +241 -98
- package/dist/api/codeShift.js.map +1 -1
- package/dist/api/content.d.ts +140 -308
- package/dist/api/content.d.ts.map +1 -1
- package/dist/api/content.js +79 -217
- package/dist/api/content.js.map +1 -1
- package/dist/client/agent-tools.d.ts +14 -2
- package/dist/client/agent-tools.d.ts.map +1 -1
- package/dist/client/agent-tools.js +4 -4
- package/dist/client/agent-tools.js.map +1 -1
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +5 -3
- package/dist/client/ai.js.map +1 -1
- package/dist/client/code-shift.d.ts +158 -68
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +138 -73
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/content.d.ts +10 -4
- package/dist/client/content.d.ts.map +1 -1
- package/dist/client/content.js +10 -1
- package/dist/client/content.js.map +1 -1
- package/dist/client/gen-ai-inference.d.ts +9 -0
- package/dist/client/gen-ai-inference.d.ts.map +1 -1
- package/dist/client/gen-ai-inference.js +11 -2
- package/dist/client/gen-ai-inference.js.map +1 -1
- package/dist/error/DefaultAPIError.d.ts +1 -1
- package/dist/error/DefaultAPIError.d.ts.map +1 -1
- package/dist/error/DefaultAPIError.js +27 -12
- package/dist/error/DefaultAPIError.js.map +1 -1
- package/dist/error/types.d.ts +19 -0
- package/dist/error/types.d.ts.map +1 -0
- package/dist/error/types.js +2 -0
- package/dist/error/types.js.map +1 -0
- package/package.json +1 -1
- package/readme.md +1 -1
- package/src/api/account.ts +1 -0
- package/src/api/agent-tools.ts +173 -11
- package/src/api/agent.ts +2 -0
- package/src/api/ai.ts +4 -0
- package/src/api/codeShift.ts +995 -538
- package/src/api/content.ts +343 -795
- package/src/api/notification.ts +2 -0
- package/src/client/agent-tools.ts +4 -4
- package/src/client/ai.ts +6 -3
- package/src/client/code-shift.ts +93 -56
- package/src/client/content.ts +5 -0
- package/src/client/gen-ai-inference.ts +7 -2
- package/src/error/DefaultAPIError.ts +35 -12
- package/src/error/types.ts +21 -0
package/src/api/notification.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
+
import { getApiAddresses } from '../api-addresses'
|
|
2
3
|
import { addFavoriteV1AgentsAgentIdFavoritePost, AgentVisibilityLevelEnum, createAgentV1AgentsPost, createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, defaults, deleteAgentV1AgentsAgentIdDelete, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, forkToolkitV1ToolkitsToolkitIdForkPost, getAgentV1AgentsAgentIdGet, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, HttpValidationError, listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost, listAgentsV1AgentsGet, listToolkitsV1ToolkitsGet, publishAgentV1AgentsAgentIdPublishPost, searchAgentsV1AgentsSearchPost, updateAgentV1AgentsAgentIdPut, updateToolkitV1ToolkitsToolkitIdPatch, VisibilityLevelEnum } from '../api/agent-tools'
|
|
3
4
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
4
5
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
5
6
|
import { FetchEventStream } from '../network/types'
|
|
6
7
|
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
7
8
|
import { StreamedArray } from '../utils/StreamedArray'
|
|
8
|
-
import { getApiAddresses } from '../api-addresses'
|
|
9
9
|
import { AgentResponseWithBuiltIn, AgentToolsOpenAPIPreview, AgentVisibilityLevel } from './types'
|
|
10
10
|
import { workspaceAiClient } from './workspace-ai'
|
|
11
11
|
|
|
12
|
-
const AGENT_DEFAULT_SLUG = '
|
|
12
|
+
const AGENT_DEFAULT_SLUG = 'stk_flex'
|
|
13
13
|
|
|
14
14
|
class AgentToolsClient extends ReactQueryNetworkClient {
|
|
15
15
|
constructor() {
|
|
@@ -83,7 +83,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
83
83
|
{ visibility: 'built_in', slug: this.agentDefaultSlug, authorization: '' }, { signal },
|
|
84
84
|
)
|
|
85
85
|
|
|
86
|
-
const agentId = agentDefault
|
|
86
|
+
const agentId = agentDefault?.find((agent) => agent.slug === this.agentDefaultSlug)?.id
|
|
87
87
|
const agent = agentId ? await this.agent.query({ agentId }) : undefined
|
|
88
88
|
return agent
|
|
89
89
|
},
|
|
@@ -95,7 +95,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
95
95
|
allAgents = this.query({
|
|
96
96
|
name: 'allAgents',
|
|
97
97
|
request: async (signal, variables: { visibilities: (AgentVisibilityLevel | 'all')[] }) => {
|
|
98
|
-
const allVisibilities = ['account', 'built_in', 'favorite', 'personal', 'shared', 'workspace'] as const
|
|
98
|
+
const allVisibilities = ['account', 'built_in', 'recently_used', 'favorite', 'personal', 'shared', 'workspace'] as const
|
|
99
99
|
const visibilities = variables.visibilities.includes('all')
|
|
100
100
|
? allVisibilities
|
|
101
101
|
: variables.visibilities as Array<AgentVisibilityLevelEnum | VisibilityLevelEnum>
|
package/src/client/ai.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
-
import { findLast, last } from 'lodash'
|
|
2
|
+
import { findLast, isArray, last } from 'lodash'
|
|
3
|
+
import { getApiAddresses } from '../api-addresses'
|
|
3
4
|
import {
|
|
4
5
|
addFavoriteV1AiStacksStackIdFavoritePost,
|
|
5
6
|
addFavoriteV1QuickCommandsSlugFavoritePost,
|
|
@@ -55,7 +56,6 @@ import {
|
|
|
55
56
|
ReplaceResult,
|
|
56
57
|
StepChatStep,
|
|
57
58
|
} from './types'
|
|
58
|
-
import { getApiAddresses } from '../api-addresses'
|
|
59
59
|
|
|
60
60
|
class AIClient extends ReactQueryNetworkClient {
|
|
61
61
|
constructor() {
|
|
@@ -63,11 +63,13 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
66
|
+
// @ts-ignore API documentation is wrong
|
|
67
|
+
const details = (error.data as HttpValidationError | undefined)?.details
|
|
66
68
|
return new StackspotAPIError({
|
|
67
69
|
status: error.status,
|
|
68
70
|
headers: error.headers,
|
|
69
71
|
stack: error.stack,
|
|
70
|
-
message: (
|
|
72
|
+
message: isArray(details) ? details?.map(d => d.msg)?.join('\n') : details,
|
|
71
73
|
})
|
|
72
74
|
}
|
|
73
75
|
|
|
@@ -381,3 +383,4 @@ class AIClient extends ReactQueryNetworkClient {
|
|
|
381
383
|
}
|
|
382
384
|
|
|
383
385
|
export const aiClient = new AIClient()
|
|
386
|
+
|
package/src/client/code-shift.ts
CHANGED
|
@@ -1,32 +1,39 @@
|
|
|
1
1
|
|
|
2
2
|
import { HttpError } from '@oazapfts/runtime'
|
|
3
3
|
import {
|
|
4
|
+
analyticsRepositoryLastReportStatusDownloadV1AnalyticsRepositoriesLastReportStatusDownloadGet,
|
|
5
|
+
analyticsRepositoryLastReportStatusV1AnalyticsRepositoriesLastReportStatusGet,
|
|
6
|
+
analyticsRepositoryUsageDownloadV1AnalyticsRepositoriesUsageDownloadGet,
|
|
7
|
+
analyticsRepositoryUsageV1AnalyticsRepositoriesUsageGet,
|
|
8
|
+
analyticsProgramGroupsLastReportStatusDownloadV1AnalyticsProgramGroupsLastReportStatusDownloadGet,
|
|
9
|
+
analyticsProgramGroupsLastReportStatusV1AnalyticsProgramGroupsLastReportStatusGet,
|
|
10
|
+
analyticsProgramGroupsUsageDownloadV1AnalyticsProgramGroupsUsageDownloadGet,
|
|
11
|
+
analyticsProgramGroupsUsageV1AnalyticsProgramGroupsUsageGet,
|
|
12
|
+
analyticsUserUsageDownloadV1AnalyticsUsersUsageDownloadGet,
|
|
13
|
+
analyticsUserUsageV1AnalyticsUsersUsageGet,
|
|
4
14
|
checkRoleRouteV1RolesRoleGet,
|
|
5
15
|
createAccountSettingsV1SettingsPut,
|
|
6
|
-
createApplicationsBatchServiceV1ApplicationsBatchPost,
|
|
7
|
-
createApplicationServiceV1ApplicationsPost,
|
|
8
16
|
createIntegrationServiceV1IntegrationsPost,
|
|
9
17
|
createModuleServiceV1ModulesPost,
|
|
10
18
|
createProgramGroupServiceV1ProgramGroupsPost,
|
|
11
19
|
createReposBatchServiceV1ReposBatchPost,
|
|
12
20
|
createRepositoryServiceV1ReposPost,
|
|
13
21
|
defaults,
|
|
14
|
-
deleteApplicationServiceV1ApplicationsApplicationIdDelete,
|
|
15
22
|
deleteIntegrationServiceV1IntegrationsIntegrationIdDelete,
|
|
16
23
|
deleteProgramGroupServiceV1ProgramGroupsProgramGroupIdDelete,
|
|
17
24
|
deleteRepositoryServiceV1ReposRepositoryIdDelete,
|
|
18
25
|
dispatchModuleServiceV1ModulesDispatchesPost,
|
|
19
26
|
downloadReportV1ReportsReportIdDownloadGet,
|
|
20
27
|
downloadSearchReposScmServiceV1ReposSearchScmSearchRepoIdDownloadGet,
|
|
28
|
+
generalReportSuccessAndErrorsV1AnalyticsReportsGeneralSuccessAndErrorsGet,
|
|
21
29
|
getAccountSettingsV1SettingsGet,
|
|
22
|
-
getApplicationByIdServiceV1ApplicationsApplicationIdGet,
|
|
23
30
|
getIntegrationByIdServiceV1IntegrationsIntegrationIdGet,
|
|
24
31
|
getProgramGroupByIdServiceV1ProgramGroupsProgramGroupIdGet,
|
|
32
|
+
getReportPullRequestContentV1ReportsReportIdPullRequestGet,
|
|
25
33
|
getReportV1ReportsReportIdGet,
|
|
26
34
|
getRepositoryByIdServiceV1ReposRepositoryIdGet,
|
|
27
35
|
getStatusSearchReposScmServiceV1ReposSearchScmSearchRepoIdStatusGet,
|
|
28
|
-
|
|
29
|
-
listApplicationServiceV1ApplicationsGet,
|
|
36
|
+
listBranchesServiceV1ReposBranchesGet,
|
|
30
37
|
listIntegrationServiceV1IntegrationsGet,
|
|
31
38
|
listModulesServiceV1ModulesGet,
|
|
32
39
|
listProgramGroupReportServiceV1ProgramGroupsProgramGroupIdReportsGet,
|
|
@@ -35,10 +42,11 @@ import {
|
|
|
35
42
|
listRepositoryServiceV1ReposGet,
|
|
36
43
|
listTagsServiceV1TagsGet,
|
|
37
44
|
searchReposScmServiceV1ReposSearchScmGet,
|
|
38
|
-
updateApplicationServiceV1ApplicationsApplicationIdPut,
|
|
39
45
|
updateIntegrationServiceV1IntegrationsIntegrationIdPut,
|
|
46
|
+
updateProgramGroupComponentsServiceV1ProgramGroupsProgramGroupIdComponentsPut,
|
|
40
47
|
updateProgramGroupServiceV1ProgramGroupsProgramGroupIdPut,
|
|
41
48
|
updateRepositoryServiceV1ReposRepositoryIdPut,
|
|
49
|
+
validateScmUrlServiceV1ReposValidateScmUrlPost,
|
|
42
50
|
} from '../api/codeShift'
|
|
43
51
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
44
52
|
import { codeShiftDictionary } from '../error/dictionary/code-shift'
|
|
@@ -56,36 +64,6 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
56
64
|
return new DefaultAPIError(error.data, error.status, codeShiftDictionary, error.headers)
|
|
57
65
|
}
|
|
58
66
|
|
|
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
67
|
/**
|
|
90
68
|
* Creates a repository.
|
|
91
69
|
*/
|
|
@@ -110,6 +88,10 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
110
88
|
* Updates a repository
|
|
111
89
|
*/
|
|
112
90
|
updateRepository = this.mutation(removeAuthorizationParam(updateRepositoryServiceV1ReposRepositoryIdPut))
|
|
91
|
+
/**
|
|
92
|
+
* Get a report for a pull request by id.
|
|
93
|
+
*/
|
|
94
|
+
getReportPullRequestContent = this.query(removeAuthorizationParam(getReportPullRequestContentV1ReportsReportIdPullRequestGet))
|
|
113
95
|
/**
|
|
114
96
|
* Gets modules.
|
|
115
97
|
*/
|
|
@@ -122,11 +104,6 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
122
104
|
* Generates a report.
|
|
123
105
|
*/
|
|
124
106
|
generateReport = this.mutation(removeAuthorizationParam(dispatchModuleServiceV1ModulesDispatchesPost))
|
|
125
|
-
/**
|
|
126
|
-
* @deprecated use repositoryReports instead
|
|
127
|
-
* Gets reports.
|
|
128
|
-
*/
|
|
129
|
-
reports = this.query(removeAuthorizationParam(listApplicationReportV1ApplicationsApplicationIdReportsGet))
|
|
130
107
|
/**
|
|
131
108
|
* Gets repository reports.
|
|
132
109
|
*/
|
|
@@ -164,67 +141,127 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
164
141
|
* We do not use opa in this api, so this is the fn needed to check permissions.
|
|
165
142
|
*/
|
|
166
143
|
validateRolePermissions = this.query(removeAuthorizationParam(checkRoleRouteV1RolesRoleGet))
|
|
167
|
-
|
|
168
144
|
/**
|
|
169
145
|
* Creates an integration
|
|
170
146
|
*/
|
|
171
147
|
createIntegration = this.mutation(removeAuthorizationParam(createIntegrationServiceV1IntegrationsPost))
|
|
172
|
-
|
|
173
148
|
/**
|
|
174
149
|
* Lists integrations
|
|
175
150
|
*/
|
|
176
151
|
listIntegration = this.query(removeAuthorizationParam(listIntegrationServiceV1IntegrationsGet))
|
|
177
|
-
|
|
178
152
|
/**
|
|
179
153
|
* Gets an integration by id
|
|
180
154
|
*/
|
|
181
155
|
getIntegrationById = this.query(removeAuthorizationParam(getIntegrationByIdServiceV1IntegrationsIntegrationIdGet))
|
|
182
|
-
|
|
183
156
|
/**
|
|
184
157
|
* Updates an integration
|
|
185
158
|
*/
|
|
186
159
|
updateIntegration = this.mutation(removeAuthorizationParam(updateIntegrationServiceV1IntegrationsIntegrationIdPut))
|
|
187
|
-
|
|
188
160
|
/**
|
|
189
161
|
* Deletes an integration
|
|
190
162
|
*/
|
|
191
163
|
deleteIntegration = this.mutation(removeAuthorizationParam(deleteIntegrationServiceV1IntegrationsIntegrationIdDelete))
|
|
192
|
-
|
|
193
164
|
/**
|
|
194
165
|
* Creates a program group.
|
|
195
166
|
*/
|
|
196
167
|
createProgramGroup = this.mutation(removeAuthorizationParam(createProgramGroupServiceV1ProgramGroupsPost))
|
|
197
|
-
|
|
198
168
|
/**
|
|
199
169
|
* Gets list of program groups.
|
|
200
170
|
*/
|
|
201
171
|
listProgramGroups = this.query(removeAuthorizationParam(listProgramGroupServiceV1ProgramGroupsGet))
|
|
202
|
-
|
|
203
172
|
/**
|
|
204
173
|
* Gets a program group by id.
|
|
205
174
|
*/
|
|
206
175
|
getProgramGroupById = this.query(removeAuthorizationParam(getProgramGroupByIdServiceV1ProgramGroupsProgramGroupIdGet))
|
|
207
|
-
|
|
208
176
|
/**
|
|
209
|
-
|
|
210
|
-
|
|
177
|
+
* List Program Group Report Service
|
|
178
|
+
*/
|
|
211
179
|
listProgramGroupReport = this.query(removeAuthorizationParam(listProgramGroupReportServiceV1ProgramGroupsProgramGroupIdReportsGet))
|
|
212
|
-
|
|
213
180
|
/**
|
|
214
181
|
* Updates a program group.
|
|
215
182
|
*/
|
|
216
183
|
updateProgramGroup = this.mutation(removeAuthorizationParam(updateProgramGroupServiceV1ProgramGroupsProgramGroupIdPut))
|
|
217
|
-
|
|
184
|
+
/**
|
|
185
|
+
* Updates a program group components.
|
|
186
|
+
*/
|
|
187
|
+
updateProgramGroupComponents = this.mutation(
|
|
188
|
+
removeAuthorizationParam(updateProgramGroupComponentsServiceV1ProgramGroupsProgramGroupIdComponentsPut),
|
|
189
|
+
)
|
|
218
190
|
/**
|
|
219
191
|
* Deletes a program group.
|
|
220
192
|
*/
|
|
221
193
|
deleteProgramGroup = this.mutation(removeAuthorizationParam(deleteProgramGroupServiceV1ProgramGroupsProgramGroupIdDelete))
|
|
222
|
-
|
|
223
194
|
/**
|
|
224
195
|
* Gets list of tags.
|
|
225
196
|
*/
|
|
226
197
|
tags = this.query(removeAuthorizationParam(listTagsServiceV1TagsGet))
|
|
198
|
+
/**
|
|
199
|
+
* Validates a SCM URL.
|
|
200
|
+
*/
|
|
201
|
+
validateSCMUrl = this.mutation(removeAuthorizationParam(validateScmUrlServiceV1ReposValidateScmUrlPost))
|
|
202
|
+
/**
|
|
203
|
+
* Get Branches for a Repository
|
|
204
|
+
*/
|
|
205
|
+
getBranches = this.query(removeAuthorizationParam(listBranchesServiceV1ReposBranchesGet))
|
|
227
206
|
|
|
207
|
+
/**
|
|
208
|
+
* General Report Success And Errors
|
|
209
|
+
*/
|
|
210
|
+
generalReportSuccessAndErrors = this.query(
|
|
211
|
+
removeAuthorizationParam(generalReportSuccessAndErrorsV1AnalyticsReportsGeneralSuccessAndErrorsGet),
|
|
212
|
+
)
|
|
213
|
+
/**
|
|
214
|
+
* Analytics Repository Last Report Status
|
|
215
|
+
*/
|
|
216
|
+
analyticsRepositoryLastReportStatus = this.query(
|
|
217
|
+
removeAuthorizationParam(analyticsRepositoryLastReportStatusV1AnalyticsRepositoriesLastReportStatusGet),
|
|
218
|
+
)
|
|
219
|
+
/**
|
|
220
|
+
* Analytics Repository Last Report Status Download
|
|
221
|
+
*/
|
|
222
|
+
analyticsRepositoryLastReportStatusDownload = this.query(
|
|
223
|
+
removeAuthorizationParam(analyticsRepositoryLastReportStatusDownloadV1AnalyticsRepositoriesLastReportStatusDownloadGet),
|
|
224
|
+
)
|
|
225
|
+
/**
|
|
226
|
+
* Analytics Repository Usage
|
|
227
|
+
*/
|
|
228
|
+
analyticsRepositoryUsage = this.query(removeAuthorizationParam(analyticsRepositoryUsageV1AnalyticsRepositoriesUsageGet))
|
|
229
|
+
/**
|
|
230
|
+
* Analytics Program Groups Last Report Status
|
|
231
|
+
*/
|
|
232
|
+
analyticsProgramGroupsLastReportStatus = this.query(
|
|
233
|
+
removeAuthorizationParam(analyticsProgramGroupsLastReportStatusV1AnalyticsProgramGroupsLastReportStatusGet),
|
|
234
|
+
)
|
|
235
|
+
/**
|
|
236
|
+
* Analytics Program Groups Usage
|
|
237
|
+
*/
|
|
238
|
+
analyticsProgramGroupsUsage = this.query(removeAuthorizationParam(analyticsProgramGroupsUsageV1AnalyticsProgramGroupsUsageGet))
|
|
239
|
+
/**
|
|
240
|
+
* Analytics User Usage
|
|
241
|
+
*/
|
|
242
|
+
analyticsUserUsage = this.query(removeAuthorizationParam(analyticsUserUsageV1AnalyticsUsersUsageGet))
|
|
243
|
+
/**
|
|
244
|
+
* Analytics User Usage Download
|
|
245
|
+
*/
|
|
246
|
+
analyticsUserUsageDownload = this.query(removeAuthorizationParam(analyticsUserUsageDownloadV1AnalyticsUsersUsageDownloadGet))
|
|
247
|
+
/**
|
|
248
|
+
* Analytics Repository Usage Download
|
|
249
|
+
*/
|
|
250
|
+
analyticsRepositoryUsageDownload = this.query(
|
|
251
|
+
removeAuthorizationParam(analyticsRepositoryUsageDownloadV1AnalyticsRepositoriesUsageDownloadGet),
|
|
252
|
+
)
|
|
253
|
+
/**
|
|
254
|
+
* Analytics Program Groups Last Report Status Download
|
|
255
|
+
*/
|
|
256
|
+
analyticsProgramGroupsLastReportStatusDownload = this.query(
|
|
257
|
+
removeAuthorizationParam(analyticsProgramGroupsLastReportStatusDownloadV1AnalyticsProgramGroupsLastReportStatusDownloadGet),
|
|
258
|
+
)
|
|
259
|
+
/**
|
|
260
|
+
* Analytics Program Groups Usage Download
|
|
261
|
+
*/
|
|
262
|
+
analyticsProgramGroupsUsageDownload = this.query(
|
|
263
|
+
removeAuthorizationParam(analyticsProgramGroupsUsageDownloadV1AnalyticsProgramGroupsUsageDownloadGet),
|
|
264
|
+
)
|
|
228
265
|
}
|
|
229
266
|
|
|
230
267
|
export const codeShiftClient = new CodeShift()
|
package/src/client/content.ts
CHANGED
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
getDependentWorkflowVersions,
|
|
34
34
|
getGetPluginView,
|
|
35
35
|
getInfrastructureEnvironmentsUsesPlugin,
|
|
36
|
+
getInputs1,
|
|
36
37
|
getListOfInputs,
|
|
37
38
|
getPlugin,
|
|
38
39
|
getPluginInfrastructureView,
|
|
@@ -528,6 +529,10 @@ class ContentClient extends ReactQueryNetworkClient {
|
|
|
528
529
|
* Get usage summary of workflow version
|
|
529
530
|
*/
|
|
530
531
|
workflowVersionUsageSummary = this.query(getWorkflowVersionUsageSummary)
|
|
532
|
+
/**
|
|
533
|
+
* Get list of inputs of a workflow
|
|
534
|
+
*/
|
|
535
|
+
workflowInputs = this.query(getInputs1)
|
|
531
536
|
}
|
|
532
537
|
|
|
533
538
|
export const contentClient = new ContentClient()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
import { HttpError } from '@oazapfts/runtime'
|
|
3
|
-
import {
|
|
3
|
+
import { getApiAddresses } from '../api-addresses'
|
|
4
|
+
import { addSelfHostedModelV1LlmModelsPost, agentChatV1AgentAgentIdChatPost, defaults, deleteModelResourcesV1LlmResourcesResourceIdDelete, deleteV1LlmModelsModelIdDelete, getModelV1LlmModelsModelIdGet, listLlmProvidersV1LlmProvidersGet, listModelsV1LlmModelsGet, saveOrUpdateModelResourcesV1LlmModelsModelIdResourcesPut, toggleModelStatusV1LlmModelsModelIdPatch, updateV1LlmModelsModelIdPut } from '../api/genAiInference'
|
|
4
5
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
5
6
|
import { inferenceDictionary } from '../error/dictionary/ai-inference'
|
|
6
7
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
7
8
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
8
9
|
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
9
|
-
import { getApiAddresses } from '../api-addresses'
|
|
10
10
|
|
|
11
11
|
class GenAiInference extends ReactQueryNetworkClient {
|
|
12
12
|
constructor() {
|
|
@@ -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(removeAuthorizationParam(agentChatV1AgentAgentIdChatPost))
|
|
58
63
|
}
|
|
59
64
|
|
|
60
65
|
export const genAiInferenceClient = new GenAiInference()
|
|
@@ -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 (
|
|
69
|
+
if (raw?.validationDetails?.length) {
|
|
65
70
|
|
|
66
|
-
|
|
67
|
-
|
|
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 (
|
|
71
|
-
|
|
72
|
-
return interpolateErrors(codeTranslatedMessage, value, dict)
|
|
74
|
+
if (suggestedMessages.length) {
|
|
75
|
+
return { description: suggestedMessages.join('\n'), ...dictionaryDetails }
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
+
};
|