@stack-spot/portal-network 0.160.0-beta.2 → 0.160.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.
Files changed (143) hide show
  1. package/CHANGELOG.md +5 -80
  2. package/dist/api/codeShift.d.ts +205 -146
  3. package/dist/api/codeShift.d.ts.map +1 -1
  4. package/dist/api/codeShift.js +94 -50
  5. package/dist/api/codeShift.js.map +1 -1
  6. package/dist/api-addresses.d.ts +0 -32
  7. package/dist/api-addresses.d.ts.map +1 -1
  8. package/dist/api-addresses.js +0 -53
  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 +10 -10
  15. package/dist/client/agent-tools.d.ts.map +1 -1
  16. package/dist/client/agent-tools.js +7 -7
  17. package/dist/client/agent-tools.js.map +1 -1
  18. package/dist/client/agent.d.ts +0 -1
  19. package/dist/client/agent.d.ts.map +1 -1
  20. package/dist/client/agent.js +2 -3
  21. package/dist/client/agent.js.map +1 -1
  22. package/dist/client/ai.d.ts.map +1 -1
  23. package/dist/client/ai.js +2 -2
  24. package/dist/client/ai.js.map +1 -1
  25. package/dist/client/api-management.d.ts.map +1 -1
  26. package/dist/client/api-management.js +2 -2
  27. package/dist/client/api-management.js.map +1 -1
  28. package/dist/client/cloud-account.d.ts.map +1 -1
  29. package/dist/client/cloud-account.js +2 -2
  30. package/dist/client/cloud-account.js.map +1 -1
  31. package/dist/client/cloud-platform-horizon.d.ts.map +1 -1
  32. package/dist/client/cloud-platform-horizon.js +2 -2
  33. package/dist/client/cloud-platform-horizon.js.map +1 -1
  34. package/dist/client/cloud-platform.d.ts.map +1 -1
  35. package/dist/client/cloud-platform.js +2 -2
  36. package/dist/client/cloud-platform.js.map +1 -1
  37. package/dist/client/cloud-runtimes.d.ts.map +1 -1
  38. package/dist/client/cloud-runtimes.js +2 -2
  39. package/dist/client/cloud-runtimes.js.map +1 -1
  40. package/dist/client/cloud-services.d.ts.map +1 -1
  41. package/dist/client/cloud-services.js +2 -2
  42. package/dist/client/cloud-services.js.map +1 -1
  43. package/dist/client/code-shift.d.ts +67 -32
  44. package/dist/client/code-shift.d.ts.map +1 -1
  45. package/dist/client/code-shift.js +75 -41
  46. package/dist/client/code-shift.js.map +1 -1
  47. package/dist/client/content.d.ts.map +1 -1
  48. package/dist/client/content.js +2 -2
  49. package/dist/client/content.js.map +1 -1
  50. package/dist/client/data-integration.d.ts.map +1 -1
  51. package/dist/client/data-integration.js +2 -2
  52. package/dist/client/data-integration.js.map +1 -1
  53. package/dist/client/discovery.d.ts.map +1 -1
  54. package/dist/client/discovery.js +2 -2
  55. package/dist/client/discovery.js.map +1 -1
  56. package/dist/client/event-bus.d.ts.map +1 -1
  57. package/dist/client/event-bus.js +2 -2
  58. package/dist/client/event-bus.js.map +1 -1
  59. package/dist/client/gen-ai-inference.d.ts +0 -9
  60. package/dist/client/gen-ai-inference.d.ts.map +1 -1
  61. package/dist/client/gen-ai-inference.js +3 -12
  62. package/dist/client/gen-ai-inference.js.map +1 -1
  63. package/dist/client/insights.d.ts.map +1 -1
  64. package/dist/client/insights.js +2 -2
  65. package/dist/client/insights.js.map +1 -1
  66. package/dist/client/notification.d.ts.map +1 -1
  67. package/dist/client/notification.js +2 -2
  68. package/dist/client/notification.js.map +1 -1
  69. package/dist/client/runtime-manager.d.ts.map +1 -1
  70. package/dist/client/runtime-manager.js +2 -2
  71. package/dist/client/runtime-manager.js.map +1 -1
  72. package/dist/client/secrets.d.ts.map +1 -1
  73. package/dist/client/secrets.js +2 -2
  74. package/dist/client/secrets.js.map +1 -1
  75. package/dist/client/workflow.d.ts.map +1 -1
  76. package/dist/client/workflow.js +2 -2
  77. package/dist/client/workflow.js.map +1 -1
  78. package/dist/client/workspace-ai.d.ts +4 -1
  79. package/dist/client/workspace-ai.d.ts.map +1 -1
  80. package/dist/client/workspace-ai.js +2 -2
  81. package/dist/client/workspace-ai.js.map +1 -1
  82. package/dist/client/workspace-manager.d.ts.map +1 -1
  83. package/dist/client/workspace-manager.js +2 -2
  84. package/dist/client/workspace-manager.js.map +1 -1
  85. package/dist/client/workspace-search.d.ts.map +1 -1
  86. package/dist/client/workspace-search.js +2 -2
  87. package/dist/client/workspace-search.js.map +1 -1
  88. package/dist/client/workspace.d.ts.map +1 -1
  89. package/dist/client/workspace.js +2 -2
  90. package/dist/client/workspace.js.map +1 -1
  91. package/dist/error/DefaultAPIError.d.ts +1 -1
  92. package/dist/error/DefaultAPIError.d.ts.map +1 -1
  93. package/dist/error/DefaultAPIError.js +12 -27
  94. package/dist/error/DefaultAPIError.js.map +1 -1
  95. package/dist/index.d.ts +1 -1
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +1 -1
  98. package/dist/index.js.map +1 -1
  99. package/dist/network/NetworkClient.d.ts +0 -6
  100. package/dist/network/NetworkClient.d.ts.map +1 -1
  101. package/dist/network/NetworkClient.js +1 -10
  102. package/dist/network/NetworkClient.js.map +1 -1
  103. package/package.json +1 -1
  104. package/readme.md +1 -1
  105. package/src/api/account.ts +0 -1
  106. package/src/api/agent-tools.ts +0 -3
  107. package/src/api/agent.ts +0 -2
  108. package/src/api/codeShift.ts +490 -322
  109. package/src/api/notification.ts +0 -2
  110. package/src/api-addresses.ts +0 -71
  111. package/src/client/account.ts +7 -2
  112. package/src/client/agent-tools.ts +8 -7
  113. package/src/client/agent.ts +2 -4
  114. package/src/client/ai.ts +2 -3
  115. package/src/client/api-management.ts +2 -2
  116. package/src/client/cloud-account.ts +2 -2
  117. package/src/client/cloud-platform-horizon.ts +2 -2
  118. package/src/client/cloud-platform.ts +2 -2
  119. package/src/client/cloud-runtimes.ts +2 -2
  120. package/src/client/cloud-services.ts +2 -2
  121. package/src/client/code-shift.ts +59 -26
  122. package/src/client/content.ts +2 -2
  123. package/src/client/data-integration.ts +2 -2
  124. package/src/client/discovery.ts +2 -2
  125. package/src/client/event-bus.ts +2 -2
  126. package/src/client/gen-ai-inference.ts +3 -8
  127. package/src/client/insights.ts +2 -2
  128. package/src/client/notification.ts +2 -2
  129. package/src/client/runtime-manager.ts +2 -2
  130. package/src/client/secrets.ts +2 -2
  131. package/src/client/workflow.ts +2 -2
  132. package/src/client/workspace-ai.ts +2 -2
  133. package/src/client/workspace-manager.ts +2 -2
  134. package/src/client/workspace-search.ts +2 -2
  135. package/src/client/workspace.ts +2 -2
  136. package/src/error/DefaultAPIError.ts +12 -35
  137. package/src/index.ts +1 -1
  138. package/src/network/NetworkClient.ts +1 -11
  139. package/dist/error/types.d.ts +0 -19
  140. package/dist/error/types.d.ts.map +0 -1
  141. package/dist/error/types.js +0 -2
  142. package/dist/error/types.js.map +0 -1
  143. package/src/error/types.ts +0 -21
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { HttpError } from '@oazapfts/runtime'
3
- import { getApiAddresses } from '../api-addresses'
4
- import { addSelfHostedModelV1LlmModelsPost, agentChatV1AgentAgentIdChatPost, defaults, deleteModelResourcesV1LlmResourcesResourceIdDelete, deleteV1LlmModelsModelIdDelete, getModelV1LlmModelsModelIdGet, listLlmProvidersV1LlmProvidersGet, listModelsV1LlmModelsGet, saveOrUpdateModelResourcesV1LlmModelsModelIdResourcesPut, toggleModelStatusV1LlmModelsModelIdPatch, updateV1LlmModelsModelIdPut } from '../api/genAiInference'
3
+ import { addSelfHostedModelV1LlmModelsPost, defaults, deleteModelResourcesV1LlmResourcesResourceIdDelete, deleteV1LlmModelsModelIdDelete, getModelV1LlmModelsModelIdGet, listLlmProvidersV1LlmProvidersGet, listModelsV1LlmModelsGet, saveOrUpdateModelResourcesV1LlmModelsModelIdResourcesPut, toggleModelStatusV1LlmModelsModelIdPatch, updateV1LlmModelsModelIdPut } from '../api/genAiInference'
4
+ import apis from '../apis.json'
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(getApiAddresses().genAiInference.url, defaults)
13
+ super(apis.genAiInference.url, defaults)
14
14
  }
