@stack-spot/portal-network 0.178.0 → 0.179.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +305 -0
- package/dist/api/agent-tools.d.ts +72 -1
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js +36 -1
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/codeShift.d.ts +170 -10
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +97 -0
- package/dist/api/codeShift.js.map +1 -1
- package/dist/apis-itau.json +1 -1
- package/dist/client/agent-tools.d.ts +14 -1
- package/dist/client/agent-tools.d.ts.map +1 -1
- package/dist/client/agent-tools.js +11 -2
- package/dist/client/agent-tools.js.map +1 -1
- package/dist/client/api-management.d.ts +9 -0
- package/dist/client/api-management.d.ts.map +1 -1
- package/dist/client/api-management.js +11 -2
- package/dist/client/api-management.js.map +1 -1
- package/dist/client/code-shift.d.ts +69 -4
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +55 -1
- package/dist/client/code-shift.js.map +1 -1
- package/dist/error/DefaultAPIError.d.ts.map +1 -1
- package/dist/error/DefaultAPIError.js.map +1 -1
- package/dist/error/StackspotAPIError.d.ts +3 -4
- package/dist/error/StackspotAPIError.d.ts.map +1 -1
- package/dist/error/StackspotAPIError.js +3 -3
- package/dist/error/StackspotAPIError.js.map +1 -1
- package/package.json +2 -2
- package/readme.md +1 -1
- package/src/api/account.ts +1 -0
- package/src/api/agent-tools.ts +117 -1
- package/src/api/agent.ts +2 -0
- package/src/api/codeShift.ts +368 -12
- package/src/api/notification.ts +2 -0
- package/src/apis-itau.json +1 -1
- package/src/client/agent-tools.ts +7 -2
- package/src/client/ai.ts +1 -0
- package/src/client/api-management.ts +7 -2
- package/src/client/code-shift.ts +36 -0
- package/src/error/DefaultAPIError.ts +5 -5
- package/src/error/StackspotAPIError.ts +4 -4
package/src/client/code-shift.ts
CHANGED
|
@@ -58,6 +58,12 @@ import {
|
|
|
58
58
|
getModuleV1ModulesModuleIdGet,
|
|
59
59
|
analyticsProgramGroupsTargetDetailsV1AnalyticsProgramGroupsTargetDetailsGet,
|
|
60
60
|
analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet,
|
|
61
|
+
analyticsRepositoryTargetDetailsV1AnalyticsRepositoriesTargetDetailsGet,
|
|
62
|
+
analyticsRepositoryTargetDetailsDownloadV1AnalyticsRepositoriesTargetDetailsDownloadGet,
|
|
63
|
+
searchReposScmServiceV2ReposSearchScmPost,
|
|
64
|
+
importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost,
|
|
65
|
+
searchReposScmV2V2ReposSearchScmSearchIdGet,
|
|
66
|
+
putCustomerRatingReportV1ReportsReportIdCustomerRatingPut,
|
|
61
67
|
} from '../api/codeShift'
|
|
62
68
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
63
69
|
import { codeShiftDictionary } from '../error/dictionary/code-shift'
|
|
@@ -159,6 +165,18 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
159
165
|
* Downloads file with found repositories
|
|
160
166
|
*/
|
|
161
167
|
downloadSearchRepository = this.mutation(removeAuthorizationParam(downloadSearchReposScmServiceV1ReposSearchScmSearchRepoIdDownloadGet))
|
|
168
|
+
/**
|
|
169
|
+
* Searches for repositories (v2)
|
|
170
|
+
*/
|
|
171
|
+
searchRepositoryV2 = this.mutation(removeAuthorizationParam(searchReposScmServiceV2ReposSearchScmPost))
|
|
172
|
+
/**
|
|
173
|
+
* Imports repositories (v2)
|
|
174
|
+
*/
|
|
175
|
+
importRepositories = this.mutation(removeAuthorizationParam(importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost))
|
|
176
|
+
/**
|
|
177
|
+
* Gets repositories search by id (v2)
|
|
178
|
+
*/
|
|
179
|
+
getRepositoriesBySearchId = this.query(removeAuthorizationParam(searchReposScmV2V2ReposSearchScmSearchIdGet))
|
|
162
180
|
/**
|
|
163
181
|
* Validate if the user has permission.
|
|
164
182
|
* We do not use opa in this api, so this is the fn needed to check permissions.
|
|
@@ -330,6 +348,24 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
330
348
|
analyticsProgramGroupsTargetDetailsDownload = this.query(
|
|
331
349
|
removeAuthorizationParam(analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet),
|
|
332
350
|
)
|
|
351
|
+
/**
|
|
352
|
+
* Analytics Repository Target Details
|
|
353
|
+
*/
|
|
354
|
+
analyticsRepositoryTargetDetails = this.query(
|
|
355
|
+
removeAuthorizationParam(analyticsRepositoryTargetDetailsV1AnalyticsRepositoriesTargetDetailsGet),
|
|
356
|
+
)
|
|
357
|
+
/**
|
|
358
|
+
* Analytics Repository Target Details Download
|
|
359
|
+
*/
|
|
360
|
+
analyticsRepositoryTargetDetailsDownload = this.query(
|
|
361
|
+
removeAuthorizationParam(analyticsRepositoryTargetDetailsDownloadV1AnalyticsRepositoriesTargetDetailsDownloadGet),
|
|
362
|
+
)
|
|
363
|
+
/**
|
|
364
|
+
* Put Customer Rating Report
|
|
365
|
+
*/
|
|
366
|
+
updateReportRating = this.mutation(
|
|
367
|
+
removeAuthorizationParam(putCustomerRatingReportV1ReportsReportIdCustomerRatingPut),
|
|
368
|
+
)
|
|
333
369
|
}
|
|
334
370
|
|
|
335
371
|
export const codeShiftClient = new CodeShift()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dictionary
|
|
1
|
+
import { Dictionary } from '@stack-spot/portal-translate'
|
|
2
2
|
import { every, isString } from 'lodash'
|
|
3
3
|
import { actionDetails } from './dictionary/action-details'
|
|
4
4
|
import { baseDictionary } from './dictionary/base'
|
|
@@ -24,7 +24,7 @@ const detailsDictionary = {
|
|
|
24
24
|
actionapi: actionDetails,
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
function getTitle(status: number, raw: ErrorResponse, dictionary: Dictionary, language:
|
|
27
|
+
function getTitle(status: number, raw: ErrorResponse, dictionary: Dictionary, language: 'pt' | 'en') {
|
|
28
28
|
if (ignoredTitleErrorCodes.includes(raw.code)) return ' '
|
|
29
29
|
if (dictionary[language][raw.code]) return dictionary[language][raw.code]
|
|
30
30
|
if (raw.details && !ignoredDescriptions.includes(raw.details)) return raw.details
|
|
@@ -35,8 +35,8 @@ 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?:
|
|
39
|
-
const parseLanguage: Record<
|
|
38
|
+
function getSuggestedMessages(suggestedMessage: ErrorResponse['suggestedMessages'] | null | undefined, language?: 'pt' | 'en') {
|
|
39
|
+
const parseLanguage: Record<'pt' | 'en', LanguageSuggestedMessageKeys> = { pt: 'ptBr', en: 'enUs' }
|
|
40
40
|
return suggestedMessage?.[parseLanguage?.[language || 'en']]
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -60,7 +60,7 @@ export function interpolateErrors(message: string, values: string[], fieldValues
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
function createMessage(status: number, raw: ErrorResponse, dictionary: Dictionary, language?:
|
|
63
|
+
function createMessage(status: number, raw: ErrorResponse, dictionary: Dictionary, language?: 'pt' | 'en'): ErrorDetailsProperties {
|
|
64
64
|
const title = getTitle(status, raw, dictionary, language || 'en')
|
|
65
65
|
const api = raw.code?.split(/[-_]/)[0]
|
|
66
66
|
const dictDetails = (detailsDictionary[api?.toLowerCase() as keyof typeof detailsDictionary] ?? {})[language || 'en']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getLanguage, ptEn } from '@stack-spot/portal-translate'
|
|
2
2
|
|
|
3
|
-
export type InternationalizedMessage = (language:
|
|
3
|
+
export type InternationalizedMessage = (language: 'pt' | 'en') => string | ErrorDetailsProperties
|
|
4
4
|
|
|
5
5
|
export interface ErrorDetailsProperties {
|
|
6
6
|
/**
|
|
@@ -81,7 +81,7 @@ export class StackspotAPIError extends Error {
|
|
|
81
81
|
* @param language
|
|
82
82
|
* @returns an error message
|
|
83
83
|
*/
|
|
84
|
-
translate(language
|
|
84
|
+
translate(language = getLanguage(ptEn)): string {
|
|
85
85
|
const unknown = language === 'en' ? 'unknown error' : 'erro desconhecido'
|
|
86
86
|
|
|
87
87
|
const error = this.intl?.(language)
|
|
@@ -89,7 +89,7 @@ export class StackspotAPIError extends Error {
|
|
|
89
89
|
return message ?? this.message ?? this.code ?? (this.status === 0 ? unknown : `${this.status}`)
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
translateDetails(language
|
|
92
|
+
translateDetails(language = getLanguage(ptEn)): ErrorDetailsProperties {
|
|
93
93
|
const unknown = language === 'en' ? 'unknown error' : 'erro desconhecido'
|
|
94
94
|
const errorMessage = this.intl?.(language)
|
|
95
95
|
if (typeof errorMessage === 'string')
|