@stack-spot/portal-network 0.30.1 → 0.32.0

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.
@@ -1,5 +1,16 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
- import { addAction, addLink, addWorkspace, associateActionToPlugin, changeVisibility, createStudio, defaults, deleteAction, deleteActionVersion, deleteLink, deletePluginVersion, deleteStudio, deleteV1StacksVersionsByStackVersionId, delWorkspace, deprecateActionVersion, deprecatePluginVersion, deprecateStackVersionBy, downloadAction, getActionBySlug, getActionsVersions, getActionVersionById, getAllActionVersions, getApplicationDetailsView, getApplicationsUsesPlugin, getAvailableActionVersionsByActionSlug, getDependentPluginsVersions, getGetPluginView, getInfrastructureEnvironmentsUsesPlugin, getListOfInputs, getPluginInfrastructureView, getPluginModalView, getPluginVersions, getPluginVersionsNotInUse, getPluginVersionUsageSummary, getStackUsesPlugin, getStackVersionListByIds, getStackWorkspaceDetailView, getStackWorkspaces, getStarterStackVersionsAndPluginsVersions, getStarterUsesPlugin, getStudioByIdOrSlug, getStudios1, getStudiosToCreateButton, getStudioTabs, getUnusedStackVersions, listActions, listActions1, listActionsByFilters1, listConnectionInterfaceTypes, listLinksByStackVersion, listPlugins, listPluginVersionByIdsController, listReasons, listStacksByFilters, listStarters, listWorkspaces, patchStarterV2, removeActionFromPlugin, stackModalViewSummary, stackVersionUsageSummary, updateStudio, updateStudioTabs } from '../api/content'
2
+ import { addAction, addLink, addWorkspace, associateActionToPlugin, changeVisibility, createStudio, defaults,
3
+ deleteAction, deleteActionVersion, deleteLink, deletePluginVersion, deleteStudio, deleteV1StacksVersionsByStackVersionId,
4
+ delWorkspace, deprecateActionVersion, deprecatePluginVersion, deprecateStackVersionBy, downloadAction, getActionBySlug,
5
+ getActionsVersions, getActionVersionById, getAllActionVersions, getApplicationDetailsView, getApplicationsUsesPlugin,
6
+ getAvailableActionVersionsByActionSlug, getDependentPluginsVersions, getGetPluginView, getInfrastructureEnvironmentsUsesPlugin,
7
+ getListOfInputs, getPluginInfrastructureView, getPluginModalView, getPluginVersions, getPluginVersionsNotInUse,
8
+ getPluginVersionUsageSummary, getStackUsesPlugin, getStackVersionById, getStackVersionListByIds, getStackWorkspaceDetailView,
9
+ getStackWorkspaces, getStarterStackVersionsAndPluginsVersions, getStarterUsesPlugin, getStudioByIdOrSlug, getStudios1,
10
+ getStudiosToCreateButton, getStudioTabs, getUnusedStackVersions, getWorkflowByStudioSlug, listActions, listActions1,
11
+ listActionsByFilters1, listConnectionInterfaceTypes, listLinksByStackVersion, listPlugins, listPluginVersionByIdsController,
12
+ listReasons, listStacksByFilters, listStarters, listWorkspaces, patchStarterV2, removeActionFromPlugin, stackModalViewSummary,
13
+ stackVersionUsageSummary, updateStudio, updateStudioTabs } 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'
@@ -88,6 +99,10 @@ class ContentClient extends ReactQueryNetworkClient {
88
99
  * Gets stacks from a given studio
89
100
  */
90
101
  stacksFromStudios = this.query(listStacksByFilters)
102
+ /**
103
+ * Gets workflows from a given studio
104
+ */
105
+ workflowsFromStudio = this.query(getWorkflowByStudioSlug)
91
106
  /**
92
107
  * Gets usage summary of stack
93
108
  */
@@ -227,7 +242,7 @@ class ContentClient extends ReactQueryNetworkClient {
227
242
  /**
228
243
  * Get Action Version range by Action Slug
229
244
  */
230
- actionVersionRange = this.mutation(getAvailableActionVersionsByActionSlug)
245
+ actionVersionRange = this.query(getAvailableActionVersionsByActionSlug)
231
246
  /**
232
247
  * Get Actions from Stack
233
248
  */
@@ -261,6 +276,10 @@ class ContentClient extends ReactQueryNetworkClient {
261
276
  * Gets all starters from a stack version id
262
277
  */
263
278
  startersInStackVersion = this.query(listStarters)
279
+ /**
280
+ * Gets a stack from a stack version id
281
+ */
282
+ getStackByVersionId = this.query(getStackVersionById)
264
283
  }
265
284
 
266
285
  export const contentClient = new ContentClient()
@@ -19,6 +19,11 @@ import {
19
19
  getApplicationLinks1,
20
20
  addStacksInWorkspace,
21
21
  deleteStacksInWorkspace,
22
+ deleteV1WorkspacesByWorkspaceId,
23
+ getApplicationDetails,
24
+ getSharedInfraAppliedPlugins1,
25
+ deleteApplication,
26
+ deleteSharedInfra,
22
27
  } from '../api/workspaceManager'
23
28
  import apis from '../apis.json'
24
29
  import { DefaultAPIError } from '../error/DefaultAPIError'
@@ -53,11 +58,33 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
53
58
  /**
54
59
  * Add a stack in a workspace
55
60
  */
56
- addStackToWorkspace = this.mutation(addStacksInWorkspace)
61
+ addStackToWorkspace = this.mutation({
62
+ name: 'addStackToWorkspace',
63
+ request: async (signal, variables: Parameters<typeof addStacksInWorkspace>[0]) =>
64
+ addStacksInWorkspace(variables, { signal }),
65
+ permission: async ({ workspaceId }: Parameters<typeof addStacksInWorkspace>[0]) =>
66
+ workspaceClient.addStackInWorkspace.isAllowed({ workspaceId }),
67
+ })
57
68
  /**
58
69
  * Removes a stack from a workspace
59
70
  */
60
- removeStackFromWorkspace = this.mutation(deleteStacksInWorkspace)
71
+ removeStackFromWorkspace = this.mutation({
72
+ name: 'removeStackFromWorkspace',
73
+ request: async (signal, variables: Parameters<typeof deleteStacksInWorkspace>[0]) =>
74
+ deleteStacksInWorkspace(variables, { signal }),
75
+ permission: async ({ workspaceId }: Parameters<typeof deleteStacksInWorkspace>[0]) =>
76
+ workspaceClient.removeStackFromWorkspace.isAllowed({ workspaceId }),
77
+ })
78
+ /**
79
+ * Deletes a workspace
80
+ */
81
+ deleteWorkspace = this.mutation({
82
+ name: 'removeStackFromWorkspace',
83
+ request: async (signal, variables: Parameters<typeof deleteV1WorkspacesByWorkspaceId>[0]) =>
84
+ deleteV1WorkspacesByWorkspaceId(variables, { signal }),
85
+ permission: async ({ workspaceId }: Parameters<typeof deleteV1WorkspacesByWorkspaceId>[0]) =>
86
+ workspaceClient.deleteWorkspace.isAllowed({ workspaceId }),
87
+ })
61
88
  /**
62
89
  * Gets inputs from a plugin in a workspace stack
63
90
  */
@@ -134,7 +161,7 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
134
161
  * Gets workflows from a given stack and workflow type
135
162
  */
136
163
  workflowsByStackIdAndWorkflowType = this.query(listWorkflowByStackIdAndWorkflowType)
137
-
164
+
138
165
  /**
139
166
  * Gets inputs from an action in a workspace
140
167
  */
@@ -185,6 +212,42 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
185
212
  permission: async ({ stackVersionId, actionVersionId }: Parameters<typeof upsertAccountActionsInputContext>[0]) =>
186
213
  workspaceClient.saveContextInAccount.isAllowed({ $type: 'action', stackVersionId, externalId: actionVersionId }),
187
214
  })
