@stack-spot/portal-network 0.21.0 → 0.22.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/api/notification.d.ts +158 -0
  3. package/dist/api/notification.d.ts.map +1 -0
  4. package/dist/api/notification.js +113 -0
  5. package/dist/api/notification.js.map +1 -0
  6. package/dist/api/workspace.d.ts +1 -1
  7. package/dist/api/workspace.d.ts.map +1 -1
  8. package/dist/apis.json +8 -0
  9. package/dist/client/content.d.ts +6 -6
  10. package/dist/client/content.d.ts.map +1 -1
  11. package/dist/client/content.js +4 -3
  12. package/dist/client/content.js.map +1 -1
  13. package/dist/client/notification.d.ts +36 -0
  14. package/dist/client/notification.d.ts.map +1 -0
  15. package/dist/client/notification.js +42 -0
  16. package/dist/client/notification.js.map +1 -0
  17. package/dist/client/workflow.d.ts +8 -8
  18. package/dist/client/workflow.d.ts.map +1 -1
  19. package/dist/client/workflow.js +5 -4
  20. package/dist/client/workflow.js.map +1 -1
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/utils/remove-authorization-param.d.ts +5 -0
  26. package/dist/utils/remove-authorization-param.d.ts.map +1 -0
  27. package/dist/utils/remove-authorization-param.js +4 -0
  28. package/dist/utils/remove-authorization-param.js.map +1 -0
  29. package/package.json +1 -1
  30. package/src/api/notification.ts +278 -0
  31. package/src/api/workspace.ts +1 -1
  32. package/src/apis.json +8 -0
  33. package/src/client/content.ts +4 -3
  34. package/src/client/notification.ts +32 -0
  35. package/src/client/workflow.ts +5 -4
  36. package/src/index.ts +1 -0
  37. package/src/utils/remove-authorization-param.ts +5 -0
package/src/apis.json CHANGED
@@ -133,5 +133,13 @@
133
133
  "prd": "https://secrets-api.v1.stackspot.com"
134
134
  },
135
135
  "docs": "/v3/api-docs"
136
+ },
137
+ "notification": {
138
+ "url": {
139
+ "dev": "https://account-notification-engine.dev.stackspot.com",
140
+ "stg": "https://account-notification-engine.stg.stackspot.com",
141
+ "prd": "https://account-notification-engine.stackspot.com"
142
+ },
143
+ "docs": "/v3/api-docs"
136
144
  }
137
145
  }
@@ -5,6 +5,7 @@ import { DefaultAPIError } from '../error/DefaultAPIError'
5
5
  import { cntDictionary } from '../error/dictionary/cnt'
6
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
7
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
+ import { removeAuthorizationParam } from '../utils/remove-authorization-param'
8
9
 
