@stack-spot/portal-network 0.32.0 → 0.34.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,86 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import apis from '../apis.json'
3
+ import { DefaultAPIError } from '../error/DefaultAPIError'
4
+ import { cntDictionary } from '../error/dictionary/cnt'
5
+ import { StackspotAPIError } from '../error/StackspotAPIError'
6
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
7
+ import {
8
+ createApplication,
9
+ createDeployment,
10
+ defaults,
11
+ getApplication,
12
+ getApplicationHistory,
13
+ getDeployment,
14
+ getDeploymentHealth,
15
+ getDeploymentLogs,
16
+ getDeploymentStatus,
17
+ getRepositoryImages,
18
+ listApplications,
19
+ listDeployments,
20
+ listRepositories,
21
+ listRuntimes,
22
+ } from '../api/cloudPlatform'
23
+
24
+ class CloudPlatformClient extends ReactQueryNetworkClient {
25
+ constructor() {
26
+ super(apis.cloudPlatform.url, defaults)
27
+ }
28
+
29
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
30
+ return new DefaultAPIError(error.data, error.status, cntDictionary, error.headers)
31
+ }
32
+ /**
33
+ * Get list of applications
34
+ */
35
+ listApplications = this.query(listApplications)
36
+ /**
37
+ * Get an application by id
38
+ */
39
+ application = this.query(getApplication)
40
+ /**
41
+ * Get an application history
42
+ */
43
+ applicationHistory = this.query(getApplicationHistory)
44
+ /**
45
+ * Get list of application deployments
46
+ */
47
+ listApplicationDeployments = this.query(listDeployments)
48
+ /**
49
+ * Get an application deployment by id
50
+ */
51
+ applicationDeployment = this.query(getDeployment)
52
+ /**
53
+ * Get an application deployment status
54
+ */
55
+ applicationDeploymentStatus = this.query(getDeploymentStatus)
56
+ /**
57
+ * Get an application deployment health
58
+ */
59
+ applicationDeploymentHealth = this.query(getDeploymentHealth)
60
+ /**
61
+ * Get an application deployment logs
62
+ */
63
+ applicationDeploymentLogs = this.query(getDeploymentLogs)
64
+ /**
65
+ * Get an application runtimes
66
+ */
67
+ listApplicationRuntimes = this.query(listRuntimes)
68
+ /**
69
+ * Get list of repositories
70
+ */
71
+ listRepositories = this.query(listRepositories)
72
+ /**
73
+ * Get list of images from a repository
74
+ */
75
+ listRepositoryImages = this.query(getRepositoryImages)
76
+ /**
77
+ * Create a deploy of the application
78
+ */
79
+ createDeployment = this.mutation(createDeployment)
80
+ /**
81
+ * Create an application
82
+ */
83
+ createApplication = this.mutation(createApplication)
84
+ }
85
+
86
+ export const cloudPlatformClient = new CloudPlatformClient()
@@ -1,5 +1,5 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
- import { createApiServiceWorkflowsCreateApiDispatchPost, defaults, getExecutionDispatchRequestServiceWorkflowsExecutionIdRequestGet, getExecutionStatusServiceWorkflowsExecutionStatusExecutionIdGet, healthCheckServiceWorkflowsHealthCheckDispatchPost, runActionServiceWorkflowsRunActionDispatchPost, v1GetWorkflowExecutionJobDetailServiceV1ExecutionsExecutionIdJobsJobIdGet, v1GetWorkflowExecutionJobGraphServiceV1ExecutionsExecutionIdGet } from '../api/workflows'
2
+ import { createApiServiceWorkflowsCreateApiDispatchPost, defaults, getExecutionDispatchRequestServiceWorkflowsExecutionIdRequestGet, getExecutionStatusServiceWorkflowsExecutionStatusExecutionIdGet, healthCheckServiceWorkflowsHealthCheckDispatchPost, runActionServiceWorkflowsRunActionDispatchPost, v1AcceptWorkflowExecutionJobSuspendedServiceV1ExecutionsExecutionIdJobsJobIdAcceptPost, v1GetWorkflowExecutionJobDetailServiceV1ExecutionsExecutionIdJobsJobIdGet, v1GetWorkflowExecutionJobGraphServiceV1ExecutionsExecutionIdGet, v1RefuseWorkflowExecutionJobSuspendedServiceV1ExecutionsExecutionIdJobsJobIdRefusePost } from '../api/workflows'
3
3
  import apis from '../apis.json'
4
4
  import { DefaultAPIError } from '../error/DefaultAPIError'
5
5
  import { actionDictionary } from '../error/dictionary/action'
@@ -50,6 +50,20 @@ class WorkflowClient extends ReactQueryNetworkClient {
50
50
  * Gets the steps of a workflow job.
51
51
  */
52
52
  jobSteps = this.query(removeAuthorizationParam(v1GetWorkflowExecutionJobDetailServiceV1ExecutionsExecutionIdJobsJobIdGet))
53
+
54
+ /**
55
+ * Approves a workflow step that is suspended so the execution can continue.
56
+ */
57
+ acceptWorkflowStep = this.mutation(
58
+ removeAuthorizationParam(v1AcceptWorkflowExecutionJobSuspendedServiceV1ExecutionsExecutionIdJobsJobIdAcceptPost),
59
+ )
60
+
61
+ /**
62
+ * Refuses a workflow step that is suspended so the execution can be canceled.
63
+ */
64
+ refuseWorkflowStep = this.mutation(
65
+ removeAuthorizationParam(v1RefuseWorkflowExecutionJobSuspendedServiceV1ExecutionsExecutionIdJobsJobIdRefusePost),
66
+ )
53
67
  }
54
68
 
55
69
  export const workflowClient = new WorkflowClient()
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ export { cloudServicesClient } from './client/cloud-services'
4
4
  export { contentClient } from './client/content'
5
5
  export { eventBusClient } from './client/event-bus'
6
6
  export { notificationClient } from './client/notification'
7
+ export { cloudPlatformClient } from './client/cloud-platform'
7
8
  export { runtimeManagerClient } from './client/runtime-manager'
8
9
  export { secretsClient } from './client/secrets'
9
10
  export * from './client/types'
@@ -3,4 +3,4 @@ import { QueryClient } from '@tanstack/react-query'
3
3
  /**
4
4
  * The global, unique, Query Client for React Query.
5
5
  */
6
- export const queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 3 } } })
6
+ export const queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 3, staleTime: Infinity } } })