@stack-spot/portal-network 0.176.0 → 0.176.1-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 +225 -0
- 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 +95 -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/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/client/workspace-manager.d.ts +9 -0
- package/dist/client/workspace-manager.d.ts.map +1 -1
- package/dist/client/workspace-manager.js +11 -2
- package/dist/client/workspace-manager.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 +2 -2
- package/readme.md +1 -1
- package/src/api/account.ts +1 -0
- package/src/api/agent-tools.ts +3 -0
- package/src/api/agent.ts +2 -0
- package/src/api/ai.ts +3 -0
- package/src/api/codeShift.ts +264 -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/ai.ts +1 -0
- package/src/client/code-shift.ts +29 -0
- package/src/client/workspace-manager.ts +8 -1
- package/src/index.ts +4 -3
- package/src/network/NetworkClient.ts +7 -4
- package/src/network/types.ts +2 -0
package/src/api-addresses.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import apisItauJson from './apis-itau.json' assert { type: 'json' }
|
|
1
2
|
import apisJson from './apis.json' assert { type: 'json' }
|
|
2
3
|
import { NetworkClient } from './network/NetworkClient'
|
|
3
|
-
import { Env } from './network/types'
|
|
4
|
+
import { Env, Tenant } from './network/types'
|
|
4
5
|
|
|
5
6
|
type ApisKeys = keyof typeof apisJson;
|
|
6
7
|
|
|
@@ -25,6 +26,21 @@ type ApiAddress = {
|
|
|
25
26
|
let defaultApis: Apis = apisJson;
|
|
26
27
|
let overrideApis: PartialApis = {};
|
|
27
28
|
|
|
29
|
+
const apis: Record<Tenant, Apis> = {
|
|
30
|
+
'stackspot': apisJson,
|
|
31
|
+
'itau': apisItauJson,
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Returns the API catalog for the given tenant.
|
|
36
|
+
*
|
|
37
|
+
* @param tenant The current tenant (e.g., 'stackspot', 'itau').
|
|
38
|
+
* @returns Typed catalog containing the URLs per environment.
|
|
39
|
+
*/
|
|
40
|
+
export function getApisByTenant(tenant: Tenant) {
|
|
41
|
+
return apis[tenant]
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
function transformApisToApiAddress(apis: Apis, env: Env): ApiAddress {
|
|
29
45
|
const apiAddress: ApiAddress = {}
|
|
30
46
|
|
|
@@ -54,12 +70,14 @@ function matchesBaseUrl(baseUrl: Record<Env, string>, candidate: Record<Env, str
|
|
|
54
70
|
}
|
|
55
71
|
|
|
56
72
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
73
|
+
* Returns the base URL for the given environment and tenant, applying any overrides if available
|
|
74
|
+
*
|
|
75
|
+
* @param baseURL the default API base URL.
|
|
59
76
|
* @param targetEnv the target environment
|
|
60
|
-
* @
|
|
77
|
+
* @param tenant the current tenant.
|
|
78
|
+
* @returns {string} the base URL for the given environment and tenant, applying any overrides if available.
|
|
61
79
|
*/
|
|
62
|
-
export const
|
|
80
|
+
export const getBaseUrlByTenantWithOverride = (baseUrl: Record<Env, string>, targetEnv: Env = 'prd', tenant: Tenant = 'stackspot'): string => {
|
|
63
81
|
let matchesApiName: ApisKeys | null = null;
|
|
64
82
|
|
|
65
83
|
for (const [apiName, config] of Object.entries(defaultApis) as [ApisKeys, ApiConfig][]) {
|
|
@@ -69,14 +87,15 @@ export const getBaseUrlWithOverride = (baseUrl: Record<Env, string>, targetEnv:
|
|
|
69
87
|
}
|
|
70
88
|
}
|
|
71
89
|
|
|
72
|
-
if (matchesApiName)
|
|
73
|
-
const overrideUrl = overrideApis[matchesApiName]?.url?.[targetEnv];
|
|
90
|
+
if (!matchesApiName) return ''
|
|
74
91
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
92
|
+
const overrideUrl = overrideApis[matchesApiName]?.url?.[targetEnv]
|
|
93
|
+
if (overrideUrl) {
|
|
94
|
+
return overrideUrl;
|
|
78
95
|
}
|
|
79
|
-
|
|
96
|
+
|
|
97
|
+
const apis = getApisByTenant(tenant)
|
|
98
|
+
return apis[matchesApiName]?.url?.[targetEnv];
|
|
80
99
|
}
|
|
81
100
|
|
|
82
101
|
/**
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ai": {
|
|
3
|
+
"url": {
|
|
4
|
+
"stg": "https://genai-code-buddy-api.stackspot.hom.aws.cloud.ihf",
|
|
5
|
+
"dev": "https://genai-code-buddy-api.stackspot.dev.aws.cloud.ihf",
|
|
6
|
+
"prd": "https://genai-code-buddy-api.stackspot.prod.aws.cloud.ihf"
|
|
7
|
+
},
|
|
8
|
+
"docs": "/openapi.json"
|
|
9
|
+
},
|
|
10
|
+
"workspace-ai": {
|
|
11
|
+
"url": {
|
|
12
|
+
"stg": "https://genai-workspace-ai-api.stackspot.hom.aws.cloud.ihf",
|
|
13
|
+
"dev": "https://genai-workspace-ai-api.stackspot.dev.aws.cloud.ihf",
|
|
14
|
+
"prd": "https://genai-workspace-ai-api.stackspot.prod.aws.cloud.ihf"
|
|
15
|
+
},
|
|
16
|
+
"docs": "/openapi.json"
|
|
17
|
+
},
|
|
18
|
+
"agent": {
|
|
19
|
+
"url": {
|
|
20
|
+
"stg": "",
|
|
21
|
+
"dev": "",
|
|
22
|
+
"prd": ""
|
|
23
|
+
},
|
|
24
|
+
"docs": "/q/openapi"
|
|
25
|
+
},
|
|
26
|
+
"agent-tools": {
|
|
27
|
+
"url": {
|
|
28
|
+
"stg": "https://genai-agent-tools-api.stackspot.hom.aws.cloud.ihf",
|
|
29
|
+
"dev": "https://genai-agent-tools-api.stackspot.dev.aws.cloud.ihf",
|
|
30
|
+
"prd": "https://genai-agent-tools-api.stackspot.prod.aws.cloud.ihf"
|
|
31
|
+
},
|
|
32
|
+
"docs": "/openapi.json"
|
|
33
|
+
},
|
|
34
|
+
"dataIntegration": {
|
|
35
|
+
"url": {
|
|
36
|
+
"stg": "https://genai-data-integration.stackspot.hom.aws.cloud.ihf",
|
|
37
|
+
"dev": "https://genai-data-integration.stackspot.dev.aws.cloud.ihf",
|
|
38
|
+
"prd": "https://genai-data-integration.stackspot.prod.aws.cloud.ihf"
|
|
39
|
+
},
|
|
40
|
+
"docs": "/openapi.json"
|
|
41
|
+
},
|
|
42
|
+
"workspace": {
|
|
43
|
+
"url": {
|
|
44
|
+
"stg": "",
|
|
45
|
+
"dev": "",
|
|
46
|
+
"prd": ""
|
|
47
|
+
},
|
|
48
|
+
"docs": "/v3/api-docs"
|
|
49
|
+
},
|
|
50
|
+
"account": {
|
|
51
|
+
"url": {
|
|
52
|
+
"stg": "https://account-account-api.stackspot.hom.aws.cloud.ihf",
|
|
53
|
+
"dev": "https://account-account-api.stackspot.dev.aws.cloud.ihf",
|
|
54
|
+
"prd": "https://account-account-api.stackspot.prod.aws.cloud.ihf"
|
|
55
|
+
},
|
|
56
|
+
"docs": "/v3/api-docs"
|
|
57
|
+
},
|
|
58
|
+
"content": {
|
|
59
|
+
"url": {
|
|
60
|
+
"stg": "",
|
|
61
|
+
"dev": "",
|
|
62
|
+
"prd": ""
|
|
63
|
+
},
|
|
64
|
+
"docs": "/v3/api-docs"
|
|
65
|
+
},
|
|
66
|
+
"eventBus": {
|
|
67
|
+
"url": {
|
|
68
|
+
"stg": "https://idp-event-bus-api.stackspot.hom.aws.cloud.ihf",
|
|
69
|
+
"dev": "https://idp-event-bus-api.stackspot.dev.aws.cloud.ihf",
|
|
70
|
+
"prd": "https://idp-event-bus-api.stackspot.prod.aws.cloud.ihf"
|
|
71
|
+
},
|
|
72
|
+
"docs": "/v3/api-docs"
|
|
73
|
+
},
|
|
74
|
+
"serviceCatalog": {
|
|
75
|
+
"url": {
|
|
76
|
+
"stg": "",
|
|
77
|
+
"dev": "",
|
|
78
|
+
"prd": ""
|
|
79
|
+
},
|
|
80
|
+
"docs": "/v3/api-docs"
|
|
81
|
+
},
|
|
82
|
+
"apiRuntime": {
|
|
83
|
+
"url": {
|
|
84
|
+
"stg": "",
|
|
85
|
+
"dev": "",
|
|
86
|
+
"prd": ""
|
|
87
|
+
},
|
|
88
|
+
"docs": "/v3/api-docs"
|
|
89
|
+
},
|
|
90
|
+
"cloudServices": {
|
|
91
|
+
"url": {
|
|
92
|
+
"stg": "",
|
|
93
|
+
"dev": "",
|
|
94
|
+
"prd": ""
|
|
95
|
+
},
|
|
96
|
+
"docs": "/v3/api-docs"
|
|
97
|
+
},
|
|
98
|
+
"cloudAccount": {
|
|
99
|
+
"url": {
|
|
100
|
+
"stg": "",
|
|
101
|
+
"dev": "",
|
|
102
|
+
"prd": ""
|
|
103
|
+
},
|
|
104
|
+
"docs": "/v3/api-docs"
|
|
105
|
+
},
|
|
106
|
+
"dataPlatform": {
|
|
107
|
+
"url": {
|
|
108
|
+
"stg": "",
|
|
109
|
+
"dev": "",
|
|
110
|
+
"prd": ""
|
|
111
|
+
},
|
|
112
|
+
"docs": "/v3/api-docs"
|
|
113
|
+
},
|
|
114
|
+
"insights": {
|
|
115
|
+
"url": {
|
|
116
|
+
"stg": "",
|
|
117
|
+
"dev": "",
|
|
118
|
+
"prd": ""
|
|
119
|
+
},
|
|
120
|
+
"docs": "/v3/api-docs"
|
|
121
|
+
},
|
|
122
|
+
"workflows": {
|
|
123
|
+
"url": {
|
|
124
|
+
"stg": "",
|
|
125
|
+
"dev": "",
|
|
126
|
+
"prd": ""
|
|
127
|
+
},
|
|
128
|
+
"docs": "/openapi.json"
|
|
129
|
+
},
|
|
130
|
+
"workspaceManager": {
|
|
131
|
+
"url": {
|
|
132
|
+
"stg": "",
|
|
133
|
+
"dev": "",
|
|
134
|
+
"prd": ""
|
|
135
|
+
},
|
|
136
|
+
"docs": "/v3/api-docs"
|
|
137
|
+
},
|
|
138
|
+
"workspaceSearchEngine": {
|
|
139
|
+
"url": {
|
|
140
|
+
"stg": "",
|
|
141
|
+
"dev": "",
|
|
142
|
+
"prd": ""
|
|
143
|
+
},
|
|
144
|
+
"docs": "/v3/api-docs"
|
|
145
|
+
},
|
|
146
|
+
"permissionValidation": {
|
|
147
|
+
"url": {
|
|
148
|
+
"stg": "https://portal-opa-server.stackspot.dev.aws.cloud.ihf/v1/validate",
|
|
149
|
+
"dev": "https://portal-opa-server.stackspot.hom.aws.cloud.ihf/v1/validate",
|
|
150
|
+
"prd": "https://portal-opa-server.stackspot.prod.aws.cloud.ihf/v1/validate"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"apiManagement": {
|
|
154
|
+
"url": {
|
|
155
|
+
"stg": "",
|
|
156
|
+
"dev": "",
|
|
157
|
+
"prd": ""
|
|
158
|
+
},
|
|
159
|
+
"docs": "/v3/api-docs"
|
|
160
|
+
},
|
|
161
|
+
"secrets": {
|
|
162
|
+
"url": {
|
|
163
|
+
"stg": "",
|
|
164
|
+
"dev": "",
|
|
165
|
+
"prd": ""
|
|
166
|
+
},
|
|
167
|
+
"docs": "/v3/api-docs"
|
|
168
|
+
},
|
|
169
|
+
"notification": {
|
|
170
|
+
"url": {
|
|
171
|
+
"stg": "https://account-notification-engine.stackspot.hom.aws.cloud.ihf",
|
|
172
|
+
"dev": "https://account-notification-engine.stackspot.dev.aws.cloud.ihf",
|
|
173
|
+
"prd": "https://account-notification-engine.stackspot.prod.aws.cloud.ihf"
|
|
174
|
+
},
|
|
175
|
+
"docs": "/v3/api-docs"
|
|
176
|
+
},
|
|
177
|
+
"cloudPlatform": {
|
|
178
|
+
"url": {
|
|
179
|
+
"stg": "",
|
|
180
|
+
"dev": "",
|
|
181
|
+
"prd": ""
|
|
182
|
+
},
|
|
183
|
+
"docs": "/v3/api-docs"
|
|
184
|
+
},
|
|
185
|
+
"cloudRuntimes": {
|
|
186
|
+
"url": {
|
|
187
|
+
"stg": "",
|
|
188
|
+
"dev": "",
|
|
189
|
+
"prd": ""
|
|
190
|
+
},
|
|
191
|
+
"docs": "/v3/api-docs"
|
|
192
|
+
},
|
|
193
|
+
"cloudPlatformHorizon": {
|
|
194
|
+
"url": {
|
|
195
|
+
"stg": "",
|
|
196
|
+
"dev": "",
|
|
197
|
+
"prd": ""
|
|
198
|
+
},
|
|
199
|
+
"docs": "/v3/api-docs"
|
|
200
|
+
},
|
|
201
|
+
"codeShift": {
|
|
202
|
+
"url": {
|
|
203
|
+
"stg": "",
|
|
204
|
+
"dev": "",
|
|
205
|
+
"prd": ""
|
|
206
|
+
},
|
|
207
|
+
"docs": "/openapi.json"
|
|
208
|
+
},
|
|
209
|
+
"genAiInference": {
|
|
210
|
+
"url": {
|
|
211
|
+
"stg": "https://genai-inference-app.stackspot.hom.aws.cloud.ihf",
|
|
212
|
+
"dev": "https://genai-inference-app.stackspot.dev.aws.cloud.ihf",
|
|
213
|
+
"prd": "https://genai-inference-app.stackpot.prod.aws.cloud.ihf"
|
|
214
|
+
},
|
|
215
|
+
"docs": "/openapi.json"
|
|
216
|
+
},
|
|
217
|
+
"discover": {
|
|
218
|
+
"url": {
|
|
219
|
+
"stg": "",
|
|
220
|
+
"dev": "",
|
|
221
|
+
"prd": ""
|
|
222
|
+
},
|
|
223
|
+
"docs": "/v3/api-docs"
|
|
224
|
+
}
|
|
225
|
+
}
|
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()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
import { HttpError } from '@oazapfts/runtime'
|
|
3
|
+
import { getApiAddresses } from '../api-addresses'
|
|
3
4
|
import {
|
|
4
5
|
accountApplicationControllergetAccountApplicationPage,
|
|
5
6
|
accountApplicationControllergetAccountApplicationsFilters,
|
|
@@ -38,6 +39,7 @@ import {
|
|
|
38
39
|
contextControllerupsertWorkspaceActionsInputContext,
|
|
39
40
|
contextWorkflowControllergetAccountWorkflowInputs,
|
|
40
41
|
contextWorkflowControllergetConsolidatedWorkflowInputs,
|
|
42
|
+
contextWorkflowControllergetWorkspaceWorkflowInputs,
|
|
41
43
|
contextgetAccountPluginInputs,
|
|
42
44
|
contextgetConsolidatedPluginInputs,
|
|
43
45
|
contextgetConsolidatedPluginInputsWithConnectionInterfaces,
|
|
@@ -79,7 +81,6 @@ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
|
79
81
|
import { contentClient } from './content'
|
|
80
82
|
import { FixedFullInputContextResponse, FixedPaginatedActivityResponse, FixedPluginForAppCreationV2Response, FixedWorkflowForCreationResponse, ReplaceResult } from './types'
|
|
81
83
|
import { workspaceClient } from './workspace'
|
|
82
|
-
import { getApiAddresses } from '../api-addresses'
|
|
83
84
|
|
|
84
85
|
class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
85
86
|
constructor() {
|
|
@@ -153,6 +154,12 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
|
153
154
|
*/
|
|
154
155
|
workflowDataWithInputsInWorkspace = this.query(contextWorkflowControllergetConsolidatedWorkflowInputs as
|
|
155
156
|
unknown as ReplaceResult<typeof contextWorkflowControllergetConsolidatedWorkflowInputs, FixedWorkflowForCreationResponse>)
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Gets workflow inputs in a workspace stack
|
|
160
|
+
*/
|
|
161
|
+
workflowInputsInWorkspace = this.query(contextWorkflowControllergetWorkspaceWorkflowInputs as unknown as ReplaceResult<typeof contextWorkflowControllergetWorkspaceWorkflowInputs, FixedWorkflowForCreationResponse>)
|
|
162
|
+
|
|
156
163
|
/**
|
|
157
164
|
* Gets workflow inputs in an account stack
|
|
158
165
|
*/
|
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,9 +35,10 @@ 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'
|
|
42
42
|
export { useExtendedList } from './utils/use-extended-list'
|
|
43
43
|
export { useStreamedArray } from './utils/use-streamed-array'
|
|
44
|
+
|
|
@@ -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