@stack-spot/portal-network 0.16.0 → 0.17.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.
- package/CHANGELOG.md +14 -0
- package/dist/api/workspace.d.ts +260 -171
- package/dist/api/workspace.d.ts.map +1 -1
- package/dist/api/workspace.js +54 -2
- package/dist/api/workspace.js.map +1 -1
- package/dist/client/types.d.ts +1 -13
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workspace.d.ts +63 -7
- package/dist/client/workspace.d.ts.map +1 -1
- package/dist/client/workspace.js +76 -1
- package/dist/client/workspace.js.map +1 -1
- package/dist/error/DefaultAPIError.js +6 -6
- package/dist/error/DefaultAPIError.js.map +1 -1
- package/package.json +1 -1
- package/src/api/workspace.ts +328 -174
- package/src/client/types.ts +1 -17
- package/src/client/workspace.ts +51 -6
- package/src/error/DefaultAPIError.ts +6 -6
package/src/client/types.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { RequestOpts } from '@oazapfts/runtime'
|
|
2
|
-
import { AccountScmInfoSaveRequest, AccountScmInfoUpdateRequest, AccountScmStatusResponse
|
|
2
|
+
import { AccountScmInfoSaveRequest, AccountScmInfoUpdateRequest, AccountScmStatusResponse } from '../api/account'
|
|
3
3
|
import { AllocationCostRequest, AllocationCostResponse, ChargePeriod, getAllocationCostFilters, ManagedService, ServiceResource } from '../api/cloudServices'
|
|
4
|
-
import { EnvironmentReadResponse, WorkspaceReadResponse } from '../api/workspace'
|
|
5
4
|
|
|
6
5
|
interface BaseSMCStatus {
|
|
7
6
|
/**
|
|
@@ -116,18 +115,3 @@ export type FixVariables<
|
|
|
116
115
|
|
|
117
116
|
export type ReplaceResult<T extends (...args: any[]) => Promise<any>, Fix> = (...args: Parameters<T>) => Promise<Fix>
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
export interface FixedWorkspaceReadResponse extends Omit<WorkspaceReadResponse, 'id' | 'name'> {
|
|
121
|
-
id: string,
|
|
122
|
-
name: string,
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface FixedEnvironmentReadResponse extends Omit<EnvironmentReadResponse, 'id' | 'name'> {
|
|
126
|
-
id: string,
|
|
127
|
-
name: string,
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface FixedIdResponse extends Omit<IdResponse, 'id'> {
|
|
131
|
-
id: string,
|
|
132
|
-
}
|
|
133
|
-
|
package/src/client/workspace.ts
CHANGED
|
@@ -2,9 +2,12 @@ import { HttpError } from '@oazapfts/runtime'
|
|
|
2
2
|
import {
|
|
3
3
|
save5 as createEmbeddedLink,
|
|
4
4
|
defaults,
|
|
5
|
+
delete1,
|
|
6
|
+
deleteAccountWorkflow,
|
|
5
7
|
delete6 as deleteApplicationEmbeddedLinks,
|
|
6
8
|
deleteConnectionInterfaceAttributesFromEnvironment, deleteConnectionInterfaceFromAllEnvironments,
|
|
7
9
|
delete4 as deleteEmbeddedLink,
|
|
10
|
+
findAll,
|
|
8
11
|
getEmbeddedLinks1 as getAllApplicationEmbeddedLinks,
|
|
9
12
|
getApplication,
|
|
10
13
|
getEmbeddedLink1 as getApplicationEmbeddedLinks,
|
|
@@ -13,11 +16,16 @@ import {
|
|
|
13
16
|
getDependencyTree1,
|
|
14
17
|
getEmbeddedLink, getEmbeddedLinks, getEnvironment, getEnvironments,
|
|
15
18
|
getSharedInfrastructure,
|
|
19
|
+
getV1WorkspacesByWorkspaceIdVariablesAndName,
|
|
16
20
|
getWorkspaceForId,
|
|
17
21
|
getWorkspaces,
|
|
22
|
+
listAccountWorkflows,
|
|
23
|
+
listWorkflowByStackIdAndWorkflowType,
|
|
18
24
|
save,
|
|
25
|
+
save1,
|
|
19
26
|
save8 as saveApplicationEmbeddedLinks,
|
|
20
27
|
save9 as saveEnvironment,
|
|
28
|
+
update,
|
|
21
29
|
update1,
|
|
22
30
|
update2,
|
|
23
31
|
update6,
|
|
@@ -34,7 +42,6 @@ import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
|
34
42
|
import { workspaceDictionary } from '../error/dictionary/workspace'
|
|
35
43
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
36
44
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
37
|
-
import { FixedEnvironmentReadResponse, FixedIdResponse, FixedWorkspaceReadResponse, ReplaceResult } from './types'
|
|
38
45
|
|
|
39
46
|
class WorkspaceClient extends ReactQueryNetworkClient {
|
|
40
47
|
constructor() {
|
|
@@ -78,12 +85,12 @@ class WorkspaceClient extends ReactQueryNetworkClient {
|
|
|
78
85
|
/**
|
|
79
86
|
* Gets all environments
|
|
80
87
|
*/
|
|
81
|
-
environments = this.query(getEnvironments
|
|
88
|
+
environments = this.query(getEnvironments)
|
|
82
89
|
|
|
83
90
|
/**
|
|
84
91
|
* Gets environment by Id
|
|
85
92
|
*/
|
|
86
|
-
environment = this.query(getEnvironment
|
|
93
|
+
environment = this.query(getEnvironment)
|
|
87
94
|
|
|
88
95
|
/**
|
|
89
96
|
* Creates an environment
|
|
@@ -158,23 +165,26 @@ class WorkspaceClient extends ReactQueryNetworkClient {
|
|
|
158
165
|
/**
|
|
159
166
|
* Gets all workspaces
|
|
160
167
|
*/
|
|
161
|
-
workspaces = this.query(getWorkspaces
|
|
168
|
+
workspaces = this.query(getWorkspaces)
|
|
162
169
|
|
|
163
170
|
/**
|
|
164
171
|
* Gets a workspace
|
|
165
172
|
*/
|
|
166
|
-
workspace = this.query(getWorkspaceForId
|
|
173
|
+
workspace = this.query(getWorkspaceForId)
|
|
167
174
|
|
|
168
175
|
/**
|
|
169
176
|
* Creates a workspace
|
|
170
177
|
*/
|
|
171
|
-
createWorkspace = this.mutation(save
|
|
178
|
+
createWorkspace = this.mutation(save)
|
|
172
179
|
|
|
173
180
|
/**
|
|
174
181
|
* Updates a workspace
|
|
175
182
|
*/
|
|
176
183
|
updateWorkspace = this.mutation(update1)
|
|
177
184
|
|
|
185
|
+
|
|
186
|
+
//App and infra
|
|
187
|
+
|
|
178
188
|
/**
|
|
179
189
|
* Gets an application
|
|
180
190
|
*/
|
|
@@ -205,6 +215,41 @@ class WorkspaceClient extends ReactQueryNetworkClient {
|
|
|
205
215
|
*/
|
|
206
216
|
updateInfra = this.mutation(update2)
|
|
207
217
|
|
|
218
|
+
// Workflow
|
|
219
|
+
/**
|
|
220
|
+
* Gets a workflow by stack id
|
|
221
|
+
*/
|
|
222
|
+
workflowsByStackId = this.query(listWorkflowByStackIdAndWorkflowType)
|
|
223
|
+
/**
|
|
224
|
+
* Gets account workflows
|
|
225
|
+
*/
|
|
226
|
+
accountWorkflows = this.query(listAccountWorkflows)
|
|
227
|
+
/**
|
|
228
|
+
* Removes account workflow
|
|
229
|
+
*/
|
|
230
|
+
deleteAccountWorkflow = this.mutation(deleteAccountWorkflow)
|
|
231
|
+
|
|
232
|
+
// Variable
|
|
233
|
+
/**
|
|
234
|
+
* Gets all workspace variables
|
|
235
|
+
*/
|
|
236
|
+
variables = this.query(findAll)
|
|
237
|
+
/**
|
|
238
|
+
* Creates a workspace variable
|
|
239
|
+
*/
|
|
240
|
+
createVariable = this.mutation(save1)
|
|
241
|
+
/**
|
|
242
|
+
* Gets a variable by name
|
|
243
|
+
*/
|
|
244
|
+
variable = this.query(getV1WorkspacesByWorkspaceIdVariablesAndName)
|
|
245
|
+
/**
|
|
246
|
+
* Updates a workspace variable
|
|
247
|
+
*/
|
|
248
|
+
updateVariable = this.mutation(update)
|
|
249
|
+
/**
|
|
250
|
+
* Deletes a workspace variable
|
|
251
|
+
*/
|
|
252
|
+
deleteVariable = this.mutation(delete1)
|
|
208
253
|
|
|
209
254
|
}
|
|
210
255
|
|
|
@@ -15,14 +15,14 @@ const fieldDictionary = {
|
|
|
15
15
|
wks: workspaceFields,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function getTitle(raw: ErrorResponse, dictionary: Dictionary, language: Language) {
|
|
18
|
+
function getTitle(status: number, raw: ErrorResponse, dictionary: Dictionary, language: Language) {
|
|
19
19
|
if (dictionary[language][raw.code]) return dictionary[language][raw.code]
|
|
20
|
-
if (!ignoredDescriptions.includes(raw.details)) return raw.details
|
|
21
|
-
return (baseDictionary as Dictionary)[language][
|
|
20
|
+
if (raw.details && !ignoredDescriptions.includes(raw.details)) return raw.details
|
|
21
|
+
return (baseDictionary as Dictionary)[language][status] || baseDictionary[language].defaultTitle
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
function createMessage(raw: ErrorResponse, dictionary: Dictionary, language: Language) {
|
|
25
|
-
const title = getTitle(raw, dictionary, language)
|
|
24
|
+
function createMessage(status: number, raw: ErrorResponse, dictionary: Dictionary, language: Language) {
|
|
25
|
+
const title = getTitle(status, raw, dictionary, language)
|
|
26
26
|
if (!raw.validationDetails?.length) return title
|
|
27
27
|
const api = raw.code?.split(/[-_]/)[0]
|
|
28
28
|
const details = raw.validationDetails?.map((detail) => {
|
|
@@ -67,7 +67,7 @@ export class DefaultAPIError extends StackspotAPIError {
|
|
|
67
67
|
super({
|
|
68
68
|
status: status,
|
|
69
69
|
code: rawResponse.code,
|
|
70
|
-
message: language => createMessage(rawResponse, dictionary, language),
|
|
70
|
+
message: language => createMessage(status, rawResponse, dictionary, language),
|
|
71
71
|
headers,
|
|
72
72
|
})
|
|
73
73
|
this.raw = rawResponse
|