@stack-spot/portal-network 0.184.0 → 0.185.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 +2444 -2412
- package/dist/api/account.js +1 -1
- package/dist/api/agent-tools.js +1 -1
- package/dist/api/agent.js +1 -1
- package/dist/api/ai.js +1 -1
- package/dist/api/apiManagement.js +1 -1
- package/dist/api/apiRuntime.js +1 -1
- package/dist/api/cloudAccount.js +1 -1
- package/dist/api/cloudPlatform.js +1 -1
- package/dist/api/cloudPlatformHorizon.js +1 -1
- package/dist/api/cloudRuntimes.js +1 -1
- package/dist/api/cloudServices.js +1 -1
- package/dist/api/codeShift.d.ts +63 -4
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +14 -1
- package/dist/api/codeShift.js.map +1 -1
- package/dist/api/content.js +1 -1
- package/dist/api/dataIntegration.js +1 -1
- package/dist/api/discover.js +1 -1
- package/dist/api/genAiInference.js +1 -1
- package/dist/api/insights.js +1 -1
- package/dist/api/notification.js +1 -1
- package/dist/api/secrets.js +1 -1
- package/dist/api/serviceCatalog.js +1 -1
- package/dist/api/workspace-ai.js +1 -1
- package/dist/api/workspace.js +1 -1
- package/dist/api/workspaceManager.js +1 -1
- package/dist/api/workspaceSearchEngine.js +1 -1
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +84 -14
- package/dist/client/ai.js.map +1 -1
- package/dist/client/code-shift.d.ts +30 -0
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +37 -1
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/types.d.ts +26 -6
- package/dist/client/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/readme.md +1 -1
- package/scripts/generate-apis.ts +134 -134
- package/src/api/account.ts +8368 -8367
- package/src/api/agent-tools.ts +2172 -2169
- package/src/api/agent.ts +1085 -1083
- package/src/api/ai.ts +3388 -3388
- package/src/api/apiManagement.ts +570 -570
- package/src/api/apiRuntime.ts +2103 -2103
- package/src/api/cloudAccount.ts +1239 -1239
- package/src/api/cloudPlatform.ts +927 -927
- package/src/api/cloudPlatformHorizon.ts +2655 -2655
- package/src/api/cloudRuntimes.ts +2043 -2043
- package/src/api/cloudServices.ts +1445 -1445
- package/src/api/codeShift.ts +3567 -3481
- package/src/api/content.ts +9785 -9785
- package/src/api/dataIntegration.ts +1657 -1657
- package/src/api/discover.ts +435 -435
- package/src/api/eventBus.ts +171 -171
- package/src/api/genAiInference.ts +603 -603
- package/src/api/insights.ts +310 -310
- package/src/api/notification.ts +336 -334
- package/src/api/secrets.ts +342 -342
- package/src/api/serviceCatalog.ts +2908 -2908
- package/src/api/workflows.ts +1669 -1669
- package/src/api/workspace-ai.ts +677 -677
- package/src/api/workspace.ts +5889 -5889
- package/src/api/workspaceManager.ts +2951 -2951
- package/src/api/workspaceSearchEngine.ts +153 -153
- package/src/api-addresses.ts +120 -120
- package/src/apis-itau.json +225 -225
- package/src/apis.json +225 -225
- package/src/client/account.ts +902 -902
- package/src/client/agent-tools.ts +210 -210
- package/src/client/agent.ts +81 -81
- package/src/client/ai.ts +469 -395
- package/src/client/api-management.ts +40 -40
- package/src/client/cloud-account.ts +70 -70
- package/src/client/cloud-platform-horizon.ts +113 -113
- package/src/client/cloud-platform.ts +163 -163
- package/src/client/cloud-runtimes.ts +129 -129
- package/src/client/cloud-services.ts +94 -94
- package/src/client/code-shift.ts +371 -349
- package/src/client/content.ts +538 -538
- package/src/client/data-integration.ts +191 -191
- package/src/client/discover.ts +89 -89
- package/src/client/event-bus.ts +84 -84
- package/src/client/gen-ai-inference.ts +65 -65
- package/src/client/insights.ts +28 -28
- package/src/client/notification.ts +32 -32
- package/src/client/runtime-manager.ts +76 -76
- package/src/client/secrets.ts +60 -60
- package/src/client/types.ts +398 -377
- package/src/client/workflow.ts +83 -83
- package/src/client/workspace-ai.ts +191 -191
- package/src/client/workspace-manager.ts +564 -564
- package/src/client/workspace-search.ts +39 -39
- package/src/client/workspace.ts +480 -480
- package/src/error/DefaultAPIError.ts +151 -151
- package/src/error/FileUploadError.ts +18 -18
- package/src/error/IgnoredErrorCodes.ts +3 -3
- package/src/error/StackspotAPIError.ts +101 -101
- package/src/error/StreamCanceledError.ts +10 -10
- package/src/error/StreamError.ts +7 -7
- package/src/error/StreamJsonError.ts +10 -10
- package/src/error/dictionary/account.ts +58 -58
- package/src/error/dictionary/action-details.ts +20 -20
- package/src/error/dictionary/action.ts +211 -211
- package/src/error/dictionary/agent-tools.ts +75 -75
- package/src/error/dictionary/ai-inference.ts +28 -28
- package/src/error/dictionary/base.ts +22 -22
- package/src/error/dictionary/cloud-platform.ts +82 -82
- package/src/error/dictionary/cnt-fields.ts +14 -14
- package/src/error/dictionary/cnt.ts +103 -103
- package/src/error/dictionary/code-shift.ts +12 -12
- package/src/error/dictionary/rte.ts +24 -24
- package/src/error/dictionary/rtm.ts +10 -10
- package/src/error/dictionary/secrets.ts +14 -14
- package/src/error/dictionary/workspace-ai.ts +10 -10
- package/src/error/dictionary/workspace-details.ts +15 -15
- package/src/error/dictionary/workspace-fields.ts +10 -10
- package/src/error/dictionary/workspace.ts +209 -209
- package/src/error/types.ts +21 -21
- package/src/index.ts +43 -43
- package/src/network/AutoInfiniteQuery.ts +115 -115
- package/src/network/AutoMutation.ts +27 -27
- package/src/network/AutoOperation.ts +73 -73
- package/src/network/AutoQuery.ts +75 -75
- package/src/network/ManualInfiniteQuery.ts +95 -95
- package/src/network/ManualMutation.ts +40 -40
- package/src/network/ManualOperation.ts +52 -52
- package/src/network/ManualQuery.ts +82 -82
- package/src/network/NetworkClient.ts +167 -167
- package/src/network/ReactQueryNetworkClient.ts +312 -312
- package/src/network/react-query-client.ts +14 -14
- package/src/network/types.ts +294 -294
- package/src/types.ts +1 -1
- package/src/utils/StreamedArray.tsx +146 -146
- package/src/utils/StreamedJson.tsx +166 -166
- package/src/utils/remove-authorization-param.ts +6 -6
- package/src/utils/string.ts +19 -19
- package/src/utils/use-extended-list.ts +80 -80
- package/src/utils/use-streamed-array.ts +17 -17
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +10 -10
|
@@ -1,564 +1,564 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
import { HttpError } from '@oazapfts/runtime'
|
|
3
|
-
import { getApiAddresses } from '../api-addresses'
|
|
4
|
-
import {
|
|
5
|
-
accountApplicationControllergetAccountApplicationPage,
|
|
6
|
-
accountApplicationControllergetAccountApplicationsFilters,
|
|
7
|
-
accountSharedInfraControllergetAccountSharedInfraFilters,
|
|
8
|
-
accountSharedInfraControllergetAccountSharedInfraPage,
|
|
9
|
-
accountStackControllerlistVersionsWithContext,
|
|
10
|
-
accountVariableControllercreate,
|
|
11
|
-
accountVariableControllerdelete,
|
|
12
|
-
accountVariableControllerfindAll,
|
|
13
|
-
accountVariableControllerfindByName,
|
|
14
|
-
accountVariableControllerupdate,
|
|
15
|
-
accountVariableControllerusage,
|
|
16
|
-
applicationControllerV2GetApplicationActivities,
|
|
17
|
-
applicationControllerV2GetApplicationAppliedPlugins,
|
|
18
|
-
applicationControllergetApplicationDependencies,
|
|
19
|
-
applicationControllergetApplicationDetails,
|
|
20
|
-
applicationControllergetApplicationFilters,
|
|
21
|
-
applicationControllergetApplicationLinks,
|
|
22
|
-
applicationControllergetApplications,
|
|
23
|
-
applicationControllerregistryAppDestroy,
|
|
24
|
-
contentWorkflowControllercreateApplicationThroughWorkflow,
|
|
25
|
-
contentWorkflowControllercreateSharedInfraThroughWorkflow,
|
|
26
|
-
contextActionControllergetStackActionInputsInAccountContext,
|
|
27
|
-
contextActionControllergetStackActionInputsInWorkspaceContext,
|
|
28
|
-
contextControllerclearActionContextInAccount,
|
|
29
|
-
contextControllerclearActionContextInWorkspace,
|
|
30
|
-
contextControllerclearPluginContextInAccount,
|
|
31
|
-
contextControllerclearPluginContextInWorkspace,
|
|
32
|
-
contextControllerimportContextInAccount,
|
|
33
|
-
contextControllerimportContextInWorkspace,
|
|
34
|
-
contextControllerupsertAccountActionsInputContext,
|
|
35
|
-
contextControllerupsertPluginAccountContext,
|
|
36
|
-
contextControllerupsertPluginWorkspaceContext,
|
|
37
|
-
contextControllerupsertWorkflowAccountContext,
|
|
38
|
-
contextControllerupsertWorkflowWorkspaceContext,
|
|
39
|
-
contextControllerupsertWorkspaceActionsInputContext,
|
|
40
|
-
contextWorkflowControllergetAccountWorkflowInputs,
|
|
41
|
-
contextWorkflowControllergetConsolidatedWorkflowInputs,
|
|
42
|
-
contextWorkflowControllergetWorkspaceWorkflowInputs,
|
|
43
|
-
contextgetAccountPluginInputs,
|
|
44
|
-
contextgetConsolidatedPluginInputs,
|
|
45
|
-
contextgetConsolidatedPluginInputsWithConnectionInterfaces,
|
|
46
|
-
defaults,
|
|
47
|
-
environmentControllergetEnvironments,
|
|
48
|
-
managerRunControllerdeleteApplication,
|
|
49
|
-
managerRunControllerdeleteSharedInfra,
|
|
50
|
-
sharedInfraControllerV2GetSharedInfraActivities,
|
|
51
|
-
sharedInfraControllerV2GetSharedInfraAppliedPlugins,
|
|
52
|
-
sharedInfraControllergetApplicationLinks,
|
|
53
|
-
sharedInfraControllergetSharedInfra,
|
|
54
|
-
sharedInfraControllergetSharedInfraAppliedPlugins,
|
|
55
|
-
sharedInfraControllergetSharedInfraDependencies,
|
|
56
|
-
sharedInfraControllergetSharedInfraFilters,
|
|
57
|
-
updateInfrastructureControllergetApplicationBranches,
|
|
58
|
-
updateInfrastructureControllergetApplicationInfraPlugins,
|
|
59
|
-
updateInfrastructureControllergetSharedInfraBranches,
|
|
60
|
-
updateInfrastructureControllergetSharedInfraInfraPlugins,
|
|
61
|
-
updateInfrastructureControllerremoveInfraPluginsAndCreatePullRequestByApplication,
|
|
62
|
-
updateInfrastructureControllerremoveInfraPluginsAndCreatePullRequestBySharedInfra,
|
|
63
|
-
updateInfrastructureControllerupdateInfraPluginsAndCreatePullRequestByApplication,
|
|
64
|
-
updateInfrastructureControllerupdateInfraPluginsAndCreatePullRequestBySharedInfra,
|
|
65
|
-
workflowWorkspaceControllerlistWorkflowByStackIdAndWorkflowType,
|
|
66
|
-
workspaceControllerdelete,
|
|
67
|
-
workspaceControllergetWorkspaces,
|
|
68
|
-
workspaceControllergetWorkspacesSummary,
|
|
69
|
-
workspaceStackControlleraddStacksInWorkspace,
|
|
70
|
-
workspaceStackControllerdeleteStacksInWorkspace,
|
|
71
|
-
workspaceStackControllerlistStacks,
|
|
72
|
-
workspaceStackControllerlistStacksContext,
|
|
73
|
-
workspaceStackControllerrefreshStacksInWorkspace,
|
|
74
|
-
workspaceVariableControllerfindAll,
|
|
75
|
-
workspaceVariableControllerfindByName,
|
|
76
|
-
workspaceVariableControllerupsert,
|
|
77
|
-
} from '../api/workspaceManager'
|
|
78
|
-
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
79
|
-
import { workspaceDictionary } from '../error/dictionary/workspace'
|
|
80
|
-
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
81
|
-
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
82
|
-
import { contentClient } from './content'
|
|
83
|
-
import { FixedFullInputContextResponse, FixedPaginatedActivityResponse, FixedPluginForAppCreationV2Response, FixedWorkflowForCreationResponse, ReplaceResult } from './types'
|
|
84
|
-
import { workspaceClient } from './workspace'
|
|
85
|
-
|
|
86
|
-
class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
87
|
-
constructor() {
|
|
88
|
-
super(getApiAddresses().workspaceManager.url, defaults)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
92
|
-
return new DefaultAPIError(error.data, error.status, workspaceDictionary, error.headers)
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Gets all stacks in a workspace
|
|
97
|
-
*/
|
|
98
|
-
stacksInWorkspace = this.query({
|
|
99
|
-
name: 'stacksInWorkspace',
|
|
100
|
-
request: async (signal, variables: Parameters<typeof workspaceStackControllerlistStacks>[0]) => workspaceStackControllerlistStacks(variables, { signal }),
|
|
101
|
-
permission: async (variables: Parameters<typeof workspaceStackControllerlistStacks>[0]) => {
|
|
102
|
-
const contentStacksPermission = await contentClient.allStackVersionByIds.isAllowed()
|
|
103
|
-
const workspaceStacksPermission = await workspaceClient.stacks.isAllowed(variables)
|
|
104
|
-
return workspaceStacksPermission && contentStacksPermission
|
|
105
|
-
},
|
|
106
|
-
})
|
|
107
|
-
/**
|
|
108
|
-
* Add a stack in a workspace
|
|
109
|
-
*/
|
|
110
|
-
addStackToWorkspace = this.mutation({
|
|
111
|
-
name: 'addStackToWorkspace',
|
|
112
|
-
request: async (signal, variables: Parameters<typeof workspaceStackControlleraddStacksInWorkspace>[0]) =>
|
|
113
|
-
workspaceStackControlleraddStacksInWorkspace(variables, { signal }),
|
|
114
|
-
permission: async ({ workspaceId }: Parameters<typeof workspaceStackControlleraddStacksInWorkspace>[0]) =>
|
|
115
|
-
workspaceClient.addStackInWorkspace.isAllowed({ workspaceId }),
|
|
116
|
-
})
|
|
117
|
-
/**
|
|
118
|
-
* Removes a stack from a workspace
|
|
119
|
-
*/
|
|
120
|
-
removeStackFromWorkspace = this.mutation({
|
|
121
|
-
name: 'removeStackFromWorkspace',
|
|
122
|
-
request: async (signal, variables: Parameters<typeof workspaceStackControllerdeleteStacksInWorkspace>[0]) =>
|
|
123
|
-
workspaceStackControllerdeleteStacksInWorkspace(variables, { signal }),
|
|
124
|
-
permission: async ({ workspaceId }: Parameters<typeof workspaceStackControllerdeleteStacksInWorkspace>[0]) =>
|
|
125
|
-
workspaceClient.removeStackFromWorkspace.isAllowed({ workspaceId }),
|
|
126
|
-
})
|
|
127
|
-
/**
|
|
128
|
-
* Deletes a workspace
|
|
129
|
-
*/
|
|
130
|
-
deleteWorkspace = this.mutation({
|
|
131
|
-
name: 'removeStackFromWorkspace',
|
|
132
|
-
request: async (signal, variables: Parameters<typeof workspaceControllerdelete>[0]) =>
|
|
133
|
-
workspaceControllerdelete(variables, { signal }),
|
|
134
|
-
permission: async ({ workspaceId }: Parameters<typeof workspaceControllerdelete>[0]) =>
|
|
135
|
-
workspaceClient.deleteWorkspace.isAllowed({ workspaceId }),
|
|
136
|
-
})
|
|
137
|
-
/**
|
|
138
|
-
* Gets inputs from a plugin in a workspace stack
|
|
139
|
-
*/
|
|
140
|
-
pluginInputsInWorkspace = this.query({
|
|
141
|
-
name: 'pluginInputsInWorkspace',
|
|
142
|
-
request: async (signal, variables: Parameters<typeof contextgetConsolidatedPluginInputs>[0]) => {
|
|
143
|
-
const data = await contextgetConsolidatedPluginInputs(variables, { signal })
|
|
144
|
-
return data as unknown as FixedFullInputContextResponse
|
|
145
|
-
},
|
|
146
|
-
permission: async ({ workspaceId, stackVersionId }: Parameters<typeof contextgetConsolidatedPluginInputs>[0]) => {
|
|
147
|
-
const canViewContext = await workspaceClient.listConsolidatedWorkspaceContext.isAllowed({ $type: 'plugin', workspaceId, stackVersionId })
|
|
148
|
-
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
149
|
-
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
150
|
-
return canViewContext && canGetConnectionInterfaceTypes && canGetPluginVersions
|
|
151
|
-
},
|
|
152
|
-
})
|
|
153
|
-
/**
|
|
154
|
-
* Gets workflow in a workspace stack
|
|
155
|
-
*/
|
|
156
|
-
workflowDataWithInputsInWorkspace = this.query(contextWorkflowControllergetConsolidatedWorkflowInputs as
|
|
157
|
-
unknown as ReplaceResult<typeof contextWorkflowControllergetConsolidatedWorkflowInputs, FixedWorkflowForCreationResponse>)
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Gets workflow inputs in a workspace stack
|
|
161
|
-
*/
|
|
162
|
-
workflowInputsInWorkspace = this.query(contextWorkflowControllergetWorkspaceWorkflowInputs as unknown as ReplaceResult<typeof contextWorkflowControllergetWorkspaceWorkflowInputs, FixedWorkflowForCreationResponse>)
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Gets workflow inputs in an account stack
|
|
166
|
-
*/
|
|
167
|
-
workflowInputsInAccount = this.query(contextWorkflowControllergetAccountWorkflowInputs as
|
|
168
|
-
unknown as ReplaceResult<typeof contextWorkflowControllergetAccountWorkflowInputs, FixedFullInputContextResponse>)
|
|
169
|
-
/**
|
|
170
|
-
* Gets inputs from a plugin in account context
|
|
171
|
-
*/
|
|
172
|
-
pluginInputsAccount = this.query({
|
|
173
|
-
name: 'pluginInputsAccount',
|
|
174
|
-
request: async (signal, variables: Parameters<typeof contextgetAccountPluginInputs>[0]) => {
|
|
175
|
-
const data = await contextgetAccountPluginInputs(variables, { signal })
|
|
176
|
-
return data as unknown as FixedFullInputContextResponse
|
|
177
|
-
},
|
|
178
|
-
permission: async ({ stackVersionId }: Parameters<typeof contextgetAccountPluginInputs>[0]) => {
|
|
179
|
-
const canViewContext = await workspaceClient.listConsolidatedContext.isAllowed({ $type: 'plugin', stackVersionId })
|
|
180
|
-
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
181
|
-
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
182
|
-
return canViewContext && canGetConnectionInterfaceTypes && canGetPluginVersions
|
|
183
|
-
},
|
|
184
|
-
})
|
|
185
|
-
/**
|
|
186
|
-
* Update context inputs from a plugin in workspace
|
|
187
|
-
*/
|
|
188
|
-
updateInputContextPluginWorkspace = this.mutation({
|
|
189
|
-
name: 'updateInputContextPluginWorkspace',
|
|
190
|
-
request: async (signal, variables: Parameters<typeof contextControllerupsertPluginWorkspaceContext>[0]) =>
|
|
191
|
-
contextControllerupsertPluginWorkspaceContext(variables, { signal }),
|
|
192
|
-
permission: async ({ stackVersionId, workspaceId, pluginVersionId }: Parameters<typeof contextControllerupsertPluginWorkspaceContext>[0]) =>
|
|
193
|
-
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'plugin', workspaceId, stackVersionId, externalId: pluginVersionId }),
|
|
194
|
-
})
|
|
195
|
-
/**
|
|
196
|
-
* Clear context of inputs from a plugin in workspace
|
|
197
|
-
*/
|
|
198
|
-
clearInputContextPluginWorkspace = this.mutation({
|
|
199
|
-
name: 'clearInputContextPluginWorkspace',
|
|
200
|
-
request: async (signal, variables: Parameters<typeof contextControllerclearPluginContextInWorkspace>[0]) =>
|
|
201
|
-
contextControllerclearPluginContextInWorkspace(variables, { signal }),
|
|
202
|
-
permission: async ({ stackVersionId, workspaceId, pluginVersionId }: Parameters<typeof contextControllerclearPluginContextInWorkspace>[0]) =>
|
|
203
|
-
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'plugin', workspaceId, stackVersionId, externalId: pluginVersionId }),
|
|
204
|
-
})
|
|
205
|
-
/**
|
|
206
|
-
* Update context inputs from a plugin in account
|
|
207
|
-
*/
|
|
208
|
-
updateInputContextPluginAccount = this.mutation({
|
|
209
|
-
name: 'updateInputContextPluginAccount',
|
|
210
|
-
request: async (signal, variables: Parameters<typeof contextControllerupsertPluginAccountContext>[0]) =>
|
|
211
|
-
contextControllerupsertPluginAccountContext(variables, { signal }),
|
|
212
|
-
permission: async ({ stackVersionId, pluginVersionId }: Parameters<typeof contextControllerupsertPluginAccountContext>[0]) =>
|
|
213
|
-
workspaceClient.saveContextInAccount.isAllowed({ $type: 'plugin', stackVersionId, externalId: pluginVersionId }),
|
|
214
|
-
})
|
|
215
|
-
/**
|
|
216
|
-
* Clear context of inputs from an plugin in account
|
|
217
|
-
*/
|
|
218
|
-
clearInputContextPluginAccount = this.mutation({
|
|
219
|
-
name: 'clearInputContextPluginAccount',
|
|
220
|
-
request: async (signal, variables: Parameters<typeof contextControllerclearPluginContextInAccount>[0]) =>
|
|
221
|
-
contextControllerclearPluginContextInAccount(variables, { signal }),
|
|
222
|
-
permission: async ({ stackVersionId, pluginVersionId }: Parameters<typeof contextControllerclearPluginContextInAccount>[0]) =>
|
|
223
|
-
workspaceClient.saveContextInAccount.isAllowed({ $type: 'plugin', stackVersionId, externalId: pluginVersionId }),
|
|
224
|
-
})
|
|
225
|
-
/**
|
|
226
|
-
* Gets links in a shared infra for a given env
|
|
227
|
-
*/
|
|
228
|
-
sharedInfraLinks = this.query(sharedInfraControllergetApplicationLinks)
|
|
229
|
-
/**
|
|
230
|
-
* Gets links in an application for a given env
|
|
231
|
-
*/
|
|
232
|
-
applicationLinks = this.query(applicationControllergetApplicationLinks)
|
|
233
|
-
/**
|
|
234
|
-
* Gets applied plugins in shared infra
|
|
235
|
-
*/
|
|
236
|
-
appliedPluginsSharedInfra = this.query(sharedInfraControllerV2GetSharedInfraAppliedPlugins)
|
|
237
|
-
/**
|
|
238
|
-
* List all environments from account
|
|
239
|
-
*/
|
|
240
|
-
listEnvironments = this.query(environmentControllergetEnvironments)
|
|
241
|
-
/**
|
|
242
|
-
* Gets applied plugins in application
|
|
243
|
-
*/
|
|
244
|
-
appliedPluginsApplication = this.query(applicationControllerV2GetApplicationAppliedPlugins)
|
|
245
|
-
/**
|
|
246
|
-
* Gets plugin inputs and connection interface from a plugin in a stack version in workspace
|
|
247
|
-
*/
|
|
248
|
-
pluginInputsWithConnectionInterfaces = this.query(contextgetConsolidatedPluginInputsWithConnectionInterfaces as unknown as ReplaceResult<typeof contextgetConsolidatedPluginInputsWithConnectionInterfaces, FixedPluginForAppCreationV2Response>)
|
|
249
|
-
/**
|
|
250
|
-
* Gets workflows from a given stack and workflow type
|
|
251
|
-
*/
|
|
252
|
-
workflowsByStackIdAndWorkflowType = this.query(workflowWorkspaceControllerlistWorkflowByStackIdAndWorkflowType)
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Creates an infra using workflow
|
|
256
|
-
*/
|
|
257
|
-
createInfraUsingWorkflow = this.mutation(contentWorkflowControllercreateSharedInfraThroughWorkflow)
|
|
258
|
-
/**
|
|
259
|
-
* Creates an application using workflow
|
|
260
|
-
*/
|
|
261
|
-
createAppUsingWorkflow = this.mutation(contentWorkflowControllercreateApplicationThroughWorkflow)
|
|
262
|
-
/**
|
|
263
|
-
* Gets inputs from an action in a workspace
|
|
264
|
-
*/
|
|
265
|
-
actionInputsInWorkspace = this.query({
|
|
266
|
-
name: 'actionInputsInWorkspace',
|
|
267
|
-
request: async (signal, variables: Parameters<typeof contextActionControllergetStackActionInputsInWorkspaceContext>[0]) => {
|
|
268
|
-
const data = await contextActionControllergetStackActionInputsInWorkspaceContext(variables, { signal })
|
|
269
|
-
return data as FixedFullInputContextResponse
|
|
270
|
-
},
|
|
271
|
-
permission: async ({ workspaceId, stackVersionId, actionsVersionId }: Parameters<typeof contextActionControllergetStackActionInputsInWorkspaceContext>[0]) => {
|
|
272
|
-
const canViewContext = await workspaceClient.listConsolidatedWorkspaceContext.isAllowed({ $type: 'action', workspaceId, stackVersionId })
|
|
273
|
-
const canGetActionInput = await contentClient.actionInputs.isAllowed({ actionVersionId: actionsVersionId })
|
|
274
|
-
return canViewContext && canGetActionInput
|
|
275
|
-
},
|
|
276
|
-
})
|
|
277
|
-
/**
|
|
278
|
-
* Gets inputs from an action in account context
|
|
279
|
-
*/
|
|
280
|
-
actionInputsAccount = this.query({
|
|
281
|
-
name: 'actionInputsFromStack',
|
|
282
|
-
request: async (signal, variables: Parameters<typeof contextActionControllergetStackActionInputsInAccountContext>[0]) => {
|
|
283
|
-
const data = await contextActionControllergetStackActionInputsInAccountContext(variables, { signal })
|
|
284
|
-
return data as FixedFullInputContextResponse
|
|
285
|
-
},
|
|
286
|
-
permission: async ({ stackVersionId, actionsVersionId }: Parameters<typeof contextActionControllergetStackActionInputsInAccountContext>[0]) => {
|
|
287
|
-
const canViewContext = await workspaceClient.listConsolidatedContext.isAllowed({ $type: 'action', stackVersionId })
|
|
288
|
-
const canGetActionInput = await contentClient.actionInputs.isAllowed({ actionVersionId: actionsVersionId })
|
|
289
|
-
return canViewContext && canGetActionInput
|
|
290
|
-
},
|
|
291
|
-
})
|
|
292
|
-
/**
|
|
293
|
-
* Update context inputs from an action in workspace
|
|
294
|
-
*/
|
|
295
|
-
updateInputContextActionWorkspace = this.mutation({
|
|
296
|
-
name: 'updateInputContextActionWorkspace',
|
|
297
|
-
request: async (signal, variables: Parameters<typeof contextControllerupsertWorkspaceActionsInputContext>[0]) =>
|
|
298
|
-
contextControllerupsertWorkspaceActionsInputContext(variables, { signal }),
|
|
299
|
-
permission: async ({ stackVersionId, workspaceId, actionVersionId }: Parameters<typeof contextControllerupsertWorkspaceActionsInputContext>[0]) =>
|
|
300
|
-
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'action', workspaceId, stackVersionId, externalId: actionVersionId }),
|
|
301
|
-
})
|
|
302
|
-
/**
|
|
303
|
-
* Clear context inputs from an action in workspace
|
|
304
|
-
*/
|
|
305
|
-
clearInputContextActionWorkspace = this.mutation({
|
|
306
|
-
name: 'clearInputContextActionWorkspace',
|
|
307
|
-
request: async (signal, variables: Parameters<typeof contextControllerclearActionContextInWorkspace>[0]) =>
|
|
308
|
-
contextControllerclearActionContextInWorkspace(variables, { signal }),
|
|
309
|
-
permission: async ({ stackVersionId, workspaceId, actionVersionId }: Parameters<typeof contextControllerclearActionContextInWorkspace>[0]) =>
|
|
310
|
-
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'action', workspaceId, stackVersionId, externalId: actionVersionId }),
|
|
311
|
-
})
|
|
312
|
-
/**
|
|
313
|
-
* Update context inputs from an action in account
|
|
314
|
-
*/
|
|
315
|
-
updateInputContextActionAccount = this.mutation({
|
|
316
|
-
name: 'updateInputContextActionAccount',
|
|
317
|
-
request: async (signal, variables: Parameters<typeof contextControllerupsertAccountActionsInputContext>[0]) =>
|
|
318
|
-
contextControllerupsertAccountActionsInputContext(variables, { signal }),
|
|
319
|
-
permission: async ({ stackVersionId, actionVersionId }: Parameters<typeof contextControllerupsertAccountActionsInputContext>[0]) =>
|
|
320
|
-
workspaceClient.saveContextInAccount.isAllowed({ $type: 'action', stackVersionId, externalId: actionVersionId }),
|
|
321
|
-
})
|
|
322
|
-
/**
|
|
323
|
-
* Clear context inputs from an action in account
|
|
324
|
-
*/
|
|
325
|
-
clearInputContextActionAccount = this.mutation({
|
|
326
|
-
name: 'clearInputContextActionAccount',
|
|
327
|
-
request: async (signal, variables: Parameters<typeof contextControllerclearActionContextInAccount>[0]) =>
|
|
328
|
-
contextControllerclearActionContextInAccount(variables, { signal }),
|
|
329
|
-
permission: async ({ stackVersionId, actionVersionId }: Parameters<typeof contextControllerclearActionContextInAccount>[0]) =>
|
|
330
|
-
workspaceClient.saveContextInAccount.isAllowed({ $type: 'action', stackVersionId, externalId: actionVersionId }),
|
|
331
|
-
})
|
|
332
|
-
/**
|
|
333
|
-
* Gets details of an application in an environment
|
|
334
|
-
*/
|
|
335
|
-
applicationDetails = this.query({
|
|
336
|
-
name: 'applicationDetails',
|
|
337
|
-
request: async (signal, variables: Parameters<typeof applicationControllergetApplicationDetails>[0]) => applicationControllergetApplicationDetails(variables, { signal }),
|
|
338
|
-
permission: async ({ applicationId, workspaceId }: Parameters<typeof applicationControllergetApplicationDetails>[0]) =>
|
|
339
|
-
workspaceClient.applicationDetail.isAllowed({ applicationId, workspaceId }),
|
|
340
|
-
})
|
|
341
|
-
/**
|
|
342
|
-
* Deletes an application
|
|
343
|
-
*/
|
|
344
|
-
deleteApplication = this.mutation({
|
|
345
|
-
name: 'deleteApplication',
|
|
346
|
-
request: async (signal, variables: Parameters<typeof managerRunControllerdeleteApplication>[0]) => managerRunControllerdeleteApplication(variables, { signal }),
|
|
347
|
-
permission: async (variables: Parameters<typeof managerRunControllerdeleteApplication>[0]) =>
|
|
348
|
-
workspaceClient.deleteApplication.isAllowed(variables),
|
|
349
|
-
})
|
|
350
|
-
/**
|
|
351
|
-
* Gets details of a shared infra in an environment
|
|
352
|
-
*/
|
|
353
|
-
sharedInfraDetails = this.query({
|
|
354
|
-
name: 'sharedInfraDetails',
|
|
355
|
-
request: async (signal, variables: Parameters<typeof sharedInfraControllergetSharedInfraAppliedPlugins>[0]) => sharedInfraControllergetSharedInfraAppliedPlugins(variables, { signal }),
|
|
356
|
-
permission: async ({ sharedInfraId, workspaceId }: Parameters<typeof sharedInfraControllergetSharedInfraAppliedPlugins>[0]) =>
|
|
357
|
-
workspaceClient.infraDetail.isAllowed({ sharedInfraId, workspaceId }),
|
|
358
|
-
})
|
|
359
|
-
/**
|
|
360
|
-
* Deletes an infra
|
|
361
|
-
*/
|
|
362
|
-
deleteInfra = this.mutation({
|
|
363
|
-
name: 'deleteInfra',
|
|
364
|
-
request: async (signal, variables: Parameters<typeof managerRunControllerdeleteSharedInfra>[0]) => managerRunControllerdeleteSharedInfra(variables, { signal }),
|
|
365
|
-
permission: async (variables: Parameters<typeof managerRunControllerdeleteSharedInfra>[0]) =>
|
|
366
|
-
workspaceClient.deleteInfra.isAllowed(variables),
|
|
367
|
-
})
|
|
368
|
-
/**
|
|
369
|
-
* Gets activities of a shared infra
|
|
370
|
-
*/
|
|
371
|
-
activitiesSharedInfra = this.infiniteQuery(sharedInfraControllerV2GetSharedInfraActivities as unknown as ReplaceResult<typeof sharedInfraControllerV2GetSharedInfraActivities, FixedPaginatedActivityResponse>,
|
|
372
|
-
{ accumulator: 'items', initialPageParam: 0 })
|
|
373
|
-
/**
|
|
374
|
-
* Gets activities of an application
|
|
375
|
-
*/
|
|
376
|
-
activitiesApplication = this.infiniteQuery(applicationControllerV2GetApplicationActivities as unknown as ReplaceResult<typeof applicationControllerV2GetApplicationActivities, FixedPaginatedActivityResponse>,
|
|
377
|
-
{ accumulator: 'items', initialPageParam: 0 })
|
|
378
|
-
/**
|
|
379
|
-
* Updates Stacks To Latest Version By Workspace
|
|
380
|
-
*/
|
|
381
|
-
updateStacksToLatestVersionByWorkspace = this.mutation(workspaceStackControllerrefreshStacksInWorkspace)
|
|
382
|
-
/**
|
|
383
|
-
* Get all workspaces with pagination
|
|
384
|
-
*/
|
|
385
|
-
workspacesWithPagination = this.infiniteQuery(workspaceControllergetWorkspaces, { accumulator: 'items', initialPageParam: 0 })
|
|
386
|
-
/**
|
|
387
|
-
* Get all applications by workspace with pagination
|
|
388
|
-
*/
|
|
389
|
-
applicationsByWorkspaceWithPagination = this.query(applicationControllergetApplications)
|
|
390
|
-
/**
|
|
391
|
-
* Get all shared infra by workspace with pagination
|
|
392
|
-
*/
|
|
393
|
-
sharedInfraByWorkspaceWithPagination = this.query(sharedInfraControllergetSharedInfra)
|
|
394
|
-
/**
|
|
395
|
-
* Get all stacks used to create application in a workspace
|
|
396
|
-
*/
|
|
397
|
-
filterStacksFromApplicationInWorkspace = this.query(applicationControllergetApplicationFilters)
|
|
398
|
-
/**
|
|
399
|
-
* Get all stacks used to create infra in a workspace.
|
|
400
|
-
*/
|
|
401
|
-
filterStacksFromInfraInWorkspace = this.query(sharedInfraControllergetSharedInfraFilters)
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Get all workspaces associated with an account.
|
|
405
|
-
*/
|
|
406
|
-
getAccountWorkspaces = this.query(workspaceControllergetWorkspaces)
|
|
407
|
-
|
|
408
|
-
/**
|
|
409
|
-
* Get all applications associated with an account.
|
|
410
|
-
*/
|
|
411
|
-
getAccountApplications = this.infiniteQuery(accountApplicationControllergetAccountApplicationPage, { accumulator: 'items', initialPageParam: { page: 0 } })
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Get all shared infrastructures associated with an account.
|
|
415
|
-
*/
|
|
416
|
-
getAccountSharedInfra = this.query(accountSharedInfraControllergetAccountSharedInfraPage)
|
|
417
|
-
|
|
418
|
-
/** * Gets filters for applications associated with an account. */
|
|
419
|
-
getAccountApplicationsFilters = this.query(accountApplicationControllergetAccountApplicationsFilters)
|
|
420
|
-
|
|
421
|
-
/** * Gets filters for shared infrastructures associated with an account. */
|
|
422
|
-
getAccountSharedInfraFilters = this.query(accountSharedInfraControllergetAccountSharedInfraFilters)
|
|
423
|
-
|
|
424
|
-
// Variables Account
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Find all account variables
|
|
428
|
-
*/
|
|
429
|
-
accountVariables = this.query(accountVariableControllerfindAll)
|
|
430
|
-
/**
|
|
431
|
-
* Get an account variable by name
|
|
432
|
-
*/
|
|
433
|
-
getAccountVariable = this.query(accountVariableControllerfindByName)
|
|
434
|
-
/**
|
|
435
|
-
* Get account variable usage
|
|
436
|
-
*/
|
|
437
|
-
accountVariableUsage = this.query(accountVariableControllerusage)
|
|
438
|
-
/**
|
|
439
|
-
* Create account variable
|
|
440
|
-
*/
|
|
441
|
-
createAccountVariable = this.mutation(accountVariableControllercreate)
|
|
442
|
-
/**
|
|
443
|
-
* Update account variable
|
|
444
|
-
*/
|
|
445
|
-
updateAccountVariable = this.mutation(accountVariableControllerupdate)
|
|
446
|
-
/**
|
|
447
|
-
* Delete account variable
|
|
448
|
-
*/
|
|
449
|
-
deleteAccountVariable = this.mutation(accountVariableControllerdelete)
|
|
450
|
-
|
|
451
|
-
// Variables Workspace
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Find all workspace variables
|
|
455
|
-
*/
|
|
456
|
-
workspaceVariables = this.query(workspaceVariableControllerfindAll)
|
|
457
|
-
/**
|
|
458
|
-
* Get a workspace variable by name
|
|
459
|
-
*/
|
|
460
|
-
getWorkspaceVariable = this.query(workspaceVariableControllerfindByName)
|
|
461
|
-
/**
|
|
462
|
-
* Updates workspace variable based on existing account variable
|
|
463
|
-
*/
|
|
464
|
-
updateWorkspaceVariable = this.mutation(workspaceVariableControllerupsert)
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
// Update Infra Plugins
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Get available branches on the App repo.
|
|
471
|
-
*/
|
|
472
|
-
getAppAvailableBranches = this.query(updateInfrastructureControllergetApplicationBranches)
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* Get available branches on the Infra repo.
|
|
476
|
-
*/
|
|
477
|
-
getInfraAvailableBranches = this.query(updateInfrastructureControllergetSharedInfraBranches)
|
|
478
|
-
/**
|
|
479
|
-
* Get current branch App infra plugins state
|
|
480
|
-
*/
|
|
481
|
-
getAppInfraPluginsToUpdate = this.query(updateInfrastructureControllergetApplicationInfraPlugins)
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* Get current branch Infra plugins state
|
|
485
|
-
*/
|
|
486
|
-
getInfraPluginsToUpdate = this.query(updateInfrastructureControllergetSharedInfraInfraPlugins)
|
|
487
|
-
|
|
488
|
-
/**
|
|
489
|
-
* Updates plugins within an Infra
|
|
490
|
-
*/
|
|
491
|
-
updateInfraPlugins = this.mutation(updateInfrastructureControllerupdateInfraPluginsAndCreatePullRequestBySharedInfra)
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* Updates infra plugins within an App
|
|
495
|
-
*/
|
|
496
|
-
updateAppInfraPlugins = this.mutation(updateInfrastructureControllerupdateInfraPluginsAndCreatePullRequestByApplication)
|
|
497
|
-
|
|
498
|
-
/**
|
|
499
|
-
* Gets infra dependencies
|
|
500
|
-
*/
|
|
501
|
-
getInfraDependencies = this.query(sharedInfraControllergetSharedInfraDependencies)
|
|
502
|
-
|
|
503
|
-
/**
|
|
504
|
-
* Gets app dependencies
|
|
505
|
-
*/
|
|
506
|
-
getAppDependencies = this.query(applicationControllergetApplicationDependencies)
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Destroys an application
|
|
510
|
-
*/
|
|
511
|
-
destroyApp = this.mutation(applicationControllerregistryAppDestroy)
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Destroys an infrastructure
|
|
515
|
-
*/
|
|
516
|
-
destroyInfra = this.mutation(updateInfrastructureControllerremoveInfraPluginsAndCreatePullRequestBySharedInfra)
|
|
517
|
-
/**
|
|
518
|
-
* Destroys an application's infrastructure
|
|
519
|
-
*/
|
|
520
|
-
destroyAppInfra = this.mutation(updateInfrastructureControllerremoveInfraPluginsAndCreatePullRequestByApplication)
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* Update context inputs from an workflow in workspace
|
|
524
|
-
*/
|
|
525
|
-
updateInputContextWorkflowWorkspace = this.mutation({
|
|
526
|
-
name: 'updateInputContextWorkflowWorkspace',
|
|
527
|
-
request: async (signal, variables: Parameters<typeof contextControllerupsertWorkflowWorkspaceContext>[0]) =>
|
|
528
|
-
contextControllerupsertWorkflowWorkspaceContext(variables, { signal }),
|
|
529
|
-
permission: async ({ stackVersionId, workspaceId, workflowVersionId }: Parameters<typeof contextControllerupsertWorkflowWorkspaceContext>[0]) =>
|
|
530
|
-
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'workflow', workspaceId, stackVersionId, externalId: workflowVersionId }),
|
|
531
|
-
})
|
|
532
|
-
/**
|
|
533
|
-
* Update context inputs from an workflow in account
|
|
534
|
-
*/
|
|
535
|
-
updateInputContextWorkflowAccount = this.mutation({
|
|
536
|
-
name: 'updateInputContextWorkflowAccount',
|
|
537
|
-
request: async (signal, variables: Parameters<typeof contextControllerupsertWorkflowAccountContext>[0]) =>
|
|
538
|
-
contextControllerupsertWorkflowAccountContext(variables, { signal }),
|
|
539
|
-
permission: async ({ stackVersionId, workflowVersionId }: Parameters<typeof contextControllerupsertWorkflowAccountContext>[0]) =>
|
|
540
|
-
workspaceClient.saveContextInAccount.isAllowed({ $type: 'workflow', stackVersionId, externalId: workflowVersionId }),
|
|
541
|
-
})
|
|
542
|
-
/**
|
|
543
|
-
* Get Stacks with context
|
|
544
|
-
*/
|
|
545
|
-
stacksWithContext = this.query(workspaceStackControllerlistStacksContext)
|
|
546
|
-
/**
|
|
547
|
-
* Import context of stack in Workspace
|
|
548
|
-
*/
|
|
549
|
-
importContextStackInWokspace = this.mutation(contextControllerimportContextInWorkspace)
|
|
550
|
-
/**
|
|
551
|
-
* Import context of stack in Account
|
|
552
|
-
*/
|
|
553
|
-
importContextStackInAccount = this.mutation(contextControllerimportContextInAccount)
|
|
554
|
-
/**
|
|
555
|
-
* Get list of versions with context of stack
|
|
556
|
-
*/
|
|
557
|
-
getStacksVersionWithContext = this.query(accountStackControllerlistVersionsWithContext)
|
|
558
|
-
/**
|
|
559
|
-
* Receives a list of workspace id's and returns that workspaces detailed
|
|
560
|
-
*/
|
|
561
|
-
workspacesFilterById = this.mutation(workspaceControllergetWorkspacesSummary)
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
export const workspaceManagerClient = new WorkspaceManagerClient()
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
import { HttpError } from '@oazapfts/runtime'
|
|
3
|
+
import { getApiAddresses } from '../api-addresses'
|
|
4
|
+
import {
|
|
5
|
+
accountApplicationControllergetAccountApplicationPage,
|
|
6
|
+
accountApplicationControllergetAccountApplicationsFilters,
|
|
7
|
+
accountSharedInfraControllergetAccountSharedInfraFilters,
|
|
8
|
+
accountSharedInfraControllergetAccountSharedInfraPage,
|
|
9
|
+
accountStackControllerlistVersionsWithContext,
|
|
10
|
+
accountVariableControllercreate,
|
|
11
|
+
accountVariableControllerdelete,
|
|
12
|
+
accountVariableControllerfindAll,
|
|
13
|
+
accountVariableControllerfindByName,
|
|
14
|
+
accountVariableControllerupdate,
|
|
15
|
+
accountVariableControllerusage,
|
|
16
|
+
applicationControllerV2GetApplicationActivities,
|
|
17
|
+
applicationControllerV2GetApplicationAppliedPlugins,
|
|
18
|
+
applicationControllergetApplicationDependencies,
|
|
19
|
+
applicationControllergetApplicationDetails,
|
|
20
|
+
applicationControllergetApplicationFilters,
|
|
21
|
+
applicationControllergetApplicationLinks,
|
|
22
|
+
applicationControllergetApplications,
|
|
23
|
+
applicationControllerregistryAppDestroy,
|
|
24
|
+
contentWorkflowControllercreateApplicationThroughWorkflow,
|
|
25
|
+
contentWorkflowControllercreateSharedInfraThroughWorkflow,
|
|
26
|
+
contextActionControllergetStackActionInputsInAccountContext,
|
|
27
|
+
contextActionControllergetStackActionInputsInWorkspaceContext,
|
|
28
|
+
contextControllerclearActionContextInAccount,
|
|
29
|
+
contextControllerclearActionContextInWorkspace,
|
|
30
|
+
contextControllerclearPluginContextInAccount,
|
|
31
|
+
contextControllerclearPluginContextInWorkspace,
|
|
32
|
+
contextControllerimportContextInAccount,
|
|
33
|
+
contextControllerimportContextInWorkspace,
|
|
34
|
+
contextControllerupsertAccountActionsInputContext,
|
|
35
|
+
contextControllerupsertPluginAccountContext,
|
|
36
|
+
contextControllerupsertPluginWorkspaceContext,
|
|
37
|
+
contextControllerupsertWorkflowAccountContext,
|
|
38
|
+
contextControllerupsertWorkflowWorkspaceContext,
|
|
39
|
+
contextControllerupsertWorkspaceActionsInputContext,
|
|
40
|
+
contextWorkflowControllergetAccountWorkflowInputs,
|
|
41
|
+
contextWorkflowControllergetConsolidatedWorkflowInputs,
|
|
42
|
+
contextWorkflowControllergetWorkspaceWorkflowInputs,
|
|
43
|
+
contextgetAccountPluginInputs,
|
|
44
|
+
contextgetConsolidatedPluginInputs,
|
|
45
|
+
contextgetConsolidatedPluginInputsWithConnectionInterfaces,
|
|
46
|
+
defaults,
|
|
47
|
+
environmentControllergetEnvironments,
|
|
48
|
+
managerRunControllerdeleteApplication,
|
|
49
|
+
managerRunControllerdeleteSharedInfra,
|
|
50
|
+
sharedInfraControllerV2GetSharedInfraActivities,
|
|
51
|
+
sharedInfraControllerV2GetSharedInfraAppliedPlugins,
|
|
52
|
+
sharedInfraControllergetApplicationLinks,
|
|
53
|
+
sharedInfraControllergetSharedInfra,
|
|
54
|
+
sharedInfraControllergetSharedInfraAppliedPlugins,
|
|
55
|
+
sharedInfraControllergetSharedInfraDependencies,
|
|
56
|
+
sharedInfraControllergetSharedInfraFilters,
|
|
57
|
+
updateInfrastructureControllergetApplicationBranches,
|
|
58
|
+
updateInfrastructureControllergetApplicationInfraPlugins,
|
|
59
|
+
updateInfrastructureControllergetSharedInfraBranches,
|
|
60
|
+
updateInfrastructureControllergetSharedInfraInfraPlugins,
|
|
61
|
+
updateInfrastructureControllerremoveInfraPluginsAndCreatePullRequestByApplication,
|
|
62
|
+
updateInfrastructureControllerremoveInfraPluginsAndCreatePullRequestBySharedInfra,
|
|
63
|
+
updateInfrastructureControllerupdateInfraPluginsAndCreatePullRequestByApplication,
|
|
64
|
+
updateInfrastructureControllerupdateInfraPluginsAndCreatePullRequestBySharedInfra,
|
|
65
|
+
workflowWorkspaceControllerlistWorkflowByStackIdAndWorkflowType,
|
|
66
|
+
workspaceControllerdelete,
|
|
67
|
+
workspaceControllergetWorkspaces,
|
|
68
|
+
workspaceControllergetWorkspacesSummary,
|
|
69
|
+
workspaceStackControlleraddStacksInWorkspace,
|
|
70
|
+
workspaceStackControllerdeleteStacksInWorkspace,
|
|
71
|
+
workspaceStackControllerlistStacks,
|
|
72
|
+
workspaceStackControllerlistStacksContext,
|
|
73
|
+
workspaceStackControllerrefreshStacksInWorkspace,
|
|
74
|
+
workspaceVariableControllerfindAll,
|
|
75
|
+
workspaceVariableControllerfindByName,
|
|
76
|
+
workspaceVariableControllerupsert,
|
|
77
|
+
} from '../api/workspaceManager'
|
|
78
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
79
|
+
import { workspaceDictionary } from '../error/dictionary/workspace'
|
|
80
|
+
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
81
|
+
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
82
|
+
import { contentClient } from './content'
|
|
83
|
+
import { FixedFullInputContextResponse, FixedPaginatedActivityResponse, FixedPluginForAppCreationV2Response, FixedWorkflowForCreationResponse, ReplaceResult } from './types'
|
|
84
|
+
import { workspaceClient } from './workspace'
|
|
85
|
+
|
|
86
|
+
class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
87
|
+
constructor() {
|
|
88
|
+
super(getApiAddresses().workspaceManager.url, defaults)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
92
|
+
return new DefaultAPIError(error.data, error.status, workspaceDictionary, error.headers)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Gets all stacks in a workspace
|
|
97
|
+
*/
|
|
98
|
+
stacksInWorkspace = this.query({
|
|
99
|
+
name: 'stacksInWorkspace',
|
|
100
|
+
request: async (signal, variables: Parameters<typeof workspaceStackControllerlistStacks>[0]) => workspaceStackControllerlistStacks(variables, { signal }),
|
|
101
|
+
permission: async (variables: Parameters<typeof workspaceStackControllerlistStacks>[0]) => {
|
|
102
|
+
const contentStacksPermission = await contentClient.allStackVersionByIds.isAllowed()
|
|
103
|
+
const workspaceStacksPermission = await workspaceClient.stacks.isAllowed(variables)
|
|
104
|
+
return workspaceStacksPermission && contentStacksPermission
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
/**
|
|
108
|
+
* Add a stack in a workspace
|
|
109
|
+
*/
|
|
110
|
+
addStackToWorkspace = this.mutation({
|
|
111
|
+
name: 'addStackToWorkspace',
|
|
112
|
+
request: async (signal, variables: Parameters<typeof workspaceStackControlleraddStacksInWorkspace>[0]) =>
|
|
113
|
+
workspaceStackControlleraddStacksInWorkspace(variables, { signal }),
|
|
114
|
+
permission: async ({ workspaceId }: Parameters<typeof workspaceStackControlleraddStacksInWorkspace>[0]) =>
|
|
115
|
+
workspaceClient.addStackInWorkspace.isAllowed({ workspaceId }),
|
|
116
|
+
})
|
|
117
|
+
/**
|
|
118
|
+
* Removes a stack from a workspace
|
|
119
|
+
*/
|
|
120
|
+
removeStackFromWorkspace = this.mutation({
|
|
121
|
+
name: 'removeStackFromWorkspace',
|
|
122
|
+
request: async (signal, variables: Parameters<typeof workspaceStackControllerdeleteStacksInWorkspace>[0]) =>
|
|
123
|
+
workspaceStackControllerdeleteStacksInWorkspace(variables, { signal }),
|
|
124
|
+
permission: async ({ workspaceId }: Parameters<typeof workspaceStackControllerdeleteStacksInWorkspace>[0]) =>
|
|
125
|
+
workspaceClient.removeStackFromWorkspace.isAllowed({ workspaceId }),
|
|
126
|
+
})
|
|
127
|
+
/**
|
|
128
|
+
* Deletes a workspace
|
|
129
|
+
*/
|
|
130
|
+
deleteWorkspace = this.mutation({
|
|
131
|
+
name: 'removeStackFromWorkspace',
|
|
132
|
+
request: async (signal, variables: Parameters<typeof workspaceControllerdelete>[0]) =>
|
|
133
|
+
workspaceControllerdelete(variables, { signal }),
|
|
134
|
+
permission: async ({ workspaceId }: Parameters<typeof workspaceControllerdelete>[0]) =>
|
|
135
|
+
workspaceClient.deleteWorkspace.isAllowed({ workspaceId }),
|
|
136
|
+
})
|
|
137
|
+
/**
|
|
138
|
+
* Gets inputs from a plugin in a workspace stack
|
|
139
|
+
*/
|
|
140
|
+
pluginInputsInWorkspace = this.query({
|
|
141
|
+
name: 'pluginInputsInWorkspace',
|
|
142
|
+
request: async (signal, variables: Parameters<typeof contextgetConsolidatedPluginInputs>[0]) => {
|
|
143
|
+
const data = await contextgetConsolidatedPluginInputs(variables, { signal })
|
|
144
|
+
return data as unknown as FixedFullInputContextResponse
|
|
145
|
+
},
|
|
146
|
+
permission: async ({ workspaceId, stackVersionId }: Parameters<typeof contextgetConsolidatedPluginInputs>[0]) => {
|
|
147
|
+
const canViewContext = await workspaceClient.listConsolidatedWorkspaceContext.isAllowed({ $type: 'plugin', workspaceId, stackVersionId })
|
|
148
|
+
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
149
|
+
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
150
|
+
return canViewContext && canGetConnectionInterfaceTypes && canGetPluginVersions
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
/**
|
|
154
|
+
* Gets workflow in a workspace stack
|
|
155
|
+
*/
|
|
156
|
+
workflowDataWithInputsInWorkspace = this.query(contextWorkflowControllergetConsolidatedWorkflowInputs as
|
|
157
|
+
unknown as ReplaceResult<typeof contextWorkflowControllergetConsolidatedWorkflowInputs, FixedWorkflowForCreationResponse>)
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Gets workflow inputs in a workspace stack
|
|
161
|
+
*/
|
|
162
|
+
workflowInputsInWorkspace = this.query(contextWorkflowControllergetWorkspaceWorkflowInputs as unknown as ReplaceResult<typeof contextWorkflowControllergetWorkspaceWorkflowInputs, FixedWorkflowForCreationResponse>)
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Gets workflow inputs in an account stack
|
|
166
|
+
*/
|
|
167
|
+
workflowInputsInAccount = this.query(contextWorkflowControllergetAccountWorkflowInputs as
|
|
168
|
+
unknown as ReplaceResult<typeof contextWorkflowControllergetAccountWorkflowInputs, FixedFullInputContextResponse>)
|
|
169
|
+
/**
|
|
170
|
+
* Gets inputs from a plugin in account context
|
|
171
|
+
*/
|
|
172
|
+
pluginInputsAccount = this.query({
|
|
173
|
+
name: 'pluginInputsAccount',
|
|
174
|
+
request: async (signal, variables: Parameters<typeof contextgetAccountPluginInputs>[0]) => {
|
|
175
|
+
const data = await contextgetAccountPluginInputs(variables, { signal })
|
|
176
|
+
return data as unknown as FixedFullInputContextResponse
|
|
177
|
+
},
|
|
178
|
+
permission: async ({ stackVersionId }: Parameters<typeof contextgetAccountPluginInputs>[0]) => {
|
|
179
|
+
const canViewContext = await workspaceClient.listConsolidatedContext.isAllowed({ $type: 'plugin', stackVersionId })
|
|
180
|
+
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
181
|
+
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
182
|
+
return canViewContext && canGetConnectionInterfaceTypes && canGetPluginVersions
|
|
183
|
+
},
|
|
184
|
+
})
|
|
185
|
+
/**
|
|
186
|
+
* Update context inputs from a plugin in workspace
|
|
187
|
+
*/
|
|
188
|
+
updateInputContextPluginWorkspace = this.mutation({
|
|
189
|
+
name: 'updateInputContextPluginWorkspace',
|
|
190
|
+
request: async (signal, variables: Parameters<typeof contextControllerupsertPluginWorkspaceContext>[0]) =>
|
|
191
|
+
contextControllerupsertPluginWorkspaceContext(variables, { signal }),
|
|
192
|
+
permission: async ({ stackVersionId, workspaceId, pluginVersionId }: Parameters<typeof contextControllerupsertPluginWorkspaceContext>[0]) =>
|
|
193
|
+
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'plugin', workspaceId, stackVersionId, externalId: pluginVersionId }),
|
|
194
|
+
})
|
|
195
|
+
/**
|
|
196
|
+
* Clear context of inputs from a plugin in workspace
|
|
197
|
+
*/
|
|
198
|
+
clearInputContextPluginWorkspace = this.mutation({
|
|
199
|
+
name: 'clearInputContextPluginWorkspace',
|
|
200
|
+
request: async (signal, variables: Parameters<typeof contextControllerclearPluginContextInWorkspace>[0]) =>
|
|
201
|
+
contextControllerclearPluginContextInWorkspace(variables, { signal }),
|
|
202
|
+
permission: async ({ stackVersionId, workspaceId, pluginVersionId }: Parameters<typeof contextControllerclearPluginContextInWorkspace>[0]) =>
|
|
203
|
+
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'plugin', workspaceId, stackVersionId, externalId: pluginVersionId }),
|
|
204
|
+
})
|
|
205
|
+
/**
|
|
206
|
+
* Update context inputs from a plugin in account
|
|
207
|
+
*/
|
|
208
|
+
updateInputContextPluginAccount = this.mutation({
|
|
209
|
+
name: 'updateInputContextPluginAccount',
|
|
210
|
+
request: async (signal, variables: Parameters<typeof contextControllerupsertPluginAccountContext>[0]) =>
|
|
211
|
+
contextControllerupsertPluginAccountContext(variables, { signal }),
|
|
212
|
+
permission: async ({ stackVersionId, pluginVersionId }: Parameters<typeof contextControllerupsertPluginAccountContext>[0]) =>
|
|
213
|
+
workspaceClient.saveContextInAccount.isAllowed({ $type: 'plugin', stackVersionId, externalId: pluginVersionId }),
|
|
214
|
+
})
|
|
215
|
+
/**
|
|
216
|
+
* Clear context of inputs from an plugin in account
|
|
217
|
+
*/
|
|
218
|
+
clearInputContextPluginAccount = this.mutation({
|
|
219
|
+
name: 'clearInputContextPluginAccount',
|
|
220
|
+
request: async (signal, variables: Parameters<typeof contextControllerclearPluginContextInAccount>[0]) =>
|
|
221
|
+
contextControllerclearPluginContextInAccount(variables, { signal }),
|
|
222
|
+
permission: async ({ stackVersionId, pluginVersionId }: Parameters<typeof contextControllerclearPluginContextInAccount>[0]) =>
|
|
223
|
+
workspaceClient.saveContextInAccount.isAllowed({ $type: 'plugin', stackVersionId, externalId: pluginVersionId }),
|
|
224
|
+
})
|
|
225
|
+
/**
|
|
226
|
+
* Gets links in a shared infra for a given env
|
|
227
|
+
*/
|
|
228
|
+
sharedInfraLinks = this.query(sharedInfraControllergetApplicationLinks)
|
|
229
|
+
/**
|
|
230
|
+
* Gets links in an application for a given env
|
|
231
|
+
*/
|
|
232
|
+
applicationLinks = this.query(applicationControllergetApplicationLinks)
|
|
233
|
+
/**
|
|
234
|
+
* Gets applied plugins in shared infra
|
|
235
|
+
*/
|
|
236
|
+
appliedPluginsSharedInfra = this.query(sharedInfraControllerV2GetSharedInfraAppliedPlugins)
|
|
237
|
+
/**
|
|
238
|
+
* List all environments from account
|
|
239
|
+
*/
|
|
240
|
+
listEnvironments = this.query(environmentControllergetEnvironments)
|
|
241
|
+
/**
|
|
242
|
+
* Gets applied plugins in application
|
|
243
|
+
*/
|
|
244
|
+
appliedPluginsApplication = this.query(applicationControllerV2GetApplicationAppliedPlugins)
|
|
245
|
+
/**
|
|
246
|
+
* Gets plugin inputs and connection interface from a plugin in a stack version in workspace
|
|
247
|
+
*/
|
|
248
|
+
pluginInputsWithConnectionInterfaces = this.query(contextgetConsolidatedPluginInputsWithConnectionInterfaces as unknown as ReplaceResult<typeof contextgetConsolidatedPluginInputsWithConnectionInterfaces, FixedPluginForAppCreationV2Response>)
|
|
249
|
+
/**
|
|
250
|
+
* Gets workflows from a given stack and workflow type
|
|
251
|
+
*/
|
|
252
|
+
workflowsByStackIdAndWorkflowType = this.query(workflowWorkspaceControllerlistWorkflowByStackIdAndWorkflowType)
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Creates an infra using workflow
|
|
256
|
+
*/
|
|
257
|
+
createInfraUsingWorkflow = this.mutation(contentWorkflowControllercreateSharedInfraThroughWorkflow)
|
|
258
|
+
/**
|
|
259
|
+
* Creates an application using workflow
|
|
260
|
+
*/
|
|
261
|
+
createAppUsingWorkflow = this.mutation(contentWorkflowControllercreateApplicationThroughWorkflow)
|
|
262
|
+
/**
|
|
263
|
+
* Gets inputs from an action in a workspace
|
|
264
|
+
*/
|
|
265
|
+
actionInputsInWorkspace = this.query({
|
|
266
|
+
name: 'actionInputsInWorkspace',
|
|
267
|
+
request: async (signal, variables: Parameters<typeof contextActionControllergetStackActionInputsInWorkspaceContext>[0]) => {
|
|
268
|
+
const data = await contextActionControllergetStackActionInputsInWorkspaceContext(variables, { signal })
|
|
269
|
+
return data as FixedFullInputContextResponse
|
|
270
|
+
},
|
|
271
|
+
permission: async ({ workspaceId, stackVersionId, actionsVersionId }: Parameters<typeof contextActionControllergetStackActionInputsInWorkspaceContext>[0]) => {
|
|
272
|
+
const canViewContext = await workspaceClient.listConsolidatedWorkspaceContext.isAllowed({ $type: 'action', workspaceId, stackVersionId })
|
|
273
|
+
const canGetActionInput = await contentClient.actionInputs.isAllowed({ actionVersionId: actionsVersionId })
|
|
274
|
+
return canViewContext && canGetActionInput
|
|
275
|
+
},
|
|
276
|
+
})
|
|
277
|
+
/**
|
|
278
|
+
* Gets inputs from an action in account context
|
|
279
|
+
*/
|
|
280
|
+
actionInputsAccount = this.query({
|
|
281
|
+
name: 'actionInputsFromStack',
|
|
282
|
+
request: async (signal, variables: Parameters<typeof contextActionControllergetStackActionInputsInAccountContext>[0]) => {
|
|
283
|
+
const data = await contextActionControllergetStackActionInputsInAccountContext(variables, { signal })
|
|
284
|
+
return data as FixedFullInputContextResponse
|
|
285
|
+
},
|
|
286
|
+
permission: async ({ stackVersionId, actionsVersionId }: Parameters<typeof contextActionControllergetStackActionInputsInAccountContext>[0]) => {
|
|
287
|
+
const canViewContext = await workspaceClient.listConsolidatedContext.isAllowed({ $type: 'action', stackVersionId })
|
|
288
|
+
const canGetActionInput = await contentClient.actionInputs.isAllowed({ actionVersionId: actionsVersionId })
|
|
289
|
+
return canViewContext && canGetActionInput
|
|
290
|
+
},
|
|
291
|
+
})
|
|
292
|
+
/**
|
|
293
|
+
* Update context inputs from an action in workspace
|
|
294
|
+
*/
|
|
295
|
+
updateInputContextActionWorkspace = this.mutation({
|
|
296
|
+
name: 'updateInputContextActionWorkspace',
|
|
297
|
+
request: async (signal, variables: Parameters<typeof contextControllerupsertWorkspaceActionsInputContext>[0]) =>
|
|
298
|
+
contextControllerupsertWorkspaceActionsInputContext(variables, { signal }),
|
|
299
|
+
permission: async ({ stackVersionId, workspaceId, actionVersionId }: Parameters<typeof contextControllerupsertWorkspaceActionsInputContext>[0]) =>
|
|
300
|
+
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'action', workspaceId, stackVersionId, externalId: actionVersionId }),
|
|
301
|
+
})
|
|
302
|
+
/**
|
|
303
|
+
* Clear context inputs from an action in workspace
|
|
304
|
+
*/
|
|
305
|
+
clearInputContextActionWorkspace = this.mutation({
|
|
306
|
+
name: 'clearInputContextActionWorkspace',
|
|
307
|
+
request: async (signal, variables: Parameters<typeof contextControllerclearActionContextInWorkspace>[0]) =>
|
|
308
|
+
contextControllerclearActionContextInWorkspace(variables, { signal }),
|
|
309
|
+
permission: async ({ stackVersionId, workspaceId, actionVersionId }: Parameters<typeof contextControllerclearActionContextInWorkspace>[0]) =>
|
|
310
|
+
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'action', workspaceId, stackVersionId, externalId: actionVersionId }),
|
|
311
|
+
})
|
|
312
|
+
/**
|
|
313
|
+
* Update context inputs from an action in account
|
|
314
|
+
*/
|
|
315
|
+
updateInputContextActionAccount = this.mutation({
|
|
316
|
+
name: 'updateInputContextActionAccount',
|
|
317
|
+
request: async (signal, variables: Parameters<typeof contextControllerupsertAccountActionsInputContext>[0]) =>
|
|
318
|
+
contextControllerupsertAccountActionsInputContext(variables, { signal }),
|
|
319
|
+
permission: async ({ stackVersionId, actionVersionId }: Parameters<typeof contextControllerupsertAccountActionsInputContext>[0]) =>
|
|
320
|
+
workspaceClient.saveContextInAccount.isAllowed({ $type: 'action', stackVersionId, externalId: actionVersionId }),
|
|
321
|
+
})
|
|
322
|
+
/**
|
|
323
|
+
* Clear context inputs from an action in account
|
|
324
|
+
*/
|
|
325
|
+
clearInputContextActionAccount = this.mutation({
|
|
326
|
+
name: 'clearInputContextActionAccount',
|
|
327
|
+
request: async (signal, variables: Parameters<typeof contextControllerclearActionContextInAccount>[0]) =>
|
|
328
|
+
contextControllerclearActionContextInAccount(variables, { signal }),
|
|
329
|
+
permission: async ({ stackVersionId, actionVersionId }: Parameters<typeof contextControllerclearActionContextInAccount>[0]) =>
|
|
330
|
+
workspaceClient.saveContextInAccount.isAllowed({ $type: 'action', stackVersionId, externalId: actionVersionId }),
|
|
331
|
+
})
|
|
332
|
+
/**
|
|
333
|
+
* Gets details of an application in an environment
|
|
334
|
+
*/
|
|
335
|
+
applicationDetails = this.query({
|
|
336
|
+
name: 'applicationDetails',
|
|
337
|
+
request: async (signal, variables: Parameters<typeof applicationControllergetApplicationDetails>[0]) => applicationControllergetApplicationDetails(variables, { signal }),
|
|
338
|
+
permission: async ({ applicationId, workspaceId }: Parameters<typeof applicationControllergetApplicationDetails>[0]) =>
|
|
339
|
+
workspaceClient.applicationDetail.isAllowed({ applicationId, workspaceId }),
|
|
340
|
+
})
|
|
341
|
+
/**
|
|
342
|
+
* Deletes an application
|
|
343
|
+
*/
|
|
344
|
+
deleteApplication = this.mutation({
|
|
345
|
+
name: 'deleteApplication',
|
|
346
|
+
request: async (signal, variables: Parameters<typeof managerRunControllerdeleteApplication>[0]) => managerRunControllerdeleteApplication(variables, { signal }),
|
|
347
|
+
permission: async (variables: Parameters<typeof managerRunControllerdeleteApplication>[0]) =>
|
|
348
|
+
workspaceClient.deleteApplication.isAllowed(variables),
|
|
349
|
+
})
|
|
350
|
+
/**
|
|
351
|
+
* Gets details of a shared infra in an environment
|
|
352
|
+
*/
|
|
353
|
+
sharedInfraDetails = this.query({
|
|
354
|
+
name: 'sharedInfraDetails',
|
|
355
|
+
request: async (signal, variables: Parameters<typeof sharedInfraControllergetSharedInfraAppliedPlugins>[0]) => sharedInfraControllergetSharedInfraAppliedPlugins(variables, { signal }),
|
|
356
|
+
permission: async ({ sharedInfraId, workspaceId }: Parameters<typeof sharedInfraControllergetSharedInfraAppliedPlugins>[0]) =>
|
|
357
|
+
workspaceClient.infraDetail.isAllowed({ sharedInfraId, workspaceId }),
|
|
358
|
+
})
|
|
359
|
+
/**
|
|
360
|
+
* Deletes an infra
|
|
361
|
+
*/
|
|
362
|
+
deleteInfra = this.mutation({
|
|
363
|
+
name: 'deleteInfra',
|
|
364
|
+
request: async (signal, variables: Parameters<typeof managerRunControllerdeleteSharedInfra>[0]) => managerRunControllerdeleteSharedInfra(variables, { signal }),
|
|
365
|
+
permission: async (variables: Parameters<typeof managerRunControllerdeleteSharedInfra>[0]) =>
|
|
366
|
+
workspaceClient.deleteInfra.isAllowed(variables),
|
|
367
|
+
})
|
|
368
|
+
/**
|
|
369
|
+
* Gets activities of a shared infra
|
|
370
|
+
*/
|
|
371
|
+
activitiesSharedInfra = this.infiniteQuery(sharedInfraControllerV2GetSharedInfraActivities as unknown as ReplaceResult<typeof sharedInfraControllerV2GetSharedInfraActivities, FixedPaginatedActivityResponse>,
|
|
372
|
+
{ accumulator: 'items', initialPageParam: 0 })
|
|
373
|
+
/**
|
|
374
|
+
* Gets activities of an application
|
|
375
|
+
*/
|
|
376
|
+
activitiesApplication = this.infiniteQuery(applicationControllerV2GetApplicationActivities as unknown as ReplaceResult<typeof applicationControllerV2GetApplicationActivities, FixedPaginatedActivityResponse>,
|
|
377
|
+
{ accumulator: 'items', initialPageParam: 0 })
|
|
378
|
+
/**
|
|
379
|
+
* Updates Stacks To Latest Version By Workspace
|
|
380
|
+
*/
|
|
381
|
+
updateStacksToLatestVersionByWorkspace = this.mutation(workspaceStackControllerrefreshStacksInWorkspace)
|
|
382
|
+
/**
|
|
383
|
+
* Get all workspaces with pagination
|
|
384
|
+
*/
|
|
385
|
+
workspacesWithPagination = this.infiniteQuery(workspaceControllergetWorkspaces, { accumulator: 'items', initialPageParam: 0 })
|
|
386
|
+
/**
|
|
387
|
+
* Get all applications by workspace with pagination
|
|
388
|
+
*/
|
|
389
|
+
applicationsByWorkspaceWithPagination = this.query(applicationControllergetApplications)
|
|
390
|
+
/**
|
|
391
|
+
* Get all shared infra by workspace with pagination
|
|
392
|
+
*/
|
|
393
|
+
sharedInfraByWorkspaceWithPagination = this.query(sharedInfraControllergetSharedInfra)
|
|
394
|
+
/**
|
|
395
|
+
* Get all stacks used to create application in a workspace
|
|
396
|
+
*/
|
|
397
|
+
filterStacksFromApplicationInWorkspace = this.query(applicationControllergetApplicationFilters)
|
|
398
|
+
/**
|
|
399
|
+
* Get all stacks used to create infra in a workspace.
|
|
400
|
+
*/
|
|
401
|
+
filterStacksFromInfraInWorkspace = this.query(sharedInfraControllergetSharedInfraFilters)
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Get all workspaces associated with an account.
|
|
405
|
+
*/
|
|
406
|
+
getAccountWorkspaces = this.query(workspaceControllergetWorkspaces)
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Get all applications associated with an account.
|
|
410
|
+
*/
|
|
411
|
+
getAccountApplications = this.infiniteQuery(accountApplicationControllergetAccountApplicationPage, { accumulator: 'items', initialPageParam: { page: 0 } })
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Get all shared infrastructures associated with an account.
|
|
415
|
+
*/
|
|
416
|
+
getAccountSharedInfra = this.query(accountSharedInfraControllergetAccountSharedInfraPage)
|
|
417
|
+
|
|
418
|
+
/** * Gets filters for applications associated with an account. */
|
|
419
|
+
getAccountApplicationsFilters = this.query(accountApplicationControllergetAccountApplicationsFilters)
|
|
420
|
+
|
|
421
|
+
/** * Gets filters for shared infrastructures associated with an account. */
|
|
422
|
+
getAccountSharedInfraFilters = this.query(accountSharedInfraControllergetAccountSharedInfraFilters)
|
|
423
|
+
|
|
424
|
+
// Variables Account
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Find all account variables
|
|
428
|
+
*/
|
|
429
|
+
accountVariables = this.query(accountVariableControllerfindAll)
|
|
430
|
+
/**
|
|
431
|
+
* Get an account variable by name
|
|
432
|
+
*/
|
|
433
|
+
getAccountVariable = this.query(accountVariableControllerfindByName)
|
|
434
|
+
/**
|
|
435
|
+
* Get account variable usage
|
|
436
|
+
*/
|
|
437
|
+
accountVariableUsage = this.query(accountVariableControllerusage)
|
|
438
|
+
/**
|
|
439
|
+
* Create account variable
|
|
440
|
+
*/
|
|
441
|
+
createAccountVariable = this.mutation(accountVariableControllercreate)
|
|
442
|
+
/**
|
|
443
|
+
* Update account variable
|
|
444
|
+
*/
|
|
445
|
+
updateAccountVariable = this.mutation(accountVariableControllerupdate)
|
|
446
|
+
/**
|
|
447
|
+
* Delete account variable
|
|
448
|
+
*/
|
|
449
|
+
deleteAccountVariable = this.mutation(accountVariableControllerdelete)
|
|
450
|
+
|
|
451
|
+
// Variables Workspace
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Find all workspace variables
|
|
455
|
+
*/
|
|
456
|
+
workspaceVariables = this.query(workspaceVariableControllerfindAll)
|
|
457
|
+
/**
|
|
458
|
+
* Get a workspace variable by name
|
|
459
|
+
*/
|
|
460
|
+
getWorkspaceVariable = this.query(workspaceVariableControllerfindByName)
|
|
461
|
+
/**
|
|
462
|
+
* Updates workspace variable based on existing account variable
|
|
463
|
+
*/
|
|
464
|
+
updateWorkspaceVariable = this.mutation(workspaceVariableControllerupsert)
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
// Update Infra Plugins
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Get available branches on the App repo.
|
|
471
|
+
*/
|
|
472
|
+
getAppAvailableBranches = this.query(updateInfrastructureControllergetApplicationBranches)
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Get available branches on the Infra repo.
|
|
476
|
+
*/
|
|
477
|
+
getInfraAvailableBranches = this.query(updateInfrastructureControllergetSharedInfraBranches)
|
|
478
|
+
/**
|
|
479
|
+
* Get current branch App infra plugins state
|
|
480
|
+
*/
|
|
481
|
+
getAppInfraPluginsToUpdate = this.query(updateInfrastructureControllergetApplicationInfraPlugins)
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
|
+
* Get current branch Infra plugins state
|
|
485
|
+
*/
|
|
486
|
+
getInfraPluginsToUpdate = this.query(updateInfrastructureControllergetSharedInfraInfraPlugins)
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Updates plugins within an Infra
|
|
490
|
+
*/
|
|
491
|
+
updateInfraPlugins = this.mutation(updateInfrastructureControllerupdateInfraPluginsAndCreatePullRequestBySharedInfra)
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Updates infra plugins within an App
|
|
495
|
+
*/
|
|
496
|
+
updateAppInfraPlugins = this.mutation(updateInfrastructureControllerupdateInfraPluginsAndCreatePullRequestByApplication)
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Gets infra dependencies
|
|
500
|
+
*/
|
|
501
|
+
getInfraDependencies = this.query(sharedInfraControllergetSharedInfraDependencies)
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Gets app dependencies
|
|
505
|
+
*/
|
|
506
|
+
getAppDependencies = this.query(applicationControllergetApplicationDependencies)
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* Destroys an application
|
|
510
|
+
*/
|
|
511
|
+
destroyApp = this.mutation(applicationControllerregistryAppDestroy)
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Destroys an infrastructure
|
|
515
|
+
*/
|
|
516
|
+
destroyInfra = this.mutation(updateInfrastructureControllerremoveInfraPluginsAndCreatePullRequestBySharedInfra)
|
|
517
|
+
/**
|
|
518
|
+
* Destroys an application's infrastructure
|
|
519
|
+
*/
|
|
520
|
+
destroyAppInfra = this.mutation(updateInfrastructureControllerremoveInfraPluginsAndCreatePullRequestByApplication)
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Update context inputs from an workflow in workspace
|
|
524
|
+
*/
|
|
525
|
+
updateInputContextWorkflowWorkspace = this.mutation({
|
|
526
|
+
name: 'updateInputContextWorkflowWorkspace',
|
|
527
|
+
request: async (signal, variables: Parameters<typeof contextControllerupsertWorkflowWorkspaceContext>[0]) =>
|
|
528
|
+
contextControllerupsertWorkflowWorkspaceContext(variables, { signal }),
|
|
529
|
+
permission: async ({ stackVersionId, workspaceId, workflowVersionId }: Parameters<typeof contextControllerupsertWorkflowWorkspaceContext>[0]) =>
|
|
530
|
+
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'workflow', workspaceId, stackVersionId, externalId: workflowVersionId }),
|
|
531
|
+
})
|
|
532
|
+
/**
|
|
533
|
+
* Update context inputs from an workflow in account
|
|
534
|
+
*/
|
|
535
|
+
updateInputContextWorkflowAccount = this.mutation({
|
|
536
|
+
name: 'updateInputContextWorkflowAccount',
|
|
537
|
+
request: async (signal, variables: Parameters<typeof contextControllerupsertWorkflowAccountContext>[0]) =>
|
|
538
|
+
contextControllerupsertWorkflowAccountContext(variables, { signal }),
|
|
539
|
+
permission: async ({ stackVersionId, workflowVersionId }: Parameters<typeof contextControllerupsertWorkflowAccountContext>[0]) =>
|
|
540
|
+
workspaceClient.saveContextInAccount.isAllowed({ $type: 'workflow', stackVersionId, externalId: workflowVersionId }),
|
|
541
|
+
})
|
|
542
|
+
/**
|
|
543
|
+
* Get Stacks with context
|
|
544
|
+
*/
|
|
545
|
+
stacksWithContext = this.query(workspaceStackControllerlistStacksContext)
|
|
546
|
+
/**
|
|
547
|
+
* Import context of stack in Workspace
|
|
548
|
+
*/
|
|
549
|
+
importContextStackInWokspace = this.mutation(contextControllerimportContextInWorkspace)
|
|
550
|
+
/**
|
|
551
|
+
* Import context of stack in Account
|
|
552
|
+
*/
|
|
553
|
+
importContextStackInAccount = this.mutation(contextControllerimportContextInAccount)
|
|
554
|
+
/**
|
|
555
|
+
* Get list of versions with context of stack
|
|
556
|
+
*/
|
|
557
|
+
getStacksVersionWithContext = this.query(accountStackControllerlistVersionsWithContext)
|
|
558
|
+
/**
|
|
559
|
+
* Receives a list of workspace id's and returns that workspaces detailed
|
|
560
|
+
*/
|
|
561
|
+
workspacesFilterById = this.mutation(workspaceControllergetWorkspacesSummary)
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export const workspaceManagerClient = new WorkspaceManagerClient()
|