15
15
 
16
16
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -55,11 +55,6 @@ 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)
63
58
  }
64
59
 
65
60
  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'
3
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
4
5
  import { baseDictionary } from '../error/dictionary/base'
5
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
6
7
  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(getApiAddresses().insights.url, defaults)
12
+ super(apis.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'
3
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
4
5
  import { baseDictionary } from '../error/dictionary/base'
5
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
6
7
  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(getApiAddresses().notification.url, defaults)
12
+ super(apis.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'
3
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
4
5
  import { rteDictionary } from '../error/dictionary/rte'
5
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
6
7
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
7
- import { getApiAddresses } from '../api-addresses'
8
8
 
9
9
  class RuntimeManagerClient extends ReactQueryNetworkClient {
10
10
  constructor() {
11
- super(getApiAddresses().apiRuntime.url, defaults)
11
+ super(apis.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'
4
5
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
6
  import { secretsDictionary } from '../error/dictionary/secrets'
6
7
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
8
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
- import { getApiAddresses } from '../api-addresses'
9
9
 
10
10
  class SecretClient extends ReactQueryNetworkClient {
11
11
  constructor() {
12
- super(getApiAddresses().secrets.url, defaults)
12
+ super(apis.secrets.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 { createApiServiceWorkflowsCreateApiDispatchPost, defaults, getExecutionDispatchRequestServiceWorkflowsExecutionIdRequestGet, getExecutionStatusServiceWorkflowsExecutionStatusExecutionIdGet, healthCheckServiceWorkflowsHealthCheckDispatchPost, runActionServiceWorkflowsRunActionDispatchPost, v1AcceptWorkflowExecutionJobSuspendedServiceV1ExecutionsExecutionIdJobsJobIdAcceptPost, v1GetWorkflowExecutionAttemptsV1ExecutionsExecutionIdAttemptsGet, v1GetWorkflowExecutionJobDetailServiceV1ExecutionsExecutionIdJobsJobIdGet, v1GetWorkflowExecutionJobGraphServiceV1ExecutionsExecutionIdGet, v1RefuseWorkflowExecutionJobSuspendedServiceV1ExecutionsExecutionIdJobsJobIdRefusePost, v1RetryWorkflowExecutionV1ExecutionsExecutionIdRetryPost } from '../api/workflows'
3
+ import apis from '../apis.json'
3
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
4
5
  import { actionDictionary } from '../error/dictionary/action'
5
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
6
7
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
7
8
  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(getApiAddresses().workflows.url, defaults)
12
+ super(apis.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'
25
26
  import { StackspotAPIError } from '../error/StackspotAPIError'
26
27
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
27
28
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
28
29
  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(getApiAddresses()['workspace-ai'].url, defaults)
33
+ super(apis['workspace-ai'].url, defaults)
34
34
  }
35
35
 
36
36
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -72,6 +72,7 @@ import {
72
72
  workspaceVariableControllerfindByName,
73
73
  workspaceVariableControllerupsert,
74
74
  } from '../api/workspaceManager'
75
+ import apis from '../apis.json'
75
76
  import { DefaultAPIError } from '../error/DefaultAPIError'
76
77
  import { workspaceDictionary } from '../error/dictionary/workspace'
77
78
  import { StackspotAPIError } from '../error/StackspotAPIError'
@@ -79,11 +80,10 @@ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
79
80
  import { contentClient } from './content'
80
81
  import { FixedFullInputContextResponse, FixedPaginatedActivityResponse, FixedPluginForAppCreationV2Response, FixedWorkflowForCreationResponse, ReplaceResult } from './types'
81
82
  import { workspaceClient } from './workspace'
82
- import { getApiAddresses } from '../api-addresses'
83
83
 
84
84
  class WorkspaceManagerClient extends ReactQueryNetworkClient {
85
85
  constructor() {
86
- super(getApiAddresses().workspaceManager.url, defaults)
86
+ super(apis.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'
3
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
4
5
  import { baseDictionary } from '../error/dictionary/base'
5
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
6
7
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
7
- import { getApiAddresses } from '../api-addresses'
8
8
 
9
9
  class WorkspaceSearchClient extends ReactQueryNetworkClient {
10
10
  constructor() {
11
- super(getApiAddresses().workspaceSearchEngine.url, defaults)
11
+ super(apis.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'
85
86
  import { DefaultAPIError } from '../error/DefaultAPIError'
86
87
  import { workspaceDictionary } from '../error/dictionary/workspace'
87
88
  import { StackspotAPIError } from '../error/StackspotAPIError'
88
89
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
89
90
  import { OperationObject } from '../network/types'
90
- import { getApiAddresses } from '../api-addresses'
91
91
 
92
92
  class WorkspaceClient extends ReactQueryNetworkClient {
93
93
  constructor() {
94
- super(getApiAddresses().workspace.url, defaults)
94
+ super(apis.workspace.url, defaults)
95
95
  }
96
96
 
97
97
  protected buildStackSpotError(error: HttpError): StackspotAPIError {
@@ -1,5 +1,6 @@
1
1
  import { Dictionary, Language } from '@stack-spot/portal-translate'
2
2
  import { every, isString } from 'lodash'
3
+ import { ErrorResponse, ValidationDetails } from '../api/account'
3
4
  import { actionDetails } from './dictionary/action-details'
4
5
  import { baseDictionary } from './dictionary/base'
5
6
  import { cntFields } from './dictionary/cnt-fields'
@@ -7,7 +8,6 @@ import { workspaceDetails } from './dictionary/workspace-details'
7
8
  import { workspaceFields } from './dictionary/workspace-fields'
8
9
  import { ignoredTitleErrorCodes } from './IgnoredErrorCodes'
9
10
  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,11 +35,6 @@ 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
-
43
38
  const UNIT_REGEX_TEMPLATE = /{\d}/g
44
39
  const RANGE_REGEX_TEMPLATE = /{1-n}/g
45
40
 
@@ -66,39 +61,21 @@ function createMessage(status: number, raw: ErrorResponse, dictionary: Dictionar
66
61
  const dictDetails = (detailsDictionary[api?.toLowerCase() as keyof typeof detailsDictionary] ?? {})[language || 'en']
67
62
  const dictionaryDetails = raw.code && dictDetails ? dictDetails[raw.code] : {}
68
63
 
69
- if (raw?.validationDetails?.length) {
64
+ if (!raw.validationDetails?.length) return { description: title, ...dictionaryDetails }
70
65
 
71
- const suggestedMessages = raw.validationDetails.map((detail) =>
72
- getSuggestedMessages(detail?.suggestedMessages, language)).filter((msg) => !!msg)
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]
73
69
 
74
- if (suggestedMessages.length) {
75
- return { description: suggestedMessages.join('\n'), ...dictionaryDetails }
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)
76
73
  }
77
74
 
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 }
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 }
102
79
  }
103
80
 
104
81
  /**
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { CancelledError } from '@tanstack/react-query'
2
- export { apiAddresses, getApiAddresses, getBaseUrlWithOverride, setApisOverride } from './api-addresses'
2
+ export { apiAddresses } 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'
@@ -3,7 +3,6 @@ import { requestPermission } from '@stack-spot/opa'
3
3
  import { events } from 'fetch-event-stream'
4
4
  import { StackspotAPIError } from '../error/StackspotAPIError'
5
5
  import { Env, FetchEventStream, HTTPMethod, SessionManager } from './types'
6
- import { getBaseUrlWithOverride } from '../api-addresses'
7
6
 
8
7
  /**
9
8
  * A set of methods for performing network requests to an API.
@@ -55,15 +54,6 @@ export abstract class NetworkClient {
55
54
  private uninitializedError() {
56
55
  return new Error('Please, call "NetworkClient.setup(sessionManager, env)" before attempting to make a request.')
57
56
  }
58
-
59
- /**
60
- * Resolves the final base URL for the current environment.
61
- * If a local API override exists for the current environment and current resource (api name), it will be use instead.
62
- * @returns the final baseURL for the current environment, considering overrides if available.
63
- */
64
- protected getBaseURL(): string {
65
- return getBaseUrlWithOverride(this.baseURL, NetworkClient.env);
66
- }
67
57
 
68
58
  /**
69
59
  * Builds a URL with the `baseUrl` of this network client and the `path` passed as parameter.
@@ -75,7 +65,7 @@ export abstract class NetworkClient {
75
65
  // paths must not start with "/", otherwise, the base url will not be fully appended to it.
76
66
  const fixedPath = path.replace(/^\//, '')
77
67
  // the baseUrl must end with "/", otherwise, the last of its part will get replaced by the path, instead of concatenated with.
78
- const fixedBaseUrl = this.getBaseURL().replace(/([^/])$/, '$1/')
68
+ const fixedBaseUrl = this.baseURL[NetworkClient.env].replace(/([^/])$/, '$1/')
79
69
  return new URL(fixedPath, fixedBaseUrl)
80
70
  }
81
71
 
@@ -1,19 +0,0 @@
1
- export type LanguageSuggestedMessageKeys = 'ptBr' | 'enUs';
2
- export type SuggestedMessage = {
3
- [key in LanguageSuggestedMessageKeys]: string | null;
4
- };
5
- export type ValidationDetails = {
6
- code: string;
7
- field?: string;
8
- details?: string;
9
- values?: string[];
10
- suggestedMessages?: SuggestedMessage | null;
11
- };
12
- export type ErrorResponse = {
13
- code: string;
14
- status: number;
15
- details: string;
16
- validationDetails?: ValidationDetails[];
17
- suggestedMessages?: SuggestedMessage | null;
18
- };
19
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/error/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,4BAA4B,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG;KAC5B,GAAG,IAAI,4BAA4B,GAAG,MAAM,GAAG,IAAI;CACrD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACxC,iBAAiB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAC7C,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/error/types.ts"],"names":[],"mappings":""}
@@ -1,21 +0,0 @@
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
- };