@stack-spot/portal-network 0.43.0 → 0.45.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 +20 -0
- package/dist/api/content.d.ts +38 -33
- package/dist/api/content.d.ts.map +1 -1
- package/dist/api/content.js +19 -10
- package/dist/api/content.js.map +1 -1
- package/dist/api/notification.d.ts +32 -8
- package/dist/api/notification.d.ts.map +1 -1
- package/dist/api/notification.js +17 -1
- package/dist/api/notification.js.map +1 -1
- package/dist/api/workspaceManager.d.ts +151 -11
- package/dist/api/workspaceManager.d.ts.map +1 -1
- package/dist/api/workspaceManager.js +101 -19
- package/dist/api/workspaceManager.js.map +1 -1
- package/dist/client/content.d.ts +14 -0
- package/dist/client/content.d.ts.map +1 -1
- package/dist/client/content.js +10 -1
- package/dist/client/content.js.map +1 -1
- package/dist/client/workspace-manager.d.ts +12 -0
- package/dist/client/workspace-manager.d.ts.map +1 -1
- package/dist/client/workspace-manager.js +13 -4
- package/dist/client/workspace-manager.js.map +1 -1
- package/dist/error/DefaultAPIError.d.ts.map +1 -1
- package/dist/error/DefaultAPIError.js +15 -6
- package/dist/error/DefaultAPIError.js.map +1 -1
- package/dist/error/StackspotAPIError.d.ts +21 -2
- package/dist/error/StackspotAPIError.d.ts.map +1 -1
- package/dist/error/StackspotAPIError.js +18 -3
- package/dist/error/StackspotAPIError.js.map +1 -1
- package/dist/error/dictionary/action-details.d.ts +2 -0
- package/dist/error/dictionary/action-details.d.ts.map +1 -0
- package/dist/error/dictionary/action-details.js +19 -0
- package/dist/error/dictionary/action-details.js.map +1 -0
- package/dist/error/dictionary/workspace-details.d.ts +2 -0
- package/dist/error/dictionary/workspace-details.d.ts.map +1 -0
- package/dist/error/dictionary/workspace-details.js +15 -0
- package/dist/error/dictionary/workspace-details.js.map +1 -0
- package/package.json +1 -1
- package/src/api/content.ts +52 -38
- package/src/api/notification.ts +53 -8
- package/src/api/workspaceManager.ts +257 -31
- package/src/client/content.ts +19 -13
- package/src/client/workspace-manager.ts +15 -10
- package/src/error/DefaultAPIError.ts +20 -7
- package/src/error/StackspotAPIError.ts +44 -6
- package/src/error/dictionary/action-details.ts +20 -0
- package/src/error/dictionary/workspace-details.ts +15 -0
|
@@ -8,11 +8,29 @@ import * as Oazapfts from "@oazapfts/runtime";
|
|
|
8
8
|
import * as QS from "@oazapfts/runtime/query";
|
|
9
9
|
export const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders> = {
|
|
10
10
|
headers: {},
|
|
11
|
-
baseUrl: "https://workspace-workspace-manager.
|
|
11
|
+
baseUrl: "https://workspace-workspace-manager.dev.stackspot.com",
|
|
12
12
|
};
|
|
13
13
|
const oazapfts = Oazapfts.runtime(defaults);
|
|
14
14
|
export const servers = {
|
|
15
|
-
generatedServerUrl: "https://workspace-workspace-manager.
|
|
15
|
+
generatedServerUrl: "https://workspace-workspace-manager.dev.stackspot.com"
|
|
16
|
+
};
|
|
17
|
+
export type WorkspaceVariableResponse = {
|
|
18
|
+
/** Workspace variable name. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Workspace variable value. */
|
|
21
|
+
value?: string;
|
|
22
|
+
/** Workspace variable description. */
|
|
23
|
+
description: string;
|
|
24
|
+
/** Workspace variable mandate flag. */
|
|
25
|
+
mandate: boolean;
|
|
26
|
+
/** Variable value source. */
|
|
27
|
+
source: string;
|
|
28
|
+
/** Workspace variable creation data */
|
|
29
|
+
createdAt: string;
|
|
30
|
+
};
|
|
31
|
+
export type UpsertWorkspaceVariableRequest = {
|
|
32
|
+
/** Workspace variable value. */
|
|
33
|
+
value: string;
|
|
16
34
|
};
|
|
17
35
|
export type ExternalItemsResponse = {
|
|
18
36
|
source: string;
|
|
@@ -211,6 +229,26 @@ export type WorkflowActionsRequest = {
|
|
|
211
229
|
actionsBefore: WorkflowActionSimpleRequest[];
|
|
212
230
|
actionsAfter: WorkflowActionSimpleRequest[];
|
|
213
231
|
};
|
|
232
|
+
export type AccountVariableResponse = {
|
|
233
|
+
/** Account variable name */
|
|
234
|
+
name: string;
|
|
235
|
+
/** Account variable value stored */
|
|
236
|
+
value?: string;
|
|
237
|
+
/** Account variable description */
|
|
238
|
+
description: string;
|
|
239
|
+
/** Account variable mandatory flag */
|
|
240
|
+
mandate: boolean;
|
|
241
|
+
/** Account variable creation data */
|
|
242
|
+
createdAt: string;
|
|
243
|
+
};
|
|
244
|
+
export type UpdateAccountVariableRequest = {
|
|
245
|
+
/** New account variable value */
|
|
246
|
+
value?: string;
|
|
247
|
+
/** New account variable description */
|
|
248
|
+
description: string;
|
|
249
|
+
/** New account variable mandatory flag */
|
|
250
|
+
mandate: boolean;
|
|
251
|
+
};
|
|
214
252
|
export type RequiresRequest = {
|
|
215
253
|
/** Connections requires name. */
|
|
216
254
|
selected: string;
|
|
@@ -428,6 +466,28 @@ export type AccountWorkflowCreateRequest = {
|
|
|
428
466
|
export type IdResponseString = {
|
|
429
467
|
id: string;
|
|
430
468
|
};
|
|
469
|
+
export type PaginatedAccountVariableResponse = {
|
|
470
|
+
/** Current page requested */
|
|
471
|
+
currentPage: number;
|
|
472
|
+
/** Last page available */
|
|
473
|
+
lastPage: number;
|
|
474
|
+
/** Page size requested */
|
|
475
|
+
pageSize: number;
|
|
476
|
+
/** Total items found */
|
|
477
|
+
totalItems: number;
|
|
478
|
+
/** Account variables for current page */
|
|
479
|
+
items: AccountVariableResponse[];
|
|
480
|
+
};
|
|
481
|
+
export type CreateAccountVariableRequest = {
|
|
482
|
+
/** Account variable name */
|
|
483
|
+
name: string;
|
|
484
|
+
/** Account variable value */
|
|
485
|
+
value?: string;
|
|
486
|
+
/** Account variable description */
|
|
487
|
+
description: string;
|
|
488
|
+
/** Account variable mandatory flag */
|
|
489
|
+
mandate: boolean;
|
|
490
|
+
};
|
|
431
491
|
export type ManagerRunResponse = {
|
|
432
492
|
environmentName?: string;
|
|
433
493
|
runId: string;
|
|
@@ -671,6 +731,23 @@ export type FullInputContextResponse = {
|
|
|
671
731
|
computedInputs: ComputedInputResponse[];
|
|
672
732
|
globalComputedInputs: ComputedInputResponse[];
|
|
673
733
|
};
|
|
734
|
+
export type WorkspaceResponse = {
|
|
735
|
+
/** Workspace id. */
|
|
736
|
+
id: string;
|
|
737
|
+
/** Workspace name */
|
|
738
|
+
name: string;
|
|
739
|
+
/** Workspace description */
|
|
740
|
+
description?: string;
|
|
741
|
+
/** Workspace image */
|
|
742
|
+
imageUrl?: string;
|
|
743
|
+
};
|
|
744
|
+
export type WorkspacePageResponse = {
|
|
745
|
+
currentPage: number;
|
|
746
|
+
pageSize: number;
|
|
747
|
+
lastPage: number;
|
|
748
|
+
totalItems: number;
|
|
749
|
+
items: WorkspaceResponse[];
|
|
750
|
+
};
|
|
674
751
|
export type SimpleStackWithImageResponse = {
|
|
675
752
|
stackId: string;
|
|
676
753
|
name: string;
|
|
@@ -678,6 +755,13 @@ export type SimpleStackWithImageResponse = {
|
|
|
678
755
|
imageUrl?: string;
|
|
679
756
|
studio: StudioResponse;
|
|
680
757
|
};
|
|
758
|
+
export type PaginatedWorkspaceVariableResponse = {
|
|
759
|
+
currentPage: number;
|
|
760
|
+
pageSize: number;
|
|
761
|
+
lastPage: number;
|
|
762
|
+
totalItems: number;
|
|
763
|
+
items: WorkspaceVariableResponse[];
|
|
764
|
+
};
|
|
681
765
|
export type WorkflowCompleteResponse = {
|
|
682
766
|
workflowId: string;
|
|
683
767
|
name: string;
|
|
@@ -893,6 +977,14 @@ export type StackActionInputValuesByEnvInAccountContextResponse = {
|
|
|
893
977
|
input?: object;
|
|
894
978
|
inputs: object[];
|
|
895
979
|
};
|
|
980
|
+
export type AccountVariableUsageResponse = {
|
|
981
|
+
/** How many plugins are using this account variable */
|
|
982
|
+
pluginsInUse: number;
|
|
983
|
+
/** How many actions are using this account variable */
|
|
984
|
+
actionsInUse: number;
|
|
985
|
+
/** How many contexts are using this account variable */
|
|
986
|
+
contextsInUse: number;
|
|
987
|
+
};
|
|
896
988
|
export type StackResponse = {
|
|
897
989
|
stackId: string;
|
|
898
990
|
slug: string;
|
|
@@ -952,6 +1044,32 @@ export type AccountContextStackResponse = {
|
|
|
952
1044
|
hasVersionsWithContext: boolean;
|
|
953
1045
|
versions: StackVersionWksResponse[];
|
|
954
1046
|
};
|
|
1047
|
+
export function workspaceVariableControllerV2FindByName({ accountId, workspaceId, name }: {
|
|
1048
|
+
accountId?: string;
|
|
1049
|
+
workspaceId: string;
|
|
1050
|
+
name: string;
|
|
1051
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1052
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
1053
|
+
status: 200;
|
|
1054
|
+
data: WorkspaceVariableResponse;
|
|
1055
|
+
}>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/variables/${encodeURIComponent(name)}`, {
|
|
1056
|
+
...opts,
|
|
1057
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
1058
|
+
accountId
|
|
1059
|
+
})
|
|
1060
|
+
}));
|
|
1061
|
+
}
|
|
1062
|
+
export function workspaceVariableControllerV2Upsert({ workspaceId, name, upsertWorkspaceVariableRequest }: {
|
|
1063
|
+
workspaceId: string;
|
|
1064
|
+
name: string;
|
|
1065
|
+
upsertWorkspaceVariableRequest: UpsertWorkspaceVariableRequest;
|
|
1066
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1067
|
+
return oazapfts.ok(oazapfts.fetchText(`/v1/workspaces/${encodeURIComponent(workspaceId)}/variables/${encodeURIComponent(name)}`, oazapfts.json({
|
|
1068
|
+
...opts,
|
|
1069
|
+
method: "PUT",
|
|
1070
|
+
body: upsertWorkspaceVariableRequest
|
|
1071
|
+
})));
|
|
1072
|
+
}
|
|
955
1073
|
export function workflowWorkspaceControllerfindWorkflowStackContext({ workspaceId, stackId, workflowId }: {
|
|
956
1074
|
workspaceId: string;
|
|
957
1075
|
stackId: string;
|
|
@@ -1132,6 +1250,38 @@ export function workflowAccountControllerupdateWorkflowActions({ workflowId, wor
|
|
|
1132
1250
|
body: workflowActionsRequest
|
|
1133
1251
|
})));
|
|
1134
1252
|
}
|
|
1253
|
+
export function accountVariableControllerfindByName({ accountId, name }: {
|
|
1254
|
+
accountId?: string;
|
|
1255
|
+
name: string;
|
|
1256
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1257
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
1258
|
+
status: 200;
|
|
1259
|
+
data: AccountVariableResponse;
|
|
1260
|
+
}>(`/v1/account/variables/${encodeURIComponent(name)}`, {
|
|
1261
|
+
...opts,
|
|
1262
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
1263
|
+
accountId
|
|
1264
|
+
})
|
|
1265
|
+
}));
|
|
1266
|
+
}
|
|
1267
|
+
export function accountVariableControllerupdate({ name, updateAccountVariableRequest }: {
|
|
1268
|
+
name: string;
|
|
1269
|
+
updateAccountVariableRequest: UpdateAccountVariableRequest;
|
|
1270
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1271
|
+
return oazapfts.ok(oazapfts.fetchText(`/v1/account/variables/${encodeURIComponent(name)}`, oazapfts.json({
|
|
1272
|
+
...opts,
|
|
1273
|
+
method: "PUT",
|
|
1274
|
+
body: updateAccountVariableRequest
|
|
1275
|
+
})));
|
|
1276
|
+
}
|
|
1277
|
+
export function accountVariableControllerdelete({ name }: {
|
|
1278
|
+
name: string;
|
|
1279
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1280
|
+
return oazapfts.ok(oazapfts.fetchText(`/v1/account/variables/${encodeURIComponent(name)}`, {
|
|
1281
|
+
...opts,
|
|
1282
|
+
method: "DELETE"
|
|
1283
|
+
}));
|
|
1284
|
+
}
|
|
1135
1285
|
export function workflowStackControllerfindWorkflowStackContext({ stackId, workflowId }: {
|
|
1136
1286
|
stackId: string;
|
|
1137
1287
|
workflowId: string;
|
|
@@ -1200,19 +1350,6 @@ export function workspaceStackControlleraddStacksInWorkspace({ workspaceId, addS
|
|
|
1200
1350
|
body: addStackInWorkspaceRequest
|
|
1201
1351
|
})));
|
|
1202
1352
|
}
|
|
1203
|
-
export function sharedInfraControllercreateSharedInfra({ workspaceId, createSharedRequest }: {
|
|
1204
|
-
workspaceId: string;
|
|
1205
|
-
createSharedRequest: CreateSharedRequest;
|
|
1206
|
-
}, opts?: Oazapfts.RequestOpts) {
|
|
1207
|
-
return oazapfts.ok(oazapfts.fetchJson<{
|
|
1208
|
-
status: 200;
|
|
1209
|
-
data: CreateShareInfraResponse;
|
|
1210
|
-
}>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/shared-infra`, oazapfts.json({
|
|
1211
|
-
...opts,
|
|
1212
|
-
method: "POST",
|
|
1213
|
-
body: createSharedRequest
|
|
1214
|
-
})));
|
|
1215
|
-
}
|
|
1216
1353
|
export function connectionInterfaceControllercreateConnectionInterface({ workspaceId, createConnectionInterfaceRequest }: {
|
|
1217
1354
|
workspaceId: string;
|
|
1218
1355
|
createConnectionInterfaceRequest: CreateConnectionInterfaceRequest;
|
|
@@ -1226,19 +1363,6 @@ export function connectionInterfaceControllercreateConnectionInterface({ workspa
|
|
|
1226
1363
|
body: createConnectionInterfaceRequest
|
|
1227
1364
|
})));
|
|
1228
1365
|
}
|
|
1229
|
-
export function applicationControllercreateApp({ workspaceId, createAppRequest }: {
|
|
1230
|
-
workspaceId: string;
|
|
1231
|
-
createAppRequest: CreateAppRequest;
|
|
1232
|
-
}, opts?: Oazapfts.RequestOpts) {
|
|
1233
|
-
return oazapfts.ok(oazapfts.fetchJson<{
|
|
1234
|
-
status: 200;
|
|
1235
|
-
data: CreateApplicationResponse;
|
|
1236
|
-
}>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/applications`, oazapfts.json({
|
|
1237
|
-
...opts,
|
|
1238
|
-
method: "POST",
|
|
1239
|
-
body: createAppRequest
|
|
1240
|
-
})));
|
|
1241
|
-
}
|
|
1242
1366
|
export function contextControllerimportContextInWorkspace({ workspaceId, body }: {
|
|
1243
1367
|
workspaceId: string;
|
|
1244
1368
|
body: ImportContextRequest[];
|
|
@@ -1270,6 +1394,39 @@ export function workflowAccountControllercreateAccountWorkflow({ accountWorkflow
|
|
|
1270
1394
|
body: accountWorkflowCreateRequest
|
|
1271
1395
|
})));
|
|
1272
1396
|
}
|
|
1397
|
+
export function accountVariableControllerfindAll({ accountId, name, page, size, sortBy, sortDir }: {
|
|
1398
|
+
accountId?: string;
|
|
1399
|
+
name?: string;
|
|
1400
|
+
page?: number;
|
|
1401
|
+
size?: number;
|
|
1402
|
+
sortBy?: "NAME" | "VALUE" | "CREATED_AT";
|
|
1403
|
+
sortDir?: "ASC" | "DESC";
|
|
1404
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1405
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
1406
|
+
status: 200;
|
|
1407
|
+
data: PaginatedAccountVariableResponse;
|
|
1408
|
+
}>(`/v1/account/variables${QS.query(QS.explode({
|
|
1409
|
+
name,
|
|
1410
|
+
page,
|
|
1411
|
+
size,
|
|
1412
|
+
sortBy,
|
|
1413
|
+
sortDir
|
|
1414
|
+
}))}`, {
|
|
1415
|
+
...opts,
|
|
1416
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
1417
|
+
accountId
|
|
1418
|
+
})
|
|
1419
|
+
}));
|
|
1420
|
+
}
|
|
1421
|
+
export function accountVariableControllercreate({ createAccountVariableRequest }: {
|
|
1422
|
+
createAccountVariableRequest: CreateAccountVariableRequest;
|
|
1423
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1424
|
+
return oazapfts.ok(oazapfts.fetchText("/v1/account/variables", oazapfts.json({
|
|
1425
|
+
...opts,
|
|
1426
|
+
method: "POST",
|
|
1427
|
+
body: createAccountVariableRequest
|
|
1428
|
+
})));
|
|
1429
|
+
}
|
|
1273
1430
|
export function managerRunControllerarchiveApplication({ workspaceId, applicationId }: {
|
|
1274
1431
|
workspaceId: string;
|
|
1275
1432
|
applicationId: string;
|
|
@@ -1368,7 +1525,7 @@ export function contextStackControllergetWorkspaceContext({ workspaceId, stackVe
|
|
|
1368
1525
|
...opts
|
|
1369
1526
|
}));
|
|
1370
1527
|
}
|
|
1371
|
-
export function
|
|
1528
|
+
export function contextPluginControllergetConsolidatedPluginInputsWithConnectionInterfaces({ workspaceId, stackVersionId, pluginVersionId }: {
|
|
1372
1529
|
workspaceId: string;
|
|
1373
1530
|
stackVersionId: string;
|
|
1374
1531
|
pluginVersionId: string;
|
|
@@ -1380,7 +1537,7 @@ export function contextgetConsolidatedPluginInputsWithConnectionInterfaces({ wor
|
|
|
1380
1537
|
...opts
|
|
1381
1538
|
}));
|
|
1382
1539
|
}
|
|
1383
|
-
export function
|
|
1540
|
+
export function contextPluginControllergetConsolidatedPluginInputs({ workspaceId, stackVersionId, pluginVersionId, envName }: {
|
|
1384
1541
|
workspaceId: string;
|
|
1385
1542
|
stackVersionId: string;
|
|
1386
1543
|
pluginVersionId: string;
|
|
@@ -1410,7 +1567,7 @@ export function contextActionControllergetStackActionInputsInWorkspaceContext({
|
|
|
1410
1567
|
...opts
|
|
1411
1568
|
}));
|
|
1412
1569
|
}
|
|
1413
|
-
export function
|
|
1570
|
+
export function contextPluginControllergetAccountPluginInputs({ stackVersionId, pluginVersionId, envName }: {
|
|
1414
1571
|
stackVersionId: string;
|
|
1415
1572
|
pluginVersionId: string;
|
|
1416
1573
|
envName?: string;
|
|
@@ -1438,6 +1595,32 @@ export function contextActionControllergetStackActionInputsInAccountContext({ st
|
|
|
1438
1595
|
...opts
|
|
1439
1596
|
}));
|
|
1440
1597
|
}
|
|
1598
|
+
export function workspaceControllergetWorkspaces({ name, aclOnly, accountId, page, size, sortBy, sortDir }: {
|
|
1599
|
+
name?: string;
|
|
1600
|
+
aclOnly?: boolean;
|
|
1601
|
+
accountId?: string;
|
|
1602
|
+
page?: number;
|
|
1603
|
+
size?: number;
|
|
1604
|
+
sortBy?: "NAME" | "DESCRIPTION";
|
|
1605
|
+
sortDir?: "ASC" | "DESC";
|
|
1606
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1607
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
1608
|
+
status: 200;
|
|
1609
|
+
data: WorkspacePageResponse;
|
|
1610
|
+
}>(`/v1/workspaces${QS.query(QS.explode({
|
|
1611
|
+
name,
|
|
1612
|
+
aclOnly,
|
|
1613
|
+
page,
|
|
1614
|
+
size,
|
|
1615
|
+
sortBy,
|
|
1616
|
+
sortDir
|
|
1617
|
+
}))}`, {
|
|
1618
|
+
...opts,
|
|
1619
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
1620
|
+
accountId
|
|
1621
|
+
})
|
|
1622
|
+
}));
|
|
1623
|
+
}
|
|
1441
1624
|
export function workflowWorkspaceControllerlistStacks({ workspaceId, workflowId }: {
|
|
1442
1625
|
workspaceId: string;
|
|
1443
1626
|
workflowId: string;
|
|
@@ -1449,6 +1632,35 @@ export function workflowWorkspaceControllerlistStacks({ workspaceId, workflowId
|
|
|
1449
1632
|
...opts
|
|
1450
1633
|
}));
|
|
1451
1634
|
}
|
|
1635
|
+
export function workspaceVariableControllerV2FindAll({ workspaceId, accountId, page, size, sortBy, sortDir, mandate, name, showEmptyValues }: {
|
|
1636
|
+
workspaceId: string;
|
|
1637
|
+
accountId?: string;
|
|
1638
|
+
page?: number;
|
|
1639
|
+
size?: number;
|
|
1640
|
+
sortBy?: "NAME" | "VALUE" | "CREATED_AT";
|
|
1641
|
+
sortDir?: "ASC" | "DESC";
|
|
1642
|
+
mandate?: boolean;
|
|
1643
|
+
name?: string;
|
|
1644
|
+
showEmptyValues?: boolean;
|
|
1645
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1646
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
1647
|
+
status: 200;
|
|
1648
|
+
data: PaginatedWorkspaceVariableResponse;
|
|
1649
|
+
}>(`/v1/workspaces/${encodeURIComponent(workspaceId)}/variables${QS.query(QS.explode({
|
|
1650
|
+
page,
|
|
1651
|
+
size,
|
|
1652
|
+
sortBy,
|
|
1653
|
+
sortDir,
|
|
1654
|
+
mandate,
|
|
1655
|
+
name,
|
|
1656
|
+
showEmptyValues
|
|
1657
|
+
}))}`, {
|
|
1658
|
+
...opts,
|
|
1659
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
1660
|
+
accountId
|
|
1661
|
+
})
|
|
1662
|
+
}));
|
|
1663
|
+
}
|
|
1452
1664
|
export function workflowWorkspaceControllerlistWorkflowByStackIdAndWorkflowType({ workspaceId, stackId, workflowType }: {
|
|
1453
1665
|
workspaceId: string;
|
|
1454
1666
|
stackId: string;
|
|
@@ -1617,6 +1829,20 @@ export function contextControllergetStackActionInputsInAccountContext({ stackVer
|
|
|
1617
1829
|
...opts
|
|
1618
1830
|
}));
|
|
1619
1831
|
}
|
|
1832
|
+
export function accountVariableControllerusage({ accountId, name }: {
|
|
1833
|
+
accountId?: string;
|
|
1834
|
+
name: string;
|
|
1835
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
1836
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
1837
|
+
status: 200;
|
|
1838
|
+
data: AccountVariableUsageResponse;
|
|
1839
|
+
}>(`/v1/account/variables/${encodeURIComponent(name)}/usage`, {
|
|
1840
|
+
...opts,
|
|
1841
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
1842
|
+
accountId
|
|
1843
|
+
})
|
|
1844
|
+
}));
|
|
1845
|
+
}
|
|
1620
1846
|
export function accountStackControllerlistStacksByAccountWithWorkflow({ workspaceId }: {
|
|
1621
1847
|
workspaceId?: string;
|
|
1622
1848
|
}, opts?: Oazapfts.RequestOpts) {
|
package/src/client/content.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
addAction, addLink, addWorkspace, associateActionToPlugin, changeVisibility, createStudio, defaults,
|
|
3
4
|
deleteAction, deleteActionVersion, deleteLink, deletePluginVersion, deleteStudio, deleteV1StacksVersionsByStackVersionId,
|
|
4
|
-
delWorkspace, deprecateActionVersion, deprecatePluginVersion, deprecateStackVersionBy, downloadAction, getActionBySlug,
|
|
5
|
-
getActionsVersions, getActionVersionById, getAllActionVersions, getApplicationDetailsView, getApplicationsUsesPlugin,
|
|
6
|
-
getAvailableActionVersionsByActionSlug, getDependentPluginsVersions,
|
|
7
|
-
getGetPluginView, getInfrastructureEnvironmentsUsesPlugin,
|
|
8
|
-
getListOfInputs, getPluginInfrastructureView, getPluginModalView, getPluginVersions, getPluginVersionsNotInUse,
|
|
5
|
+
delWorkspace, deprecateActionVersion, deprecatePluginVersion, deprecateStackVersionBy, downloadAction, getActionBySlug,
|
|
6
|
+
getActionsVersions, getActionVersionById, getAllActionVersions, getApplicationDetailsView, getApplicationsUsesPlugin,
|
|
7
|
+
getAvailableActionVersionsByActionSlug, getDependentPluginsVersions,
|
|
8
|
+
getGetPluginView, getInfrastructureEnvironmentsUsesPlugin,
|
|
9
|
+
getListOfInputs, getPluginInfrastructureView, getPluginModalView, getPluginVersions, getPluginVersionsNotInUse,
|
|
9
10
|
getPluginVersionUsageSummary, getStackUsesPlugin, getStackVersionById, getStackVersionListByIds, getStackWorkspaceDetailView,
|
|
10
|
-
getStackWorkspaces, getStarterStackVersionsAndPluginsVersions, getStarterUsesPlugin, getStudioByIdOrSlug, getStudios1,
|
|
11
|
-
getStudiosToCreateButton, getStudioTabs, getUnusedStackVersions, getWorkflow, getWorkflowByStudioSlug, getWorkflowDoc,
|
|
12
|
-
listActions, listActions1,
|
|
11
|
+
getStackWorkspaces, getStarterStackVersionsAndPluginsVersions, getStarterUsesPlugin, getStudioByIdOrSlug, getStudios, getStudios1,
|
|
12
|
+
getStudiosToCreateButton, getStudioTabs, getUnusedStackVersions, getWorkflow, getWorkflowByStudioSlug, getWorkflowDoc,
|
|
13
|
+
listActions, listActions1,
|
|
13
14
|
listActionsByFilters1, listConnectionInterfaceTypes, listLinksByStackVersion, listPlugins, listPluginVersionByIdsController,
|
|
14
|
-
listReasons, listStacksByFilters, listStarters, listWorkflowVersion,
|
|
15
|
+
listReasons, listStacksByFilters, listStarters, listWorkflowVersion,
|
|
15
16
|
listWorkspaces, patchStarterV2, removeActionFromPlugin, stackModalViewSummary,
|
|
16
|
-
stackVersionUsageSummary, updateStudio, updateStudioTabs
|
|
17
|
+
stackVersionUsageSummary, updateStudio, updateStudioTabs,
|
|
18
|
+
} from '../api/content'
|
|
17
19
|
import apis from '../apis.json'
|
|
18
20
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
19
21
|
import { cntDictionary } from '../error/dictionary/cnt'
|
|
@@ -50,6 +52,10 @@ class ContentClient extends ReactQueryNetworkClient {
|
|
|
50
52
|
* Gets all studios
|
|
51
53
|
*/
|
|
52
54
|
studios = this.query(removeAuthorizationParam(getStudios1))
|
|
55
|
+
/**
|
|
56
|
+
* Gets all studios
|
|
57
|
+
*/
|
|
58
|
+
studiosWithPagination = this.query(removeAuthorizationParam(getStudios))
|
|
53
59
|
/**
|
|
54
60
|
* Gets all studios
|
|
55
61
|
*/
|
|
@@ -102,7 +108,7 @@ class ContentClient extends ReactQueryNetworkClient {
|
|
|
102
108
|
* Gets stacks from a given studio
|
|
103
109
|
*/
|
|
104
110
|
stacksFromStudios = this.query(listStacksByFilters)
|
|
105
|
-
|
|
111
|
+
|
|
106
112
|
//Workflow
|
|
107
113
|
/**
|
|
108
114
|
* Gets workflows from a given studio
|
|
@@ -283,7 +289,7 @@ class ContentClient extends ReactQueryNetworkClient {
|
|
|
283
289
|
/**
|
|
284
290
|
* Gets the inputs of a specific Action. This fn is only used for permission purposes.
|
|
285
291
|
*/
|
|
286
|
-
actionInputs = this.query(getListOfInputs) as
|
|
292
|
+
actionInputs = this.query(getListOfInputs) as
|
|
287
293
|
OperationObject<Parameters<typeof getListOfInputs>[0]>
|
|
288
294
|
/**
|
|
289
295
|
* Gets action versions by ids
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
contextControllerupsertPluginAccountContext,
|
|
11
11
|
contextControllerupsertPluginWorkspaceContext,
|
|
12
12
|
contextControllerupsertWorkspaceActionsInputContext,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
contextPluginControllergetAccountPluginInputs,
|
|
14
|
+
contextPluginControllergetConsolidatedPluginInputs,
|
|
15
|
+
contextPluginControllergetConsolidatedPluginInputsWithConnectionInterfaces,
|
|
16
16
|
defaults,
|
|
17
17
|
managerRunControllerdeleteApplication,
|
|
18
18
|
managerRunControllerdeleteSharedInfra,
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
sharedInfraControllergetSharedInfraAppliedPlugins,
|
|
22
22
|
workflowWorkspaceControllerlistWorkflowByStackIdAndWorkflowType,
|
|
23
23
|
workspaceControllerdelete,
|
|
24
|
+
workspaceControllergetWorkspaces,
|
|
24
25
|
workspaceStackControlleraddStacksInWorkspace,
|
|
25
26
|
workspaceStackControllerdeleteStacksInWorkspace,
|
|
26
27
|
workspaceStackControllerlistStacks,
|
|
@@ -91,11 +92,11 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
|
91
92
|
*/
|
|
92
93
|
pluginInputsInWorkspace = this.query({
|
|
93
94
|
name: 'pluginInputsInWorkspace',
|
|
94
|
-
request: async (signal, variables: Parameters<typeof
|
|
95
|
-
const data = await
|
|
95
|
+
request: async (signal, variables: Parameters<typeof contextPluginControllergetConsolidatedPluginInputs>[0]) => {
|
|
96
|
+
const data = await contextPluginControllergetConsolidatedPluginInputs(variables, { signal })
|
|
96
97
|
return data as FixedFullInputContextResponse
|
|
97
98
|
},
|
|
98
|
-
permission: async ({ workspaceId, stackVersionId }: Parameters<typeof
|
|
99
|
+
permission: async ({ workspaceId, stackVersionId }: Parameters<typeof contextPluginControllergetConsolidatedPluginInputs>[0]) => {
|
|
99
100
|
const canViewContext = await workspaceClient.listConsolidatedWorkspaceContext.isAllowed({ $type: 'plugin', workspaceId, stackVersionId })
|
|
100
101
|
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
101
102
|
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
@@ -107,11 +108,11 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
|
107
108
|
*/
|
|
108
109
|
pluginInputsAccount = this.query({
|
|
109
110
|
name: 'pluginInputsAccount',
|
|
110
|
-
request: async (signal, variables: Parameters<typeof
|
|
111
|
-
const data = await
|
|
111
|
+
request: async (signal, variables: Parameters<typeof contextPluginControllergetAccountPluginInputs>[0]) => {
|
|
112
|
+
const data = await contextPluginControllergetAccountPluginInputs(variables, { signal })
|
|
112
113
|
return data as FixedFullInputContextResponse
|
|
113
114
|
},
|
|
114
|
-
permission: async ({ stackVersionId }: Parameters<typeof
|
|
115
|
+
permission: async ({ stackVersionId }: Parameters<typeof contextPluginControllergetAccountPluginInputs>[0]) => {
|
|
115
116
|
const canViewContext = await workspaceClient.listConsolidatedContext.isAllowed({ $type: 'plugin', stackVersionId })
|
|
116
117
|
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
117
118
|
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
@@ -157,7 +158,7 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
|
157
158
|
/**
|
|
158
159
|
* Gets plugin inputs and connection interface from a plugin in a stack version in workspace
|
|
159
160
|
*/
|
|
160
|
-
pluginInputsWithConnectionInterfaces = this.query(
|
|
161
|
+
pluginInputsWithConnectionInterfaces = this.query(contextPluginControllergetConsolidatedPluginInputsWithConnectionInterfaces as unknown as ReplaceResult<typeof contextPluginControllergetConsolidatedPluginInputsWithConnectionInterfaces, FixedPluginForAppCreationV2Response>)
|
|
161
162
|
/**
|
|
162
163
|
* Gets workflows from a given stack and workflow type
|
|
163
164
|
*/
|
|
@@ -253,6 +254,10 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
|
253
254
|
* Updates Stacks To Latest Version By Workspace
|
|
254
255
|
*/
|
|
255
256
|
updateStacksToLatestVersionByWorkspace = this.mutation(workspaceStackControllerrefreshStacksInWorkspace)
|
|
257
|
+
/**
|
|
258
|
+
* Get all workspaces with pagination
|
|
259
|
+
*/
|
|
260
|
+
workspacesWithPagination = this.query(workspaceControllergetWorkspaces)
|
|
256
261
|
}
|
|
257
262
|
|
|
258
263
|
export const workspaceManagerClient = new WorkspaceManagerClient()
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Dictionary, Language } from '@stack-spot/portal-translate'
|
|
2
2
|
import { every, isString } from 'lodash'
|
|
3
3
|
import { ErrorResponse, ValidationDetails } from '../api/account'
|
|
4
|
-
import { StackspotAPIError } from './StackspotAPIError'
|
|
4
|
+
import { ErrorDetailsProperties, StackspotAPIError } from './StackspotAPIError'
|
|
5
5
|
import { baseDictionary } from './dictionary/base'
|
|
6
6
|
import { cntFields } from './dictionary/cnt-fields'
|
|
7
7
|
import { workspaceFields } from './dictionary/workspace-fields'
|
|
8
|
+
import { workspaceDetails } from './dictionary/workspace-details'
|
|
9
|
+
import { actionDetails } from './dictionary/action-details'
|
|
8
10
|
|
|
9
11
|
// these details don't say anything the status already doesn't and we'd better use local translations for them.
|
|
10
12
|
const ignoredDescriptions = [
|
|
@@ -16,6 +18,11 @@ const fieldDictionary = {
|
|
|
16
18
|
wks: workspaceFields,
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
const detailsDictionary = {
|
|
22
|
+
wks: workspaceDetails,
|
|
23
|
+
actionapi: actionDetails,
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
function getTitle(status: number, raw: ErrorResponse, dictionary: Dictionary, language: Language) {
|
|
20
27
|
if (dictionary[language][raw.code]) return dictionary[language][raw.code]
|
|
21
28
|
if (raw.details && !ignoredDescriptions.includes(raw.details)) return raw.details
|
|
@@ -26,16 +33,22 @@ function getValues(detail: ValidationDetails) {
|
|
|
26
33
|
return detail.values && every(detail.values, isString) ? `\n${detail.values.join('\n')}` : ''
|
|
27
34
|
}
|
|
28
35
|
|
|
29
|
-
function createMessage(status: number, raw: ErrorResponse, dictionary: Dictionary, language
|
|
30
|
-
const title = getTitle(status, raw, dictionary, language)
|
|
31
|
-
if (!raw.validationDetails?.length) return title
|
|
36
|
+
function createMessage(status: number, raw: ErrorResponse, dictionary: Dictionary, language?: Language): ErrorDetailsProperties {
|
|
37
|
+
const title = getTitle(status, raw, dictionary, language || 'en')
|
|
32
38
|
const api = raw.code?.split(/[-_]/)[0]
|
|
39
|
+
const dictDetails = (detailsDictionary[api?.toLowerCase() as keyof typeof detailsDictionary] ?? {})[language || 'en']
|
|
40
|
+
const dictionaryDetails = raw.code && dictDetails ? dictDetails[raw.code] : {}
|
|
41
|
+
|
|
42
|
+
if (!raw.validationDetails?.length) return { description : title, ...dictionaryDetails }
|
|
43
|
+
|
|
33
44
|
const details = raw.validationDetails?.map((detail) => {
|
|
34
|
-
const dict: Record<string, string> = (fieldDictionary[api?.toLowerCase() as keyof typeof fieldDictionary] ?? {})[language] ?? {}
|
|
35
|
-
const name = dict[detail.code] || detail.field ||
|
|
45
|
+
const dict: Record<string, string> = (fieldDictionary[api?.toLowerCase() as keyof typeof fieldDictionary] ?? {})[language || 'en'] ?? {}
|
|
46
|
+
const name = dict[detail.code] || detail.field ||
|
|
47
|
+
(raw.code !== detail.code && dictionary[language || 'en'][detail.code]) || detail.details || ''
|
|
36
48
|
return `${name}${getValues(detail)}`
|
|
37
49
|
})?.filter(d => !!d)
|
|
38
|
-
|
|
50
|
+
|
|
51
|
+
return { description: details ? `${title}\n${details?.join('\n')}` : title, ...dictionaryDetails }
|
|
39
52
|
}
|
|
40
53
|
|
|
41
54
|
/**
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
import { Language, getLanguage } from '@stack-spot/portal-translate'
|
|
2
2
|
|
|
3
|
-
export type InternationalizedMessage = (language: Language) => string
|
|
3
|
+
export type InternationalizedMessage = (language: Language) => string | ErrorDetailsProperties
|
|
4
|
+
|
|
5
|
+
export interface ErrorDetailsProperties {
|
|
6
|
+
/**
|
|
7
|
+
* The error title
|
|
8
|
+
*/
|
|
9
|
+
title?: string,
|
|
10
|
+
/**
|
|
11
|
+
* The error description
|
|
12
|
+
*/
|
|
13
|
+
description?: string,
|
|
14
|
+
/**
|
|
15
|
+
* Label for link
|
|
16
|
+
*/
|
|
17
|
+
linkLabel?: string,
|
|
18
|
+
/**
|
|
19
|
+
* Text for href of link
|
|
20
|
+
*/
|
|
21
|
+
linkHref?: string,
|
|
22
|
+
}
|
|
4
23
|
|
|
5
24
|
interface ErrorProperties {
|
|
6
25
|
/**
|
|
@@ -20,11 +39,17 @@ interface ErrorProperties {
|
|
|
20
39
|
*
|
|
21
40
|
* If not provided, will attempt to use the error code or 'unknown'.
|
|
22
41
|
*/
|
|
23
|
-
message?: InternationalizedMessage | string,
|
|
42
|
+
message?: InternationalizedMessage | string | ErrorDetailsProperties,
|
|
24
43
|
/**
|
|
25
44
|
* The error's stack trace, if any.
|
|
26
45
|
*/
|
|
27
46
|
stack?: string,
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function getMessage(error: ErrorProperties['message']) {
|
|
51
|
+
const message = typeof error === 'function' ? error('en') : error
|
|
52
|
+
return typeof message === 'string' ? message : message?.description
|
|
28
53
|
}
|
|
29
54
|
|
|
30
55
|
export class StackspotAPIError extends Error {
|
|
@@ -43,12 +68,12 @@ export class StackspotAPIError extends Error {
|
|
|
43
68
|
private intl?: InternationalizedMessage
|
|
44
69
|
|
|
45
70
|
constructor({ status, code, headers, message, stack }: ErrorProperties) {
|
|
46
|
-
super(`Stackspot API error (network ${status}): ${
|
|
71
|
+
super(`Stackspot API error (network ${status}): ${getMessage(message)}`)
|
|
47
72
|
this.status = status
|
|
48
73
|
this.code = code
|
|
49
74
|
this.headers = headers
|
|
50
75
|
this.stack = stack
|
|
51
|
-
this.intl = typeof message === 'string' ?
|
|
76
|
+
this.intl = typeof message === 'string' || typeof message === 'object' ? () => message : message
|
|
52
77
|
}
|
|
53
78
|
|
|
54
79
|
/**
|
|
@@ -56,8 +81,21 @@ export class StackspotAPIError extends Error {
|
|
|
56
81
|
* @param language
|
|
57
82
|
* @returns an error message
|
|
58
83
|
*/
|
|
59
|
-
translate(language: Language = getLanguage()) {
|
|
84
|
+
translate(language: Language = getLanguage()): string {
|
|
85
|
+
const unknown = language === 'en' ? 'unknown error' : 'erro desconhecido'
|
|
86
|
+
|
|
87
|
+
const error = this.intl?.(language)
|
|
88
|
+
const message = typeof error === 'string' ? error : error?.description
|
|
89
|
+
return message ?? this.message ?? this.code ?? (this.status === 0 ? unknown : `${this.status}`)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
translateDetails(language: Language = getLanguage()): ErrorDetailsProperties {
|
|
60
93
|
const unknown = language === 'en' ? 'unknown error' : 'erro desconhecido'
|
|
61
|
-
|
|
94
|
+
const errorMessage = this.intl?.(language)
|
|
95
|
+
if (typeof errorMessage === 'string')
|
|
96
|
+
return { description: errorMessage }
|
|
97
|
+
if (typeof errorMessage === 'object')
|
|
98
|
+
return errorMessage
|
|
99
|
+
return { description: this.message ?? this.code ?? (this.status === 0 ? unknown : `${this.status}`) }
|
|
62
100
|
}
|
|
63
101
|
}
|