215
+ /**
216
+ * Gets details of an application in an environment
217
+ */
218
+ applicationDetails = this.query({
219
+ name: 'applicationDetails',
220
+ request: async (signal, variables: Parameters<typeof getApplicationDetails>[0]) => getApplicationDetails(variables, { signal }),
221
+ permission: async ({ applicationId, workspaceId }: Parameters<typeof getApplicationDetails>[0]) =>
222
+ workspaceClient.applicationDetail.isAllowed({ applicationId, workspaceId }),
223
+ })
224
+ /**
225
+ * Deletes an application
226
+ */
227
+ deleteApplication = this.mutation({
228
+ name: 'deleteApplication',
229
+ request: async (signal, variables: Parameters<typeof deleteApplication>[0]) => deleteApplication(variables, { signal }),
230
+ permission: async (variables: Parameters<typeof deleteApplication>[0]) =>
231
+ workspaceClient.deleteApplication.isAllowed(variables),
232
+ })
233
+ /**
234
+ * Gets details of a shared infra in an environment
235
+ */
236
+ sharedInfraDetails = this.query({
237
+ name: 'sharedInfraDetails',
238
+ request: async (signal, variables: Parameters<typeof getSharedInfraAppliedPlugins1>[0]) => getSharedInfraAppliedPlugins1(variables, { signal }),
239
+ permission: async ({ sharedInfraId, workspaceId }: Parameters<typeof getSharedInfraAppliedPlugins1>[0]) =>
240
+ workspaceClient.infraDetail.isAllowed({ sharedInfraId, workspaceId }),
241
+ })
242
+ /**
243
+ * Deletes an infra
244
+ */
245
+ deleteInfra = this.mutation({
246
+ name: 'deleteInfra',
247
+ request: async (signal, variables: Parameters<typeof deleteSharedInfra>[0]) => deleteSharedInfra(variables, { signal }),
248
+ permission: async (variables: Parameters<typeof deleteSharedInfra>[0]) =>
249
+ workspaceClient.deleteInfra.isAllowed(variables),
250
+ })
188
251
  }
