@stack-spot/portal-network 0.27.2 → 0.28.0-beta
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 +8 -0
- package/dist/api/apiManagement.d.ts +289 -0
- package/dist/api/apiManagement.d.ts.map +1 -0
- package/dist/api/apiManagement.js +143 -0
- package/dist/api/apiManagement.js.map +1 -0
- package/dist/api/workspace.d.ts +320 -216
- package/dist/api/workspace.d.ts.map +1 -1
- package/dist/api/workspace.js +255 -184
- package/dist/api/workspace.js.map +1 -1
- package/dist/api/workspaceManager.d.ts +320 -218
- package/dist/api/workspaceManager.d.ts.map +1 -1
- package/dist/api/workspaceManager.js +68 -20
- package/dist/api/workspaceManager.js.map +1 -1
- package/dist/apis.json +8 -8
- package/dist/client/content.d.ts +52 -0
- package/dist/client/content.d.ts.map +1 -1
- package/dist/client/content.js +64 -1
- package/dist/client/content.js.map +1 -1
- package/dist/client/notification.d.ts +1 -1
- package/dist/client/types.d.ts +29 -0
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workspace-manager.d.ts +121 -0
- package/dist/client/workspace-manager.d.ts.map +1 -0
- package/dist/client/workspace-manager.js +204 -0
- package/dist/client/workspace-manager.js.map +1 -0
- package/dist/client/workspace.d.ts +105 -22
- package/dist/client/workspace.d.ts.map +1 -1
- package/dist/client/workspace.js +156 -74
- package/dist/client/workspace.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/network/ManualOperation.js +1 -1
- package/package.json +1 -1
- package/src/api/apiManagement.ts +498 -0
- package/src/api/workspace.ts +497 -288
- package/src/api/workspaceManager.ts +402 -234
- package/src/apis.json +8 -8
- package/src/client/content.ts +42 -2
- package/src/client/types.ts +38 -0
- package/src/client/workspace-manager.ts +171 -0
- package/src/client/workspace.ts +180 -123
- package/src/index.ts +1 -1
- package/src/network/ManualOperation.ts +1 -1
package/src/apis.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": {
|
|
12
12
|
"dev": "https://workspace-workspace-api.dev.stackspot.com",
|
|
13
13
|
"stg": "https://workspace-workspace-api.stg.stackspot.com",
|
|
14
|
-
"prd": "https://workspace.
|
|
14
|
+
"prd": "https://workspace.stackspot.com"
|
|
15
15
|
},
|
|
16
16
|
"docs": "/v3/api-docs"
|
|
17
17
|
},
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": {
|
|
20
20
|
"dev": "https://account-account-api.dev.stackspot.com",
|
|
21
21
|
"stg": "https://account-account-api.stg.stackspot.com",
|
|
22
|
-
"prd": "https://account.
|
|
22
|
+
"prd": "https://account.stackspot.com"
|
|
23
23
|
},
|
|
24
24
|
"docs": "/v3/api-docs"
|
|
25
25
|
},
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"url": {
|
|
28
28
|
"dev": "https://content-content-api.dev.stackspot.com",
|
|
29
29
|
"stg": "https://content-content-api.stg.stackspot.com",
|
|
30
|
-
"prd": "https://content-api.
|
|
30
|
+
"prd": "https://content-api.stackspot.com"
|
|
31
31
|
},
|
|
32
32
|
"docs": "/v3/api-docs"
|
|
33
33
|
},
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"url": {
|
|
44
44
|
"dev": "https://catalog-tech-products-catalog-api.dev.stackspot.com",
|
|
45
45
|
"stg": "https://catalog-tech-products-catalog-api.stg.stackspot.com",
|
|
46
|
-
"prd": "https://catalog-api.
|
|
46
|
+
"prd": "https://catalog-api.stackspot.com"
|
|
47
47
|
},
|
|
48
48
|
"docs": "/v3/api-docs"
|
|
49
49
|
},
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"url": {
|
|
52
52
|
"dev": "https://runtime-manager.dev.stackspot.com",
|
|
53
53
|
"stg": "https://runtime-manager.stg.stackspot.com",
|
|
54
|
-
"prd": "https://runtime-manager.
|
|
54
|
+
"prd": "https://runtime-manager.stackspot.com"
|
|
55
55
|
},
|
|
56
56
|
"docs": "/v3/api-docs"
|
|
57
57
|
},
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"url": {
|
|
92
92
|
"dev": "https://workflow-workflow-api.dev.stackspot.com",
|
|
93
93
|
"stg": "https://workflow-workflow-api.stg.stackspot.com",
|
|
94
|
-
"prd": "https://workflow-api.
|
|
94
|
+
"prd": "https://workflow-api.stackspot.com"
|
|
95
95
|
},
|
|
96
96
|
"docs": "/openapi.json"
|
|
97
97
|
},
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"url": {
|
|
100
100
|
"dev": "https://workspace-workspace-manager.dev.stackspot.com",
|
|
101
101
|
"stg": "https://workspace-workspace-manager.stg.stackspot.com",
|
|
102
|
-
"prd": "https://workspace-manager.
|
|
102
|
+
"prd": "https://workspace-manager.stackspot.com"
|
|
103
103
|
},
|
|
104
104
|
"docs": "/v3/api-docs"
|
|
105
105
|
},
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"url": {
|
|
131
131
|
"dev": "https://workspace-workspace-secrets-api.dev.stackspot.com",
|
|
132
132
|
"stg": "https://workspace-workspace-secrets-api.stg.stackspot.com",
|
|
133
|
-
"prd": "https://secrets-api.
|
|
133
|
+
"prd": "https://secrets-api.stackspot.com"
|
|
134
134
|
},
|
|
135
135
|
"docs": "/v3/api-docs"
|
|
136
136
|
},
|
package/src/client/content.ts
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
addLink, addWorkspace, changeVisibility, createStudio, defaults, deleteLink, deleteStudio, delWorkspace,
|
|
4
|
+
getStackVersionListByIds, getStudioByIdOrSlug, getStudios1, getStudiosToCreateButton, getStudioTabs,
|
|
5
|
+
listConnectionInterfaceTypes, listLinksByStackVersion, listPluginVersionByIdsController, listReasons,
|
|
6
|
+
listWorkspaces, stackModalViewSummary, getListOfInputs, updateStudio, updateStudioTabs, deleteV1StacksVersionsByStackVersionId,
|
|
7
|
+
getStackWorkspaces, getStackWorkspaceDetailView, getUnusedStackVersions, getPluginModalView, getStackUsesPlugin,
|
|
8
|
+
getGetPluginView, getPluginInfrastructureView, getApplicationsUsesPlugin, getStarterUsesPlugin, getPluginVersionsNotInUse,
|
|
9
|
+
getPluginVersions, getDependentPluginsVersions, getStarterStackVersionsAndPluginsVersions, getInfrastructureEnvironmentsUsesPlugin,
|
|
10
|
+
getApplicationDetailsView, stackVersionUsageSummary, deprecateStackVersionBy, getPluginVersionUsageSummary, deprecatePluginVersion,
|
|
11
|
+
deletePluginVersion, patchStarterV2, listPlugins,
|
|
12
|
+
getActionsVersions, listStarters, listStacksByFilters,
|
|
13
|
+
} from '../api/content'
|
|
3
14
|
import apis from '../apis.json'
|
|
4
15
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
5
16
|
import { cntDictionary } from '../error/dictionary/cnt'
|
|
6
17
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
7
18
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
8
19
|
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
20
|
+
import { OperationObject } from '../network/types'
|
|
9
21
|
|
|
10
22
|
class ContentClient extends ReactQueryNetworkClient {
|
|
11
23
|
constructor() {
|
|
@@ -83,7 +95,10 @@ class ContentClient extends ReactQueryNetworkClient {
|
|
|
83
95
|
* Gets content deprecation reasons
|
|
84
96
|
*/
|
|
85
97
|
deprecationReasons = this.query(listReasons)
|
|
86
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Gets stacks from a given studio
|
|
100
|
+
*/
|
|
101
|
+
stacksFromStudios = this.query(listStacksByFilters)
|
|
87
102
|
/**
|
|
88
103
|
* Get usage summary of stack
|
|
89
104
|
*/
|
|
@@ -176,6 +191,31 @@ class ContentClient extends ReactQueryNetworkClient {
|
|
|
176
191
|
* Update starter
|
|
177
192
|
*/
|
|
178
193
|
updateStarter = this.mutation(patchStarterV2)
|
|
194
|
+
/**
|
|
195
|
+
* Gets connection interface types
|
|
196
|
+
*/
|
|
197
|
+
connectionInterfaceTypes = this.query(listConnectionInterfaceTypes)
|
|
198
|
+
/**
|
|
199
|
+
* Gets a list of plugin versions from list of ids.
|
|
200
|
+
*/
|
|
201
|
+
pluginVersionsByIds = this.query(listPluginVersionByIdsController)
|
|
202
|
+
/**
|
|
203
|
+
* Gets plugins from a stack version
|
|
204
|
+
*/
|
|
205
|
+
listPluginsFromStack = this.query(listPlugins)
|
|
206
|
+
/**
|
|
207
|
+
* Gets the inputs of a specific Action. This fn is only used for permission purposes.
|
|
208
|
+
*/
|
|
209
|
+
actionInputs = this.query(getListOfInputs) as
|
|
210
|
+
OperationObject<Parameters<typeof getListOfInputs>[0]>
|
|
211
|
+
/**
|
|
212
|
+
* Gets action versions by ids
|
|
213
|
+
*/
|
|
214
|
+
actionsVersions = this.query(getActionsVersions)
|
|
215
|
+
/**
|
|
216
|
+
* Gets all starters from a stack version id
|
|
217
|
+
*/
|
|
218
|
+
startersInStackVersion = this.query(listStarters)
|
|
179
219
|
}
|
|
180
220
|
|
|
181
221
|
export const contentClient = new ContentClient()
|
package/src/client/types.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { RequestOpts } from '@oazapfts/runtime'
|
|
|
2
2
|
import { AccountScmInfoSaveRequest, AccountScmInfoUpdateRequest, AccountScmStatusResponse } from '../api/account'
|
|
3
3
|
import { ConnectAccountRequestV2, ManagedAccountProvisionRequest } from '../api/cloudAccount'
|
|
4
4
|
import { AllocationCostRequest, AllocationCostResponse, ChargePeriod, getAllocationCostFilters, ManagedService, ServiceResource } from '../api/cloudServices'
|
|
5
|
+
import { FullInputContextResponse, InputConditionResponse, InputValuesContextResponse, PluginForAppCreationV2Response, PluginInputValuesInConsolidatedContextResponse, ValueByEnvResponse } from '../api/workspaceManager'
|
|
5
6
|
|
|
6
7
|
interface BaseSMCStatus {
|
|
7
8
|
/**
|
|
@@ -116,6 +117,43 @@ export interface FixedManagedAccountProvisionRequest extends Omit<ManagedAccount
|
|
|
116
117
|
workspaceId: string,
|
|
117
118
|
}
|
|
118
119
|
|
|
120
|
+
export interface FixedPluginForAppCreationV2Response extends Omit<PluginForAppCreationV2Response, 'inputs'> {
|
|
121
|
+
inputs: FixedPluginInputValuesInConsolidatedContextResponse[],
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export type InputType = 'BOOL' | 'INT' | 'MULTISELECT' | 'OBJECT' | 'LIST' | 'REQUIRED-CONNECTION' | 'PASSWORD' | 'SELECT' | 'TEXT'
|
|
125
|
+
|
|
126
|
+
export interface FixedInputConditionResponse extends Omit<InputConditionResponse, 'value'> {
|
|
127
|
+
value?: any,
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface FixedValueByEnvResponse extends Omit<ValueByEnvResponse, 'value'> {
|
|
131
|
+
value: any,
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface FixedInputValuesContextResponse extends Omit<InputValuesContextResponse,
|
|
135
|
+
'inputs' | 'input' | 'type' | 'default' | 'condition' | 'valuesByEnv'> {
|
|
136
|
+
inputs: Omit<FixedInputValuesContextResponse, 'valuesByEnv'>[],
|
|
137
|
+
input?: Omit<FixedInputValuesContextResponse, 'valuesByEnv'>,
|
|
138
|
+
type: InputType,
|
|
139
|
+
default?: any,
|
|
140
|
+
condition?: FixedInputConditionResponse,
|
|
141
|
+
valuesByEnv: FixedValueByEnvResponse[],
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface FixedFullInputContextResponse extends Omit<FullInputContextResponse, 'inputs'> {
|
|
145
|
+
inputs: FixedInputValuesContextResponse[],
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface FixedPluginInputValuesInConsolidatedContextResponse extends
|
|
149
|
+
Omit<PluginInputValuesInConsolidatedContextResponse, 'inputs' | 'input' | 'type' | 'default' | 'condition'> {
|
|
150
|
+
inputs: FixedInputValuesContextResponse[],
|
|
151
|
+
input?: FixedInputValuesContextResponse,
|
|
152
|
+
type: InputType,
|
|
153
|
+
default?: any,
|
|
154
|
+
condition?: FixedInputConditionResponse,
|
|
155
|
+
}
|
|
156
|
+
|
|
119
157
|
export type OazapftsFunction<Variables = any, Result = any> = (variables: Variables, opts?: RequestOpts) => Promise<Result>
|
|
120
158
|
|
|
121
159
|
type Unpromisify<T> = T extends Promise<infer R> ? Unpromisify<R> : T
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
import { HttpError } from '@oazapfts/runtime'
|
|
3
|
+
import {
|
|
4
|
+
defaults,
|
|
5
|
+
getAccountPluginInputs,
|
|
6
|
+
getApplicationAppliedPlugins,
|
|
7
|
+
getConsolidatedPluginInputs,
|
|
8
|
+
getSharedInfraAppliedPlugins,
|
|
9
|
+
listStacks1,
|
|
10
|
+
getStackActionInputsInWorkspaceContext,
|
|
11
|
+
getStackActionInputsInAccountContext,
|
|
12
|
+
upsertWorkspaceActionsInputContext,
|
|
13
|
+
upsertAccountActionsInputContext,
|
|
14
|
+
upsertPluginWorkspaceContext,
|
|
15
|
+
upsertPluginAccountContext,
|
|
16
|
+
getConsolidatedPluginInputsWithConnectionInterfaces,
|
|
17
|
+
listWorkflowByStackIdAndWorkflowType,
|
|
18
|
+
} from '../api/workspaceManager'
|
|
19
|
+
import apis from '../apis.json'
|
|
20
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
21
|
+
import { workspaceDictionary } from '../error/dictionary/workspace'
|
|
22
|
+
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
23
|
+
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
24
|
+
import { contentClient } from './content'
|
|
25
|
+
import { FixedFullInputContextResponse, FixedPluginForAppCreationV2Response, ReplaceResult } from './types'
|
|
26
|
+
import { workspaceClient } from './workspace'
|
|
27
|
+
|
|
28
|
+
class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(apis.workspaceManager.url, defaults)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
34
|
+
return new DefaultAPIError(error.data, error.status, workspaceDictionary, error.headers)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Gets all stacks in a workspace
|
|
39
|
+
*/
|
|
40
|
+
stacksInWorkspace = this.query({
|
|
41
|
+
name: 'stacksInWorkspace',
|
|
42
|
+
request: async (signal, variables: Parameters<typeof listStacks1>[0]) => listStacks1(variables, { signal }),
|
|
43
|
+
permission: async (variables: Parameters<typeof listStacks1>[0]) => {
|
|
44
|
+
const contentStacksPermission = await contentClient.allStackVersionByIds.isAllowed()
|
|
45
|
+
const workspaceStacksPermission = await workspaceClient.stacks.isAllowed(variables)
|
|
46
|
+
return workspaceStacksPermission && contentStacksPermission
|
|
47
|
+
},
|
|
48
|
+
})
|
|
49
|
+
/**
|
|
50
|
+
* Gets inputs from a plugin in a workspace stack
|
|
51
|
+
*/
|
|
52
|
+
pluginInputsInWorkspace = this.query({
|
|
53
|
+
name: 'pluginInputsInWorkspace',
|
|
54
|
+
request: async (signal, variables: Parameters<typeof getConsolidatedPluginInputs>[0]) => {
|
|
55
|
+
const data = await getConsolidatedPluginInputs(variables, { signal })
|
|
56
|
+
return data as FixedFullInputContextResponse
|
|
57
|
+
},
|
|
58
|
+
permission: async ({ workspaceId, stackVersionId }: Parameters<typeof getConsolidatedPluginInputs>[0]) => {
|
|
59
|
+
const canViewContext = await workspaceClient.listConsolidatedWorkspaceContext.isAllowed({ $type: 'plugin', workspaceId, stackVersionId })
|
|
60
|
+
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
61
|
+
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
62
|
+
return canViewContext && canGetConnectionInterfaceTypes && canGetPluginVersions
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
/**
|
|
66
|
+
* Gets inputs from a plugin in account context
|
|
67
|
+
*/
|
|
68
|
+
pluginInputsAccount = this.query({
|
|
69
|
+
name: 'pluginInputsAccount',
|
|
70
|
+
request: async (signal, variables: Parameters<typeof getAccountPluginInputs>[0]) => {
|
|
71
|
+
const data = await getAccountPluginInputs(variables, { signal })
|
|
72
|
+
return data as FixedFullInputContextResponse
|
|
73
|
+
},
|
|
74
|
+
permission: async ({ stackVersionId }: Parameters<typeof getAccountPluginInputs>[0]) => {
|
|
75
|
+
const canViewContext = await workspaceClient.listConsolidatedContext.isAllowed({ $type: 'plugin', stackVersionId })
|
|
76
|
+
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
77
|
+
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
78
|
+
return canViewContext && canGetConnectionInterfaceTypes && canGetPluginVersions
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
/**
|
|
82
|
+
* Update context inputs from an action in workspace
|
|
83
|
+
*/
|
|
84
|
+
updateInputContextPluginWorkspace = this.mutation({
|
|
85
|
+
name: 'updateInputContextPluginWorkspace',
|
|
86
|
+
request: async (signal, variables: Parameters<typeof upsertPluginWorkspaceContext>[0]) =>
|
|
87
|
+
upsertPluginWorkspaceContext(variables, { signal }),
|
|
88
|
+
permission: async ({ stackVersionId, workspaceId, pluginVersionId }: Parameters<typeof upsertPluginWorkspaceContext>[0]) =>
|
|
89
|
+
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'plugin', workspaceId, stackVersionId, externalId: pluginVersionId }),
|
|
90
|
+
})
|
|
91
|
+
/**
|
|
92
|
+
* Update context inputs from an action in account
|
|
93
|
+
*/
|
|
94
|
+
updateInputContextPluginAccount = this.mutation({
|
|
95
|
+
name: 'updateInputContextPluginAccount',
|
|
96
|
+
request: async (signal, variables: Parameters<typeof upsertPluginAccountContext>[0]) =>
|
|
97
|
+
upsertPluginAccountContext(variables, { signal }),
|
|
98
|
+
permission: async ({ stackVersionId, pluginVersionId }: Parameters<typeof upsertPluginAccountContext>[0]) =>
|
|
99
|
+
workspaceClient.saveContextInAccount.isAllowed({ $type: 'plugin', stackVersionId, externalId: pluginVersionId }),
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Gets applied plugins in shared infra
|
|
104
|
+
*/
|
|
105
|
+
appliedPluginsSharedInfra = this.query(getSharedInfraAppliedPlugins)
|
|
106
|
+
/**
|
|
107
|
+
* Gets applied plugins in application
|
|
108
|
+
*/
|
|
109
|
+
appliedPluginsApplication = this.query(getApplicationAppliedPlugins)
|
|
110
|
+
/**
|
|
111
|
+
* Gets plugin inputs and connection interface from a plugin in a stack version in workspace
|
|
112
|
+
*/
|
|
113
|
+
pluginInputsWithConnectionInterfaces = this.query(getConsolidatedPluginInputsWithConnectionInterfaces as unknown as ReplaceResult<typeof getConsolidatedPluginInputsWithConnectionInterfaces, FixedPluginForAppCreationV2Response>)
|
|
114
|
+
/**
|
|
115
|
+
* Gets workflows from a given stack and workflow type
|
|
116
|
+
*/
|
|
117
|
+
workflowsByStackIdAndWorkflowType = this.query(listWorkflowByStackIdAndWorkflowType)
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Gets inputs from an action in a workspace
|
|
121
|
+
*/
|
|
122
|
+
actionInputsInWorkspace = this.query({
|
|
123
|
+
name: 'actionInputsInWorkspace',
|
|
124
|
+
request: async (signal, variables: Parameters<typeof getStackActionInputsInWorkspaceContext>[0]) => {
|
|
125
|
+
const data = await getStackActionInputsInWorkspaceContext(variables, { signal })
|
|
126
|
+
return data as FixedFullInputContextResponse
|
|
127
|
+
},
|
|
128
|
+
permission: async ({ workspaceId, stackVersionId, actionsVersionId }: Parameters<typeof getStackActionInputsInWorkspaceContext>[0]) => {
|
|
129
|
+
const canViewContext = await workspaceClient.listConsolidatedWorkspaceContext.isAllowed({ $type: 'action', workspaceId, stackVersionId })
|
|
130
|
+
const canGetActionInput = await contentClient.actionInputs.isAllowed({ actionVersionId: actionsVersionId })
|
|
131
|
+
return canViewContext && canGetActionInput
|
|
132
|
+
},
|
|
133
|
+
})
|
|
134
|
+
/**
|
|
135
|
+
* Gets inputs from an action in account context
|
|
136
|
+
*/
|
|
137
|
+
actionInputsAccount = this.query({
|
|
138
|
+
name: 'actionInputsFromStack',
|
|
139
|
+
request: async (signal, variables: Parameters<typeof getStackActionInputsInAccountContext>[0]) => {
|
|
140
|
+
const data = await getStackActionInputsInAccountContext(variables, { signal })
|
|
141
|
+
return data as FixedFullInputContextResponse
|
|
142
|
+
},
|
|
143
|
+
permission: async ({ stackVersionId, actionsVersionId }: Parameters<typeof getStackActionInputsInAccountContext>[0]) => {
|
|
144
|
+
const canViewContext = await workspaceClient.listConsolidatedContext.isAllowed({ $type: 'action', stackVersionId })
|
|
145
|
+
const canGetActionInput = await contentClient.actionInputs.isAllowed({ actionVersionId: actionsVersionId })
|
|
146
|
+
return canViewContext && canGetActionInput
|
|
147
|
+
},
|
|
148
|
+
})
|
|
149
|
+
/**
|
|
150
|
+
* Update context inputs from an action in workspace
|
|
151
|
+
*/
|
|
152
|
+
updateInputContextActionWorkspace = this.mutation({
|
|
153
|
+
name: 'updateInputContextActionWorkspace',
|
|
154
|
+
request: async (signal, variables: Parameters<typeof upsertWorkspaceActionsInputContext>[0]) =>
|
|
155
|
+
upsertWorkspaceActionsInputContext(variables, { signal }),
|
|
156
|
+
permission: async ({ stackVersionId, workspaceId, actionVersionId }: Parameters<typeof upsertWorkspaceActionsInputContext>[0]) =>
|
|
157
|
+
workspaceClient.saveContextInWorkspace.isAllowed({ $type: 'action', workspaceId, stackVersionId, externalId: actionVersionId }),
|
|
158
|
+
})
|
|
159
|
+
/**
|
|
160
|
+
* Update context inputs from an action in account
|
|
161
|
+
*/
|
|
162
|
+
updateInputContextActionAccount = this.mutation({
|
|
163
|
+
name: 'updateInputContextActionAccount',
|
|
164
|
+
request: async (signal, variables: Parameters<typeof upsertAccountActionsInputContext>[0]) =>
|
|
165
|
+
upsertAccountActionsInputContext(variables, { signal }),
|
|
166
|
+
permission: async ({ stackVersionId, actionVersionId }: Parameters<typeof upsertAccountActionsInputContext>[0]) =>
|
|
167
|
+
workspaceClient.saveContextInAccount.isAllowed({ $type: 'action', stackVersionId, externalId: actionVersionId }),
|
|
168
|
+
})
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export const workspaceManagerClient = new WorkspaceManagerClient()
|