@stack-spot/portal-network 0.17.0 → 0.18.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.
@@ -0,0 +1,31 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import { addLink, defaults, deleteLink, listLinksByStackVersion } from '../api/content'
3
+ import apis from '../apis.json'
4
+ import { DefaultAPIError } from '../error/DefaultAPIError'
5
+ import { cntDictionary } from '../error/dictionary/cnt'
6
+ import { StackspotAPIError } from '../error/StackspotAPIError'
7
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
+
9
+ class ContentClient extends ReactQueryNetworkClient {
10
+ constructor() {
11
+ super(apis.content.url, defaults)
12
+ }
13
+
14
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
15
+ return new DefaultAPIError(error.data, error.status, cntDictionary, error.headers)
16
+ }
17
+ /**
18
+ * Gets links in a stack
19
+ */
20
+ linksInStack = this.query(listLinksByStackVersion)
21
+ /**
22
+ * Adds a link in a stack
23
+ */
24
+ addLinkInStack = this.mutation(addLink)
25
+ /**
26
+ * Adds a link in a stack
27
+ */
28
+ deleteLinkFromStack = this.mutation(deleteLink)
29
+ }
30
+
31
+ export const contentClient = new ContentClient()
@@ -1,8 +1,12 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
2
  import {
3
+ checkConnectionSlugAvailability,
3
4
  save5 as createEmbeddedLink,
4
5
  defaults,
5
6
  delete1,
7
+ delete2,
8
+ delete3,
9
+ delete5,
6
10
  deleteAccountWorkflow,
7
11
  delete6 as deleteApplicationEmbeddedLinks,
8
12
  deleteConnectionInterfaceAttributesFromEnvironment, deleteConnectionInterfaceFromAllEnvironments,
@@ -11,24 +15,35 @@ import {
11
15
  getEmbeddedLinks1 as getAllApplicationEmbeddedLinks,
12
16
  getApplication,
13
17
  getEmbeddedLink1 as getApplicationEmbeddedLinks,
18
+ getApplicationLink,
19
+ getAvailableConnectionInterfaceForAnApplication,
20
+ getAvailableConnectionInterfaceForAWorkspace,
14
21
  getConnectionInterface, getConnectionInterfaces,
15
22
  getDependencyTree,
16
23
  getDependencyTree1,
17
24
  getEmbeddedLink, getEmbeddedLinks, getEnvironment, getEnvironments,
25
+ getSharedInfraLink,
18
26
  getSharedInfrastructure,
19
27
  getV1WorkspacesByWorkspaceIdVariablesAndName,
20
28
  getWorkspaceForId,
29
+ getWorkspaceLinks,
21
30
  getWorkspaces,
31
+ getWorkspacesFromUserPermission,
22
32
  listAccountWorkflows,
23
33
  listWorkflowByStackIdAndWorkflowType,
24
34
  save,
25
35
  save1,
36
+ save3,
37
+ save4,
38
+ save7,
26
39
  save8 as saveApplicationEmbeddedLinks,
27
40
  save9 as saveEnvironment,
28
41
  update,
29
42
  update1,
30
43
  update2,
44
+ update3,
31
45
  update6,
46
+ update7,
32
47
  upsertBatch2 as updateAllApplicationEmbeddedLinks,
33
48
  upsertBatch1 as updateAllEmbeddedLink,
34
49
  update8 as updateApplicationEmbeddedLinks,
@@ -36,6 +51,8 @@ import {
36
51
  updateConnectionInterfaceVisibility,
37
52
  update5 as updateEmbeddedLink,
38
53
  update9 as updateEnvironment,
54
+ updateLinksVisibility,
55
+ updateLinksVisibility1,
39
56
  } from '../api/workspace'
40
57
  import apis from '../apis.json'
41
58
  import { DefaultAPIError } from '../error/DefaultAPIError'
@@ -61,7 +78,14 @@ class WorkspaceClient extends ReactQueryNetworkClient {
61
78
  * Gets a connection interface from a workspace
62
79
  */
63
80
  connectionInterface = this.query(getConnectionInterface)
64
-
81
+ /**
82
+ * Get available connection interface for a workspace by connection interface slug
83
+ */
84
+ workspaceAvailableConnInterfaceBySlug = this.query(getAvailableConnectionInterfaceForAWorkspace)
85
+ /**
86
+ * Get available connection interface for an application by connection interface slug
87
+ */
88
+ applicationAvailableConnInterface = this.query(getAvailableConnectionInterfaceForAnApplication)
65
89
  /**
66
90
  * Updates the visibility of a connection interface
67
91
  */
@@ -81,6 +105,10 @@ class WorkspaceClient extends ReactQueryNetworkClient {
81
105
  * Updates the attributes of a connection interface
82
106
  */
83
107
  updateConnectionInterfaceAttributes = this.mutation(updateConnectionInterfaceAttributes)
108
+ /**
109
+ * Checks the availability of a connection interface slug.
110
+ */
111
+ checkConnectionInterfaceAvailability = this.query(checkConnectionSlugAvailability)
84
112
 
85
113
  /**
86
114
  * Gets all environments
@@ -171,6 +199,10 @@ class WorkspaceClient extends ReactQueryNetworkClient {
171
199
  * Gets a workspace
172
200
  */
173
201
  workspace = this.query(getWorkspaceForId)
202
+ /**
203
+ * Get workspaces within user permission
204
+ */
205
+ workspacesFromUserPermission = this.query(getWorkspacesFromUserPermission)
174
206
 
175
207
  /**
176
208
  * Creates a workspace
@@ -182,7 +214,6 @@ class WorkspaceClient extends ReactQueryNetworkClient {
182
214
  */
183
215
  updateWorkspace = this.mutation(update1)
184
216
 
185
-
186
217
  //App and infra
187
218
 
188
219
  /**
@@ -224,6 +255,10 @@ class WorkspaceClient extends ReactQueryNetworkClient {
224
255
  * Gets account workflows
225
256
  */
226
257
  accountWorkflows = this.query(listAccountWorkflows)
258
+ /**
259
+ * Gets workflows from a stack
260
+ */
261
+ stackWorkflows = this.query(listWorkflowByStackIdAndWorkflowType)
227
262
  /**
228
263
  * Removes account workflow
229
264
  */
@@ -251,6 +286,60 @@ class WorkspaceClient extends ReactQueryNetworkClient {
251
286
  */
252
287
  deleteVariable = this.mutation(delete1)
253
288
 
289
+ //Links
290
+ /**
291
+ * Gets shared infra links
292
+ */
293
+ linksInWorkspace = this.query(getWorkspaceLinks)
294
+ /**
295
+ * Adds a link to a workspace
296
+ */
297
+ addLinkInWorkspace = this.mutation(save4)
298
+ /**
299
+ * Deletes a link from a workspace
300
+ */
301
+ removeLinkFromWorkspace = this.mutation(delete3)
302
+ /**
303
+ * Gets application link
304
+ */
305
+ linkInApplication = this.query(getApplicationLink)
306
+ /**
307
+ * Adds a link to an application
308
+ */
309
+ addLinkInApplication = this.mutation(save7)
310
+ /**
311
+ * Deletes a link from an application
312
+ */
313
+ removeLinkFromApplication = this.mutation(delete5)
314
+ /**
315
+ * Updates a link from an application
316
+ */
317
+ updateLinkInApplication = this.mutation(update7)
318
+ /**
319
+ * Updates application links visibility
320
+ */
321
+ updateLinkVisibilityInApplication = this.mutation(updateLinksVisibility1)
322
+ /**
323
+ * Gets shared infra link
324
+ */
325
+ linkInInfra = this.query(getSharedInfraLink)
326
+ /**
327
+ * Adds a link to an infra
328
+ */
329
+ addLinkInInfra = this.mutation(save3)
330
+ /**
331
+ * Deletes a link from an infra
332
+ */
333
+ removeLinkFromInfra = this.mutation(delete2)
334
+ /**
335
+ * Updates a link from an infra
336
+ */
337
+ updateLinkInInfra = this.mutation(update3)
338
+ /**
339
+ * Updates infra links visibility
340
+ */
341
+ updateLinkVisibilityInInfra = this.mutation(updateLinksVisibility)
342
+
254
343
  }
255
344
 
256
345
  export const workspaceClient = new WorkspaceClient()
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ export { accountClient } from './client/account'
2
2
  export { cloudServicesClient } from './client/cloud-services'
3
3
  export { secretsClient } from './client/secrets'
4
4
  export { workspaceClient } from './client/workspace'
5
+ export { contentClient } from './client/content'
5
6
  export { runtimeManagerClient } from './client/runtime-manager'
6
7
  export { workspaceSearchClient } from './client/workspace-search'
7
8
  export { workflowClient } from './client/workflow'