189
252
 
190
253
  export const workspaceManagerClient = new WorkspaceManagerClient()
@@ -7,6 +7,7 @@ import {
7
7
  accountVariableControllerfindByName,
8
8
  accountVariableControllerupdate,
9
9
  accountVariableControllerusage,
10
+ applicationControllerdeleteApplication,
10
11
  applicationControllergetApplication,
11
12
  applicationControllergetApplications,
12
13
  applicationControllergetDependencyTree,
@@ -45,6 +46,7 @@ import {
45
46
  sharedInfraLinkControllersave,
46
47
  sharedInfraLinkControllerupdate,
47
48
  sharedInfraLinkControllerupdateLinksVisibility,
49
+ sharedInfrastructureControllerdeleteSharedInfra,
48
50
  sharedInfrastructureControllergetAllSharedInfrastructure,
49
51
  sharedInfrastructureControllergetDependencyTree,
50
52
  sharedInfrastructureControllergetSharedInfrastructure,
@@ -52,6 +54,7 @@ import {
52
54
  workflowAccountControllerdeleteAccountWorkflow,
53
55
  workflowAccountControllerlistAccountWorkflows,
54
56
  workflowWorkspaceControllerlistWorkflowByStackIdAndWorkflowType,
57
+ workspaceControllerdelete,
55
58
  workspaceControllergetWorkspaceForId,
56
59
  workspaceControllergetWorkspaces,
57
60
  workspaceControllergetWorkspacesFromUserPermission,
@@ -68,6 +71,7 @@ import {
68
71
  workspaceLinkControllersave,
69
72
  workspaceStackControlleraddStack,
70
73
  workspaceStackControllerdeleteStack,
74
+ workspaceStackControllergetStackById,
71
75
  workspaceStackControllergetStacks,
72
76
  workspaceVariableV2ControllerfindAll,
73
77
  workspaceVariableV2ControllerfindByName,
@@ -415,6 +419,30 @@ class WorkspaceClient extends ReactQueryNetworkClient {
415
419
  * Removes a stack from a workspace. This fn is only used for permission purposes.
416
420
  */
417
421
  removeStackFromWorkspace = this.query(workspaceStackControllerdeleteStack) as OperationObject<Parameters<typeof workspaceStackControllerdeleteStack>[0]>
422
+ /**
423
+ * Gets a stack in a workspace . This fn is only used for permission purposes.
424
+ */
425
+ stackInWorkspace = this.query(workspaceStackControllergetStackById) as OperationObject<Parameters<typeof workspaceStackControllergetStackById>[0]>
426
+ /**
427
+ * Deletes a workspace . This fn is only used for permission purposes.
428
+ */
429
+ deleteWorkspace = this.query(workspaceControllerdelete) as OperationObject<Parameters<typeof workspaceControllerdelete>[0]>
430
+ /**
431
+ * Deletes an application. This fn is only used for permission purposes.
432
+ */
433
+ deleteApplication = this.query(applicationControllerdeleteApplication) as OperationObject<Parameters<typeof applicationControllerdeleteApplication>[0]>
434
+ /**
435
+ * Deletes an infra. This fn is only used for permission purposes.
436
+ */
437
+ deleteInfra = this.query(sharedInfrastructureControllerdeleteSharedInfra) as OperationObject<Parameters<typeof sharedInfrastructureControllerdeleteSharedInfra>[0]>
438
+ /**
439
+ * Gets the detail of an application. This fn is only used for permission purposes.
440
+ */
441
+ applicationDetail = this.query(applicationControllergetApplication) as OperationObject<Parameters<typeof applicationControllergetApplication>[0]>
442
+ /**
443
+ * Gets the detail of an infra. This fn is only used for permission purposes.
444
+ */
445
+ infraDetail = this.query(sharedInfrastructureControllergetSharedInfrastructure) as OperationObject<Parameters<typeof sharedInfrastructureControllergetSharedInfrastructure>[0]>
418
446
  }
419
447
 
420
448
  export const workspaceClient = new WorkspaceClient()