@stack-spot/portal-network 0.176.1 → 0.177.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 +259 -0
- package/dist/api/agent-tools.d.ts +33 -6
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js +19 -6
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/ai.d.ts +3 -0
- package/dist/api/ai.d.ts.map +1 -1
- package/dist/api/ai.js.map +1 -1
- package/dist/api/codeShift.d.ts +105 -10
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +84 -0
- package/dist/api/codeShift.js.map +1 -1
- package/dist/api-addresses.d.ts +14 -5
- package/dist/api-addresses.d.ts.map +1 -1
- package/dist/api-addresses.js +27 -10
- package/dist/api-addresses.js.map +1 -1
- package/dist/apis-itau.json +225 -0
- package/dist/client/agent-tools.d.ts +3 -6
- package/dist/client/agent-tools.d.ts.map +1 -1
- package/dist/client/agent-tools.js +3 -3
- package/dist/client/agent-tools.js.map +1 -1
- package/dist/client/code-shift.d.ts +61 -4
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +46 -1
- package/dist/client/code-shift.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/network/NetworkClient.d.ts +4 -2
- package/dist/network/NetworkClient.d.ts.map +1 -1
- package/dist/network/NetworkClient.js +5 -3
- package/dist/network/NetworkClient.js.map +1 -1
- package/dist/network/types.d.ts +1 -0
- package/dist/network/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/readme.md +1 -1
- package/src/api/account.ts +1 -0
- package/src/api/agent-tools.ts +57 -11
- package/src/api/agent.ts +2 -0
- package/src/api/ai.ts +3 -0
- package/src/api/codeShift.ts +274 -10
- package/src/api/notification.ts +2 -0
- package/src/api-addresses.ts +30 -11
- package/src/apis-itau.json +225 -0
- package/src/client/agent-tools.ts +3 -3
- package/src/client/ai.ts +1 -0
- package/src/client/code-shift.ts +29 -0
- package/src/index.ts +3 -3
- package/src/network/NetworkClient.ts +7 -4
- package/src/network/types.ts +2 -0
|
@@ -52,7 +52,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
52
52
|
/**
|
|
53
53
|
* List agents
|
|
54
54
|
*/
|
|
55
|
-
agents = this.infiniteQuery(removeAuthorizationParam(listAgentsV1AgentsGet))
|
|
55
|
+
agents = this.infiniteQuery(removeAuthorizationParam(listAgentsV1AgentsGet), { pageParamName: 'request.page' })
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* List agents available to be added to other agents
|
|
@@ -81,7 +81,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
81
81
|
name: 'agentDefault',
|
|
82
82
|
request: async (signal) => {
|
|
83
83
|
const agentDefault = await listAgentsV1AgentsGet(
|
|
84
|
-
{ visibility: 'built_in', slug: this.agentDefaultSlug, authorization: '' }, { signal },
|
|
84
|
+
{ request: { visibility: 'built_in', slug: this.agentDefaultSlug }, authorization: '' }, { signal },
|
|
85
85
|
)
|
|
86
86
|
|
|
87
87
|
const agentId = agentDefault?.find((agent) => agent.slug === this.agentDefaultSlug)?.id
|
|
@@ -109,7 +109,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
109
109
|
|
|
110
110
|
const [workspaceAgents, ...agentsByVisibility] = await Promise.all([
|
|
111
111
|
workspaceAgentsPromise,
|
|
112
|
-
...visibilities.map((visibility) => listAgentsV1AgentsGet({ visibility, authorization: '' }, { signal })),
|
|
112
|
+
...visibilities.map((visibility) => listAgentsV1AgentsGet({ request: { visibility }, authorization: '' }, { signal })),
|
|
113
113
|
])
|
|
114
114
|
|
|
115
115
|
const workspaceAgentsWithSpaceName = workspaceAgents.flatMap(({ agents, space_name }) =>
|
package/src/client/ai.ts
CHANGED
package/src/client/code-shift.ts
CHANGED
|
@@ -58,6 +58,11 @@ import {
|
|
|
58
58
|
getModuleV1ModulesModuleIdGet,
|
|
59
59
|
analyticsProgramGroupsTargetDetailsV1AnalyticsProgramGroupsTargetDetailsGet,
|
|
60
60
|
analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet,
|
|
61
|
+
analyticsRepositoryTargetDetailsV1AnalyticsRepositoriesTargetDetailsGet,
|
|
62
|
+
analyticsRepositoryTargetDetailsDownloadV1AnalyticsRepositoriesTargetDetailsDownloadGet,
|
|
63
|
+
searchReposScmServiceV2ReposSearchScmPost,
|
|
64
|
+
importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost,
|
|
65
|
+
searchReposScmV2V2ReposSearchScmSearchIdGet,
|
|
61
66
|
} from '../api/codeShift'
|
|
62
67
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
63
68
|
import { codeShiftDictionary } from '../error/dictionary/code-shift'
|
|
@@ -159,6 +164,18 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
159
164
|
* Downloads file with found repositories
|
|
160
165
|
*/
|
|
161
166
|
downloadSearchRepository = this.mutation(removeAuthorizationParam(downloadSearchReposScmServiceV1ReposSearchScmSearchRepoIdDownloadGet))
|
|
167
|
+
/**
|
|
168
|
+
* Searches for repositories (v2)
|
|
169
|
+
*/
|
|
170
|
+
searchRepositoryV2 = this.mutation(removeAuthorizationParam(searchReposScmServiceV2ReposSearchScmPost))
|
|
171
|
+
/**
|
|
172
|
+
* Imports repositories (v2)
|
|
173
|
+
*/
|
|
174
|
+
importRepositories = this.mutation(removeAuthorizationParam(importReposWithTagsScmServiceV2ReposSearchScmSearchIdPost))
|
|
175
|
+
/**
|
|
176
|
+
* Gets repositories search by id (v2)
|
|
177
|
+
*/
|
|
178
|
+
getRepositoriesBySearchId = this.query(removeAuthorizationParam(searchReposScmV2V2ReposSearchScmSearchIdGet))
|
|
162
179
|
/**
|
|
163
180
|
* Validate if the user has permission.
|
|
164
181
|
* We do not use opa in this api, so this is the fn needed to check permissions.
|
|
@@ -330,6 +347,18 @@ class CodeShift extends ReactQueryNetworkClient {
|
|
|
330
347
|
analyticsProgramGroupsTargetDetailsDownload = this.query(
|
|
331
348
|
removeAuthorizationParam(analyticsProgramGroupsTargetDetailsDownloadV1AnalyticsProgramGroupsTargetDetailsDownloadGet),
|
|
332
349
|
)
|
|
350
|
+
/**
|
|
351
|
+
* Analytics Repository Target Details
|
|
352
|
+
*/
|
|
353
|
+
analyticsRepositoryTargetDetails = this.query(
|
|
354
|
+
removeAuthorizationParam(analyticsRepositoryTargetDetailsV1AnalyticsRepositoriesTargetDetailsGet),
|
|
355
|
+
)
|
|
356
|
+
/**
|
|
357
|
+
* Analytics Repository Target Details Download
|
|
358
|
+
*/
|
|
359
|
+
analyticsRepositoryTargetDetailsDownload = this.query(
|
|
360
|
+
removeAuthorizationParam(analyticsRepositoryTargetDetailsDownloadV1AnalyticsRepositoriesTargetDetailsDownloadGet),
|
|
361
|
+
)
|
|
333
362
|
}
|
|
334
363
|
|
|
335
364
|
export const codeShiftClient = new CodeShift()
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { CancelledError } from '@tanstack/react-query'
|
|
2
|
-
export { apiAddresses, getApiAddresses,
|
|
2
|
+
export { apiAddresses, getApiAddresses, getApisByTenant, getBaseUrlByTenantWithOverride, setApisOverride } from './api-addresses'
|
|
3
3
|
export { accountClient } from './client/account'
|
|
4
|
-
export * from './client/discover'
|
|
5
4
|
export { agentClient } from './client/agent'
|
|
6
5
|
export { agentToolsClient } from './client/agent-tools'
|
|
7
6
|
export { aiClient } from './client/ai'
|
|
@@ -14,6 +13,7 @@ export { cloudServicesClient } from './client/cloud-services'
|
|
|
14
13
|
export { codeShiftClient } from './client/code-shift'
|
|
15
14
|
export { contentClient } from './client/content'
|
|
16
15
|
export { dataIntegrationClient } from './client/data-integration'
|
|
16
|
+
export * from './client/discover'
|
|
17
17
|
export { discoverClient } from './client/discover'
|
|
18
18
|
export { eventBusClient } from './client/event-bus'
|
|
19
19
|
export { genAiInferenceClient } from './client/gen-ai-inference'
|
|
@@ -35,7 +35,7 @@ export { StreamError } from './error/StreamError'
|
|
|
35
35
|
export { StreamJsonError } from './error/StreamJsonError'
|
|
36
36
|
export { NetworkClient } from './network/NetworkClient'
|
|
37
37
|
export { queryClient } from './network/react-query-client'
|
|
38
|
-
export { OperationResult, OperationVariables, UseQueryObjectOptions } from './network/types'
|
|
38
|
+
export { Env, OperationResult, OperationVariables, Tenant, UseQueryObjectOptions } from './network/types'
|
|
39
39
|
export { StreamingStatus } from './types'
|
|
40
40
|
export { StreamedArray } from './utils/StreamedArray'
|
|
41
41
|
export { StreamedJson } from './utils/StreamedJson'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AuthenticationError, SessionExpiredError } from '@stack-spot/auth'
|
|
2
2
|
import { requestPermission } from '@stack-spot/opa'
|
|
3
3
|
import { events } from 'fetch-event-stream'
|
|
4
|
+
import { getBaseUrlByTenantWithOverride } from '../api-addresses'
|
|
4
5
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
5
|
-
import { Env, FetchEventStream, HTTPMethod, SessionManager } from './types'
|
|
6
|
-
import { getBaseUrlWithOverride } from '../api-addresses'
|
|
6
|
+
import { Env, FetchEventStream, HTTPMethod, SessionManager, Tenant } from './types'
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A set of methods for performing network requests to an API.
|
|
@@ -21,6 +21,7 @@ export abstract class NetworkClient {
|
|
|
21
21
|
private baseURL: Record<Env, string>
|
|
22
22
|
static readonly sessionManager?: SessionManager
|
|
23
23
|
private static env?: Env
|
|
24
|
+
private static tenant?: Tenant
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* @param baseURL An object with the keys "dev", "stg" and "prd". The values must be the url for each of these environments.
|
|
@@ -33,11 +34,13 @@ export abstract class NetworkClient {
|
|
|
33
34
|
* Sets up all network clients. Must be called before attempting to make any request.
|
|
34
35
|
* @param sessionManager An object with functions capable of checking, retrieving and ending the current session.
|
|
35
36
|
* @param env The environment to send the requests to.
|
|
37
|
+
* @param tenant - {@link Tenant} tenant identifier used to scope requests.
|
|
36
38
|
*/
|
|
37
|
-
static setup(sessionManager: SessionManager, env: Env) {
|
|
39
|
+
static setup(sessionManager: SessionManager, env: Env, tenant?: Tenant) {
|
|
38
40
|
//@ts-ignore This is the only place we would link session manager to be set.
|
|
39
41
|
NetworkClient.sessionManager = sessionManager
|
|
40
42
|
NetworkClient.env = env
|
|
43
|
+
NetworkClient.tenant = tenant
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
/**
|
|
@@ -62,7 +65,7 @@ export abstract class NetworkClient {
|
|
|
62
65
|
* @returns the final baseURL for the current environment, considering overrides if available.
|
|
63
66
|
*/
|
|
64
67
|
protected getBaseURL(): string {
|
|
65
|
-
return
|
|
68
|
+
return getBaseUrlByTenantWithOverride(this.baseURL, NetworkClient.env, NetworkClient.tenant);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
/**
|
package/src/network/types.ts
CHANGED