9
10
  class ContentClient extends ReactQueryNetworkClient {
10
11
  constructor() {
@@ -33,11 +34,11 @@ class ContentClient extends ReactQueryNetworkClient {
33
34
  /**
34
35
  * Gets all studios
35
36
  */
36
- studios = this.query(getStudios1)
37
+ studios = this.query(removeAuthorizationParam(getStudios1))
37
38
  /**
38
39
  * Gets all studios
39
40
  */
40
- studiosUserHasCreatePermission = this.query(getStudiosToCreateButton)
41
+ studiosUserHasCreatePermission = this.query(removeAuthorizationParam(getStudiosToCreateButton))
41
42
  /**
42
43
  * Gets a studio
43
44
  */
@@ -45,7 +46,7 @@ class ContentClient extends ReactQueryNetworkClient {
45
46
  /**
46
47
  * Creates a studio
47
48
  */
48
- createStudio = this.mutation(createStudio)
49
+ createStudio = this.mutation(removeAuthorizationParam(createStudio))
49
50
  /**
50
51
  * Updates a studio
51
52
  */
@@ -0,0 +1,32 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import { commit, committedNotifications, defaults, findAll } from '../api/notification'
3
+ import apis from '../apis.json'
4
+ import { DefaultAPIError } from '../error/DefaultAPIError'
5
+ import { baseDictionary } from '../error/dictionary/base'
6
+ import { StackspotAPIError } from '../error/StackspotAPIError'
7
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
+
9
+ class NotificationClient extends ReactQueryNetworkClient {
10
+
11
+ constructor() {
12
+ super(apis.notification.url, defaults)
13
+ }
14
+
15
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
16
+ return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
17
+ }
18
+ /**
19
+ * Gets all notification by tenant
20
+ */
21
+ notifications = this.query(findAll)
22
+ /**
23
+ * Gets all committed notifications by tenant
24
+ */
25
+ committedNotifications = this.query(committedNotifications)
26
+ /**
27
+ * Mark a notification as committed (mark as read)
28
+ */
29
+ commit = this.mutation(commit)
30
+ }
31
+
32
+ export const notificationClient = new NotificationClient()
@@ -5,6 +5,7 @@ import { DefaultAPIError } from '../error/DefaultAPIError'
5
5
  import { actionDictionary } from '../error/dictionary/action'
6
6
  import { StackspotAPIError } from '../error/StackspotAPIError'
7
7
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
+ import { removeAuthorizationParam } from '../utils/remove-authorization-param'
8
9
 
9
10
  class WorkflowClient extends ReactQueryNetworkClient {
10
11
  constructor() {
@@ -18,7 +19,7 @@ class WorkflowClient extends ReactQueryNetworkClient {
18
19
  /**
19
20
  * Runs an action
20
21
  */
21
- runAction = this.mutation(runActionServiceWorkflowsRunActionDispatchPost)
22
+ runAction = this.mutation(removeAuthorizationParam(runActionServiceWorkflowsRunActionDispatchPost))
22
23
 
23
24
  /**
24
25
  * Creates an api
@@ -28,17 +29,17 @@ class WorkflowClient extends ReactQueryNetworkClient {
28
29
  /**
29
30
  * Gets the execution status of a workflow by id
30
31
  */
31
- executionStatus = this.query(getExecutionStatusServiceWorkflowsExecutionStatusExecutionIdGet)
32
+ executionStatus = this.query(removeAuthorizationParam(getExecutionStatusServiceWorkflowsExecutionStatusExecutionIdGet))
32
33
 
33
34
  /**
34
35
  * Gets the execution dispatch service
35
36
  */
36
- executionDispatchInfo = this.query(getExecutionDispatchRequestServiceWorkflowsExecutionIdRequestGet)
37
+ executionDispatchInfo = this.query(removeAuthorizationParam(getExecutionDispatchRequestServiceWorkflowsExecutionIdRequestGet))
37
38
 
38
39
  /**
39
40
  * Gets the health check of an execution id
40
41
  */
41
- executionHealthCheck = this.mutation(healthCheckServiceWorkflowsHealthCheckDispatchPost)
42
+ executionHealthCheck = this.mutation(removeAuthorizationParam(healthCheckServiceWorkflowsHealthCheckDispatchPost))
42
43
  }
43
44
 
44
45
  export const workflowClient = new WorkflowClient()
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export { runtimeManagerClient } from './client/runtime-manager'
7
7
  export { workspaceSearchClient } from './client/workspace-search'
8
8
  export { workflowClient } from './client/workflow'
9
9
  export { eventBusClient } from './client/event-bus'
10
+ export { notificationClient } from './client/notification'
10
11
  export * from './client/types'
11
12
  export { UseQueryObjectOptions } from './network/types'
12
13
  export { DefaultAPIError } from './error/DefaultAPIError'
@@ -0,0 +1,5 @@
1
+ import { FixVariables, OazapftsFunction } from '../client/types'
2
+
3
+ export function removeAuthorizationParam<T extends OazapftsFunction>(fn: T): FixVariables<T, { authorization: never }> {
4
+ return fn
5
+ }