@stack-spot/portal-network 0.3.0 → 0.4.0-beta.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 +15 -0
- package/dist/api/account.d.ts +2368 -0
- package/dist/api/account.d.ts.map +1 -0
- package/dist/api/account.js +1521 -0
- package/dist/api/account.js.map +1 -0
- package/dist/api/ai.d.ts +1432 -0
- package/dist/api/ai.d.ts.map +1 -0
- package/dist/api/ai.js +1342 -0
- package/dist/api/ai.js.map +1 -0
- package/dist/api/apiRuntime.d.ts +922 -0
- package/dist/api/apiRuntime.d.ts.map +1 -0
- package/dist/api/apiRuntime.js +599 -0
- package/dist/api/apiRuntime.js.map +1 -0
- package/dist/api/cloudAccount.d.ts +473 -0
- package/dist/api/cloudAccount.d.ts.map +1 -0
- package/dist/api/cloudAccount.js +300 -0
- package/dist/api/cloudAccount.js.map +1 -0
- package/dist/api/cloudServices.d.ts +1233 -0
- package/dist/api/cloudServices.d.ts.map +1 -0
- package/dist/api/cloudServices.js +715 -0
- package/dist/api/cloudServices.js.map +1 -0
- package/dist/api/insights.d.ts +123 -0
- package/dist/api/insights.d.ts.map +1 -0
- package/dist/api/insights.js +112 -0
- package/dist/api/insights.js.map +1 -0
- package/dist/api/secrets.d.ts +100 -0
- package/dist/api/secrets.d.ts.map +1 -0
- package/dist/api/secrets.js +101 -0
- package/dist/api/secrets.js.map +1 -0
- package/dist/api/serviceCatalog.d.ts +737 -0
- package/dist/api/serviceCatalog.d.ts.map +1 -0
- package/dist/api/serviceCatalog.js +611 -0
- package/dist/api/serviceCatalog.js.map +1 -0
- package/dist/api/workflows.d.ts +366 -0
- package/dist/api/workflows.d.ts.map +1 -0
- package/dist/api/workflows.js +175 -0
- package/dist/api/workflows.js.map +1 -0
- package/dist/api/workspace.js +1476 -0
- package/dist/api/workspace.js.map +1 -0
- package/dist/api/workspaceManager.d.ts +1121 -0
- package/dist/api/workspaceManager.d.ts.map +1 -0
- package/dist/api/workspaceManager.js +357 -0
- package/dist/api/workspaceManager.js.map +1 -0
- package/dist/api/workspaceSearchEngine.d.ts +93 -0
- package/dist/api/workspaceSearchEngine.d.ts.map +1 -0
- package/dist/api/workspaceSearchEngine.js +55 -0
- package/dist/api/workspaceSearchEngine.js.map +1 -0
- package/dist/apis.json +129 -0
- package/dist/client/account.d.ts +449 -0
- package/dist/client/account.d.ts.map +1 -0
- package/dist/client/account.js +501 -0
- package/dist/client/account.js.map +1 -0
- package/dist/client/secrets.d.ts +50 -0
- package/dist/client/secrets.d.ts.map +1 -0
- package/dist/client/secrets.js +78 -0
- package/dist/client/secrets.js.map +1 -0
- package/dist/error/CanceledError.d.ts +8 -0
- package/dist/error/CanceledError.d.ts.map +1 -0
- package/dist/error/CanceledError.js +10 -0
- package/dist/error/CanceledError.js.map +1 -0
- package/dist/error/DefaultAPIError.d.ts +34 -0
- package/dist/error/DefaultAPIError.d.ts.map +1 -0
- package/dist/error/DefaultAPIError.js +82 -0
- package/dist/error/DefaultAPIError.js.map +1 -0
- package/dist/error/StackspotAPIError.d.ts +50 -0
- package/dist/error/StackspotAPIError.d.ts.map +1 -0
- package/dist/error/StackspotAPIError.js +54 -0
- package/dist/error/StackspotAPIError.js.map +1 -0
- package/dist/error/dictionary/account.d.ts +57 -0
- package/dist/error/dictionary/account.d.ts.map +1 -0
- package/dist/error/dictionary/account.js +57 -0
- package/dist/error/dictionary/account.js.map +1 -0
- package/dist/error/dictionary/action.d.ts +163 -0
- package/dist/error/dictionary/action.d.ts.map +1 -0
- package/dist/error/dictionary/action.js +163 -0
- package/dist/error/dictionary/action.js.map +1 -0
- package/dist/error/dictionary/base.d.ts +21 -0
- package/dist/error/dictionary/base.d.ts.map +1 -0
- package/dist/error/dictionary/base.js +21 -0
- package/dist/error/dictionary/base.js.map +1 -0
- package/dist/error/dictionary/cnt-fields.d.ts +13 -0
- package/dist/error/dictionary/cnt-fields.d.ts.map +1 -0
- package/dist/error/dictionary/cnt-fields.js +13 -0
- package/dist/error/dictionary/cnt-fields.js.map +1 -0
- package/dist/error/dictionary/cnt.d.ts +79 -0
- package/dist/error/dictionary/cnt.d.ts.map +1 -0
- package/dist/error/dictionary/cnt.js +79 -0
- package/dist/error/dictionary/cnt.js.map +1 -0
- package/dist/error/dictionary/rte.d.ts +23 -0
- package/dist/error/dictionary/rte.d.ts.map +1 -0
- package/dist/error/dictionary/rte.js +23 -0
- package/dist/error/dictionary/rte.js.map +1 -0
- package/dist/error/dictionary/rtm.d.ts +9 -0
- package/dist/error/dictionary/rtm.d.ts.map +1 -0
- package/dist/error/dictionary/rtm.js +9 -0
- package/dist/error/dictionary/rtm.js.map +1 -0
- package/dist/error/dictionary/secrets.d.ts +13 -0
- package/dist/error/dictionary/secrets.d.ts.map +1 -0
- package/dist/error/dictionary/secrets.js +13 -0
- package/dist/error/dictionary/secrets.js.map +1 -0
- package/dist/error/dictionary/workspace-fields.d.ts +9 -0
- package/dist/error/dictionary/workspace-fields.d.ts.map +1 -0
- package/dist/error/dictionary/workspace-fields.js +9 -0
- package/dist/error/dictionary/workspace-fields.js.map +1 -0
- package/dist/error/dictionary/workspace.d.ts +99 -0
- package/dist/error/dictionary/workspace.d.ts.map +1 -0
- package/dist/error/dictionary/workspace.js +99 -0
- package/dist/error/dictionary/workspace.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/network/AutoInfiniteQuery.d.ts +23 -0
- package/dist/network/AutoInfiniteQuery.d.ts.map +1 -0
- package/dist/network/AutoInfiniteQuery.js +70 -0
- package/dist/network/AutoInfiniteQuery.js.map +1 -0
- package/dist/network/AutoMutation.d.ts +10 -0
- package/dist/network/AutoMutation.d.ts.map +1 -0
- package/dist/network/AutoMutation.js +20 -0
- package/dist/network/AutoMutation.js.map +1 -0
- package/dist/network/AutoOperation.d.ts +19 -0
- package/dist/network/AutoOperation.d.ts.map +1 -0
- package/dist/network/AutoOperation.js +105 -0
- package/dist/network/AutoOperation.js.map +1 -0
- package/dist/network/AutoQuery.d.ts +19 -0
- package/dist/network/AutoQuery.d.ts.map +1 -0
- package/dist/network/AutoQuery.js +73 -0
- package/dist/network/AutoQuery.js.map +1 -0
- package/dist/network/ManualInfiniteQuery.d.ts +26 -0
- package/dist/network/ManualInfiniteQuery.d.ts.map +1 -0
- package/dist/network/ManualInfiniteQuery.js +62 -0
- package/dist/network/ManualInfiniteQuery.js.map +1 -0
- package/dist/network/ManualMutation.d.ts +11 -0
- package/dist/network/ManualMutation.d.ts.map +1 -0
- package/dist/network/ManualMutation.js +35 -0
- package/dist/network/ManualMutation.js.map +1 -0
- package/dist/network/ManualOperation.d.ts +14 -0
- package/dist/network/ManualOperation.d.ts.map +1 -0
- package/dist/network/ManualOperation.js +64 -0
- package/dist/network/ManualOperation.js.map +1 -0
- package/dist/network/ManualQuery.d.ts +20 -0
- package/dist/network/ManualQuery.d.ts.map +1 -0
- package/dist/network/ManualQuery.js +80 -0
- package/dist/network/ManualQuery.js.map +1 -0
- package/dist/network/NetworkClient.d.ts +58 -0
- package/dist/network/NetworkClient.d.ts.map +1 -0
- package/dist/network/NetworkClient.js +107 -0
- package/dist/network/NetworkClient.js.map +1 -0
- package/dist/network/ReactQueryNetworkClient.d.ts +78 -0
- package/dist/network/ReactQueryNetworkClient.d.ts.map +1 -0
- package/dist/network/ReactQueryNetworkClient.js +134 -0
- package/dist/network/ReactQueryNetworkClient.js.map +1 -0
- package/dist/network/react-query-client.d.ts +6 -0
- package/dist/network/react-query-client.d.ts.map +1 -0
- package/dist/network/react-query-client.js +6 -0
- package/dist/network/react-query-client.js.map +1 -0
- package/dist/network/types.d.ts +235 -0
- package/dist/network/types.d.ts.map +1 -0
- package/dist/network/types.js +2 -0
- package/dist/network/types.js.map +1 -0
- package/dist/utils/use-extended-list.d.ts +39 -0
- package/dist/utils/use-extended-list.d.ts.map +1 -0
- package/dist/utils/use-extended-list.js +36 -0
- package/dist/utils/use-extended-list.js.map +1 -0
- package/package.json +2 -3
- package/src/api/secrets.ts +279 -0
- package/src/apis.json +8 -0
- package/src/client/account.ts +124 -3
- package/src/client/secrets.ts +56 -0
- package/src/error/DefaultAPIError.ts +4 -5
- package/src/error/dictionary/account.ts +2 -0
- package/src/error/dictionary/secrets.ts +14 -0
- package/src/index.ts +1 -0
- package/src/network/AutoQuery.ts +3 -1
- package/src/network/ManualInfiniteQuery.ts +4 -1
- package/src/network/ManualMutation.ts +2 -0
- package/src/network/ManualOperation.ts +16 -5
- package/src/network/ManualQuery.ts +2 -0
- package/src/network/ReactQueryNetworkClient.ts +9 -16
- package/src/network/types.ts +1 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace Secrets API
|
|
3
|
+
* v1.0.0
|
|
4
|
+
* DO NOT MODIFY - This file has been generated using oazapfts.
|
|
5
|
+
* See https://www.npmjs.com/package/oazapfts
|
|
6
|
+
*/
|
|
7
|
+
import * as Oazapfts from "@oazapfts/runtime";
|
|
8
|
+
import * as QS from "@oazapfts/runtime/query";
|
|
9
|
+
export const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders> = {
|
|
10
|
+
headers: {},
|
|
11
|
+
baseUrl: "https://workspace-workspace-secrets-api.dev.stackspot.com",
|
|
12
|
+
};
|
|
13
|
+
const oazapfts = Oazapfts.runtime(defaults);
|
|
14
|
+
export const servers = {
|
|
15
|
+
generatedServerUrl: "https://workspace-workspace-secrets-api.dev.stackspot.com"
|
|
16
|
+
};
|
|
17
|
+
export type SecretValueResponse = {
|
|
18
|
+
key: string;
|
|
19
|
+
description: string;
|
|
20
|
+
value: string;
|
|
21
|
+
};
|
|
22
|
+
export type ValidationDetails = {
|
|
23
|
+
code: string;
|
|
24
|
+
field?: string;
|
|
25
|
+
details?: string;
|
|
26
|
+
values?: string[];
|
|
27
|
+
};
|
|
28
|
+
export type ErrorResponse = {
|
|
29
|
+
code: string;
|
|
30
|
+
status: number;
|
|
31
|
+
details: string;
|
|
32
|
+
validationDetails?: ValidationDetails[];
|
|
33
|
+
};
|
|
34
|
+
export type UpdateSecretValueRequest = {
|
|
35
|
+
value: string;
|
|
36
|
+
};
|
|
37
|
+
export type EditKeyRequest = {
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
export type SecretKeyResponse = {
|
|
41
|
+
key: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
export type CreateKeyRequest = {
|
|
45
|
+
key: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
export type SecretAvailabilityResponse = {
|
|
49
|
+
definedKeys: string[];
|
|
50
|
+
undefinedKeys: string[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Get a Secret Key value.
|
|
54
|
+
*/
|
|
55
|
+
export function getSecretValue({ key, executionId }: {
|
|
56
|
+
key: string;
|
|
57
|
+
executionId?: string;
|
|
58
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
59
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
60
|
+
status: 200;
|
|
61
|
+
data: SecretValueResponse;
|
|
62
|
+
} | {
|
|
63
|
+
status: 400;
|
|
64
|
+
data: ErrorResponse;
|
|
65
|
+
} | {
|
|
66
|
+
status: 403;
|
|
67
|
+
data: ErrorResponse;
|
|
68
|
+
} | {
|
|
69
|
+
status: 422;
|
|
70
|
+
data: ErrorResponse;
|
|
71
|
+
} | {
|
|
72
|
+
status: 500;
|
|
73
|
+
data: ErrorResponse;
|
|
74
|
+
}>(`/v1/secrets/values/${encodeURIComponent(key)}${QS.query(QS.explode({
|
|
75
|
+
executionId
|
|
76
|
+
}))}`, {
|
|
77
|
+
...opts
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Edit a Secret Key value.
|
|
82
|
+
*/
|
|
83
|
+
export function updateSecretValue({ key, updateSecretValueRequest }: {
|
|
84
|
+
key: string;
|
|
85
|
+
updateSecretValueRequest: UpdateSecretValueRequest;
|
|
86
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
87
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
88
|
+
status: 204;
|
|
89
|
+
} | {
|
|
90
|
+
status: 400;
|
|
91
|
+
data: ErrorResponse;
|
|
92
|
+
} | {
|
|
93
|
+
status: 403;
|
|
94
|
+
data: ErrorResponse;
|
|
95
|
+
} | {
|
|
96
|
+
status: 422;
|
|
97
|
+
data: ErrorResponse;
|
|
98
|
+
} | {
|
|
99
|
+
status: 500;
|
|
100
|
+
data: ErrorResponse;
|
|
101
|
+
}>(`/v1/secrets/values/${encodeURIComponent(key)}`, oazapfts.json({
|
|
102
|
+
...opts,
|
|
103
|
+
method: "PUT",
|
|
104
|
+
body: updateSecretValueRequest
|
|
105
|
+
})));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Delete a Secret Key value.
|
|
109
|
+
*/
|
|
110
|
+
export function deleteSecretValue({ key }: {
|
|
111
|
+
key: string;
|
|
112
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
113
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
114
|
+
status: 204;
|
|
115
|
+
} | {
|
|
116
|
+
status: 400;
|
|
117
|
+
data: ErrorResponse;
|
|
118
|
+
} | {
|
|
119
|
+
status: 403;
|
|
120
|
+
data: ErrorResponse;
|
|
121
|
+
} | {
|
|
122
|
+
status: 422;
|
|
123
|
+
data: ErrorResponse;
|
|
124
|
+
} | {
|
|
125
|
+
status: 500;
|
|
126
|
+
data: ErrorResponse;
|
|
127
|
+
}>(`/v1/secrets/values/${encodeURIComponent(key)}`, {
|
|
128
|
+
...opts,
|
|
129
|
+
method: "DELETE"
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Edit a Secret Key.
|
|
134
|
+
*/
|
|
135
|
+
export function editKey({ key, editKeyRequest }: {
|
|
136
|
+
key: string;
|
|
137
|
+
editKeyRequest: EditKeyRequest;
|
|
138
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
139
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
140
|
+
status: 200;
|
|
141
|
+
} | {
|
|
142
|
+
status: 400;
|
|
143
|
+
data: ErrorResponse;
|
|
144
|
+
} | {
|
|
145
|
+
status: 403;
|
|
146
|
+
data: ErrorResponse;
|
|
147
|
+
} | {
|
|
148
|
+
status: 422;
|
|
149
|
+
data: ErrorResponse;
|
|
150
|
+
} | {
|
|
151
|
+
status: 500;
|
|
152
|
+
data: ErrorResponse;
|
|
153
|
+
}>(`/v1/secrets/keys/${encodeURIComponent(key)}`, oazapfts.json({
|
|
154
|
+
...opts,
|
|
155
|
+
method: "PUT",
|
|
156
|
+
body: editKeyRequest
|
|
157
|
+
})));
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Delete a Secret Key.
|
|
161
|
+
*/
|
|
162
|
+
export function deleteKey({ key }: {
|
|
163
|
+
key: string;
|
|
164
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
165
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
166
|
+
status: 204;
|
|
167
|
+
} | {
|
|
168
|
+
status: 400;
|
|
169
|
+
data: ErrorResponse;
|
|
170
|
+
} | {
|
|
171
|
+
status: 403;
|
|
172
|
+
data: ErrorResponse;
|
|
173
|
+
} | {
|
|
174
|
+
status: 422;
|
|
175
|
+
data: ErrorResponse;
|
|
176
|
+
} | {
|
|
177
|
+
status: 500;
|
|
178
|
+
data: ErrorResponse;
|
|
179
|
+
}>(`/v1/secrets/keys/${encodeURIComponent(key)}`, {
|
|
180
|
+
...opts,
|
|
181
|
+
method: "DELETE"
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* List all Secret Keys.
|
|
186
|
+
*/
|
|
187
|
+
export function getAll1(opts?: Oazapfts.RequestOpts) {
|
|
188
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
189
|
+
status: 200;
|
|
190
|
+
data: SecretKeyResponse[];
|
|
191
|
+
} | {
|
|
192
|
+
status: 400;
|
|
193
|
+
data: ErrorResponse;
|
|
194
|
+
} | {
|
|
195
|
+
status: 403;
|
|
196
|
+
data: ErrorResponse;
|
|
197
|
+
} | {
|
|
198
|
+
status: 422;
|
|
199
|
+
data: ErrorResponse;
|
|
200
|
+
} | {
|
|
201
|
+
status: 500;
|
|
202
|
+
data: ErrorResponse;
|
|
203
|
+
}>("/v1/secrets/keys", {
|
|
204
|
+
...opts
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Create a new Secret Key.
|
|
209
|
+
*/
|
|
210
|
+
export function createKey({ createKeyRequest }: {
|
|
211
|
+
createKeyRequest: CreateKeyRequest;
|
|
212
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
213
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
214
|
+
status: 201;
|
|
215
|
+
} | {
|
|
216
|
+
status: 400;
|
|
217
|
+
data: ErrorResponse;
|
|
218
|
+
} | {
|
|
219
|
+
status: 403;
|
|
220
|
+
data: ErrorResponse;
|
|
221
|
+
} | {
|
|
222
|
+
status: 422;
|
|
223
|
+
data: ErrorResponse;
|
|
224
|
+
} | {
|
|
225
|
+
status: 500;
|
|
226
|
+
data: ErrorResponse;
|
|
227
|
+
}>("/v1/secrets/keys", oazapfts.json({
|
|
228
|
+
...opts,
|
|
229
|
+
method: "POST",
|
|
230
|
+
body: createKeyRequest
|
|
231
|
+
})));
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* List all configured Secret Keys values.
|
|
235
|
+
*/
|
|
236
|
+
export function getAll({ executionId }: {
|
|
237
|
+
executionId?: string;
|
|
238
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
239
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
240
|
+
status: 200;
|
|
241
|
+
data: SecretValueResponse[];
|
|
242
|
+
} | {
|
|
243
|
+
status: 400;
|
|
244
|
+
data: ErrorResponse;
|
|
245
|
+
} | {
|
|
246
|
+
status: 403;
|
|
247
|
+
data: ErrorResponse;
|
|
248
|
+
} | {
|
|
249
|
+
status: 422;
|
|
250
|
+
data: ErrorResponse;
|
|
251
|
+
} | {
|
|
252
|
+
status: 500;
|
|
253
|
+
data: ErrorResponse;
|
|
254
|
+
}>(`/v1/secrets/values${QS.query(QS.explode({
|
|
255
|
+
executionId
|
|
256
|
+
}))}`, {
|
|
257
|
+
...opts
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* List all defined and not defined secret keys by the user.
|
|
262
|
+
*/
|
|
263
|
+
export function getAvailability(opts?: Oazapfts.RequestOpts) {
|
|
264
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
265
|
+
status: 200;
|
|
266
|
+
data: SecretAvailabilityResponse;
|
|
267
|
+
} | {
|
|
268
|
+
status: 400;
|
|
269
|
+
data: ErrorResponse;
|
|
270
|
+
} | {
|
|
271
|
+
status: 403;
|
|
272
|
+
data: ErrorResponse;
|
|
273
|
+
} | {
|
|
274
|
+
status: 500;
|
|
275
|
+
data: ErrorResponse;
|
|
276
|
+
}>("/v1/secrets/availability", {
|
|
277
|
+
...opts
|
|
278
|
+
}));
|
|
279
|
+
}
|
package/src/apis.json
CHANGED
|
@@ -117,5 +117,13 @@
|
|
|
117
117
|
"prd": "https://api-management-apigw.stackspot.com/api-management"
|
|
118
118
|
},
|
|
119
119
|
"docs": "/v3/api-docs"
|
|
120
|
+
},
|
|
121
|
+
"secrets": {
|
|
122
|
+
"url": {
|
|
123
|
+
"dev": "https://workspace-workspace-secrets-api.dev.stackspot.com",
|
|
124
|
+
"stg": "https://workspace-workspace-secrets-api.stg.stackspot.com",
|
|
125
|
+
"prd": "https://workspace-workspace-secrets-api.stg.stackspot.com"
|
|
126
|
+
},
|
|
127
|
+
"docs": "/v3/api-docs"
|
|
120
128
|
}
|
|
121
129
|
}
|
package/src/client/account.ts
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
2
|
import {
|
|
3
3
|
accountDataIsAvailable,
|
|
4
|
-
|
|
4
|
+
addResourcesToGroup,
|
|
5
|
+
addRoleToMember,
|
|
6
|
+
bindGroupMembers,
|
|
7
|
+
bindRoleGroups,
|
|
8
|
+
bindRoles,
|
|
9
|
+
bindToGroups, bindToRoles, create, createAccountRole, createPartner,
|
|
5
10
|
createUser,
|
|
6
11
|
deactivateFidoCredentials,
|
|
7
12
|
defaults,
|
|
13
|
+
deleteAccountRole,
|
|
8
14
|
deleteMember,
|
|
9
|
-
deletePartner,
|
|
15
|
+
deletePartner, deleteResourceFromGroup, deleteRole, deleteV1GroupsByGroupId, enableFidoCredentials, getAccountMembers1,
|
|
16
|
+
getAllMemberFidoCredentials, getFeatures,
|
|
17
|
+
getGroupById,
|
|
18
|
+
getGroupResources,
|
|
19
|
+
getGroups,
|
|
10
20
|
getMemberById,
|
|
11
21
|
getMemberGroups,
|
|
22
|
+
getMembers,
|
|
12
23
|
getPartnerAccount, getPartnersSharingAllowed,
|
|
13
24
|
getPersonalClientCredentials,
|
|
14
25
|
getResources1,
|
|
15
|
-
|
|
26
|
+
getResourcesAndActionsWithStatus,
|
|
27
|
+
getRoleGroups,
|
|
28
|
+
getRoleMembers,
|
|
29
|
+
getRoles,
|
|
30
|
+
getRoles1, getRoles2, removeRoleFromMember, resetPassword, save, update1, updateAccountRole, updatePartnerAccountAdminData,
|
|
31
|
+
updatePartnerAccountData,
|
|
32
|
+
updateRoleWithNewActions,
|
|
33
|
+
updateUser,
|
|
16
34
|
validateNewPartnerData,
|
|
17
35
|
validatePartnerAssociationLimit,
|
|
18
36
|
} from '../api/account'
|
|
@@ -150,10 +168,113 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
150
168
|
* Disables Fido credentials for the given member.
|
|
151
169
|
*/
|
|
152
170
|
disableFidoCredentials = this.mutation(deactivateFidoCredentials)
|
|
171
|
+
/**
|
|
172
|
+
* Gets group by id.
|
|
173
|
+
*/
|
|
174
|
+
group = this.query(getGroupById)
|
|
175
|
+
/**
|
|
176
|
+
* Get all groups (paginated).
|
|
177
|
+
*/
|
|
178
|
+
allGroups = this.infiniteQuery(getGroups)
|
|
179
|
+
/**
|
|
180
|
+
* Creates a group.
|
|
181
|
+
*/
|
|
182
|
+
createGroup = this.mutation(save)
|
|
183
|
+
/**
|
|
184
|
+
* Updates a group.
|
|
185
|
+
*/
|
|
186
|
+
updateGroup = this.mutation(update1)
|
|
187
|
+
/**
|
|
188
|
+
* Deletes a group.
|
|
189
|
+
*/
|
|
190
|
+
deleteGroup = this.mutation(deleteV1GroupsByGroupId)
|
|
191
|
+
/**
|
|
192
|
+
* Gets all members in a group (paginated).
|
|
193
|
+
*/
|
|
194
|
+
groupMembers = this.infiniteQuery(getMembers)
|
|
195
|
+
/**
|
|
196
|
+
* Adds several members to a group
|
|
197
|
+
*/
|
|
198
|
+
addMembersToGroup = this.mutation(bindGroupMembers)
|
|
153
199
|
/**
|
|
154
200
|
* Removes a member from a group
|
|
155
201
|
*/
|
|
156
202
|
removeMemberFromGroup = this.mutation(deleteMember)
|
|
203
|
+
/**
|
|
204
|
+
* Gets all roles of a group.
|
|
205
|
+
*/
|
|
206
|
+
groupRoles = this.infiniteQuery(getRoles2)
|
|
207
|
+
/**
|
|
208
|
+
* Adds several roles to a group.
|
|
209
|
+
*/
|
|
210
|
+
addRolesToGroup = this.mutation(bindRoles)
|
|
211
|
+
/**
|
|
212
|
+
* Removes a role from a group.
|
|
213
|
+
*/
|
|
214
|
+
removeRoleFromGroup = this.mutation(deleteRole)
|
|
215
|
+
/**
|
|
216
|
+
* Gets all resources of a group (paginated).
|
|
217
|
+
*/
|
|
218
|
+
groupResources = this.infiniteQuery(getGroupResources)
|
|
219
|
+
/**
|
|
220
|
+
* Adds several resources to a group.
|
|
221
|
+
*/
|
|
222
|
+
addResourcesToGroup = this.mutation(addResourcesToGroup)
|
|
223
|
+
/**
|
|
224
|
+
* Removes a resource from a group.
|
|
225
|
+
*/
|
|
226
|
+
removeResourceFromGroup = this.mutation(deleteResourceFromGroup)
|
|
227
|
+
/**
|
|
228
|
+
* Gets all roles in the account (paginated)
|
|
229
|
+
*/
|
|
230
|
+
allRoles = this.infiniteQuery(getRoles)
|
|
231
|
+
/**
|
|
232
|
+
* Get a role by id
|
|
233
|
+
*/
|
|
234
|
+
role = this.query({
|
|
235
|
+
name: 'account.role',
|
|
236
|
+
request: async (signal, { id }: { id: string }) => {
|
|
237
|
+
const roles = await getRoles({ filterBy: 'id', filterValue: id }, { signal })
|
|
238
|
+
if (!roles.length) throw new StackspotAPIError({ status: 404 })
|
|
239
|
+
return roles[0]
|
|
240
|
+
},
|
|
241
|
+
})
|
|
242
|
+
/**
|
|
243
|
+
* Gets all members with the provided role (paginated)
|
|
244
|
+
*/
|
|
245
|
+
roleMembers = this.infiniteQuery(getRoleMembers)
|
|
246
|
+
/**
|
|
247
|
+
* Creates a role
|
|
248
|
+
*/
|
|
249
|
+
createRole = this.mutation(createAccountRole)
|
|
250
|
+
/**
|
|
251
|
+
* Updates a role
|
|
252
|
+
*/
|
|
253
|
+
updateRole = this.mutation(updateAccountRole)
|
|
254
|
+
/**
|
|
255
|
+
* Deletes a role
|
|
256
|
+
*/
|
|
257
|
+
deleteRole = this.mutation(deleteAccountRole)
|
|
258
|
+
/**
|
|
259
|
+
* Adds a role to several members
|
|
260
|
+
*/
|
|
261
|
+
addRoleToMembers = this.mutation(addRoleToMember)
|
|
262
|
+
/**
|
|
263
|
+
* Gets all groups with the provided role (paginated)
|
|
264
|
+
*/
|
|
265
|
+
roleGroups = this.infiniteQuery(getRoleGroups)
|
|
266
|
+
/**
|
|
267
|
+
* Adds a role to several groups
|
|
268
|
+
*/
|
|
269
|
+
addRoleToGroups = this.mutation(bindRoleGroups)
|
|
270
|
+
/**
|
|
271
|
+
* Get the actions a role is allowed to perform
|
|
272
|
+
*/
|
|
273
|
+
rolePermissions = this.infiniteQuery(getResourcesAndActionsWithStatus)
|
|
274
|
+
/**
|
|
275
|
+
* Updates a role with new actions
|
|
276
|
+
*/
|
|
277
|
+
updateRolePermissions = this.mutation(updateRoleWithNewActions)
|
|
157
278
|
}
|
|
158
279
|
|
|
159
280
|
export const accountClient = new AccountClient()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
+
|
|
3
|
+
import { createKey, defaults, deleteKey, deleteSecretValue, editKey, getAll1, getAvailability, updateSecretValue } from '../api/secrets'
|
|
4
|
+
import apis from '../apis.json'
|
|
5
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
6
|
+
import { secretsDictionary } from '../error/dictionary/secrets'
|
|
7
|
+
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
8
|
+
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
9
|
+
|
|
10
|
+
class SecretClient extends ReactQueryNetworkClient {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(apis.secrets.url, defaults)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
16
|
+
return new DefaultAPIError(error.data, error.status, secretsDictionary, error.headers)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a key
|
|
21
|
+
*/
|
|
22
|
+
createKey = this.mutation(createKey)
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get all keys
|
|
26
|
+
*/
|
|
27
|
+
getAllKeys = this.query(getAll1)
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Delete a key
|
|
31
|
+
*/
|
|
32
|
+
deleteKey = this.mutation(deleteKey)
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Update a key's description
|
|
36
|
+
*/
|
|
37
|
+
updateKey = this.mutation(editKey)
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get which secrets are defined or undefined for a user
|
|
41
|
+
*/
|
|
42
|
+
getAvailability = this.query(getAvailability)
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Update a secret's value
|
|
46
|
+
*/
|
|
47
|
+
updateSecretValue = this.mutation(updateSecretValue)
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Delete a secret's value
|
|
51
|
+
*/
|
|
52
|
+
deleteSecretValue = this.mutation(deleteSecretValue)
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export const secretsClient = new SecretClient()
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Dictionary, Language } from '@stack-spot/portal-translate'
|
|
2
|
-
import { every, isEmpty, isString } from 'lodash'
|
|
3
2
|
import { ErrorResponse } from '../api/account'
|
|
4
3
|
import { StackspotAPIError } from './StackspotAPIError'
|
|
5
4
|
import { baseDictionary } from './dictionary/base'
|
|
@@ -24,14 +23,14 @@ function getTitle(raw: ErrorResponse, dictionary: Dictionary, language: Language
|
|
|
24
23
|
|
|
25
24
|
function createMessage(raw: ErrorResponse, dictionary: Dictionary, language: Language) {
|
|
26
25
|
const title = getTitle(raw, dictionary, language)
|
|
27
|
-
if (
|
|
26
|
+
if (!raw.validationDetails?.length) return title
|
|
28
27
|
const api = raw.code?.split(/[-_]/)[0]
|
|
29
28
|
const details = raw.validationDetails?.map((detail) => {
|
|
30
29
|
const dict: Record<string, string> = (fieldDictionary[api?.toLowerCase() as keyof typeof fieldDictionary] ?? {})[language] ?? {}
|
|
31
|
-
const name = dict[detail.code] || detail.field || (raw.code !== detail.code && dictionary[language][detail.code]) ||
|
|
32
|
-
return
|
|
30
|
+
const name = dict[detail.code] || detail.field || (raw.code !== detail.code && dictionary[language][detail.code]) || detail.code
|
|
31
|
+
return detail.values?.length ? `${name}${detail.values ? `\n${detail.values.join('\n')}` : ''}` : name
|
|
33
32
|
})?.filter(d => !!d)
|
|
34
|
-
return `${title}\n${details?.join('\n')}`
|
|
33
|
+
return details?.length === 1 ? details[0] : `${title}\n${details?.join('\n')}`
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
/**
|
|
@@ -26,6 +26,7 @@ export const accountDictionary = {
|
|
|
26
26
|
ACC_ACCOUNT_PARTNER_CANT_BE_INACTIVATED: 'This partner cannot be deactivated due to associated APIs or products.',
|
|
27
27
|
ACC_ACCOUNT_CREATION_PARTNER_ASSOCIATION_LIMIT: 'Your account has reached the limit of associations with partner accounts.',
|
|
28
28
|
ACC_INVALID_PASSWORD: "Invalid password. Please make sure it meets the requirements and hasn't been used before.",
|
|
29
|
+
ROLES_ALREADY_EXISTS: 'A role with this name already exists.',
|
|
29
30
|
},
|
|
30
31
|
pt: {
|
|
31
32
|
ACC_BAD_REQUEST_ERROR: 'Os dados informados estão inválidos ou inconsistentes.',
|
|
@@ -52,5 +53,6 @@ export const accountDictionary = {
|
|
|
52
53
|
ACC_ACCOUNT_PARTNER_CANT_BE_INACTIVATED: 'Este Parceiro não pode ser inativado devido a APIs ou produtos associados.',
|
|
53
54
|
ACC_ACCOUNT_CREATION_PARTNER_ASSOCIATION_LIMIT: 'Sua conta atingiu o limite de associações com Contas de Parceiros.',
|
|
54
55
|
ACC_INVALID_PASSWORD: 'Senha inválida. Verifique se ela atende aos requisitos e não foi usada anteriormente.',
|
|
56
|
+
ROLES_ALREADY_EXISTS: 'Já existe um papel com esse nome.',
|
|
55
57
|
},
|
|
56
58
|
} satisfies Dictionary
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Dictionary } from '@stack-spot/portal-translate'
|
|
2
|
+
|
|
3
|
+
export const secretsDictionary = {
|
|
4
|
+
en: {
|
|
5
|
+
WSA_SECRET_KEY_ALREADY_EXISTS: 'Secret Key already exists.',
|
|
6
|
+
WSA_SECRET_KEY_NOT_FOUND: 'Secret Key not found.',
|
|
7
|
+
WSA_SECRET_VALUE_NOT_FOUND: 'Secret Value not found.',
|
|
8
|
+
},
|
|
9
|
+
pt: {
|
|
10
|
+
WSA_SECRET_KEY_ALREADY_EXISTS: 'Secret Key já existe.',
|
|
11
|
+
WSA_SECRET_KEY_NOT_FOUND: 'Secret Key não encontrada.',
|
|
12
|
+
WSA_SECRET_VALUE_NOT_FOUND: 'Valor da Secret não encontrado.',
|
|
13
|
+
},
|
|
14
|
+
} satisfies Dictionary
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { accountClient } from './client/account'
|
|
2
|
+
export { secretsClient } from './client/secrets'
|
|
2
3
|
export { DefaultAPIError } from './error/DefaultAPIError'
|
|
3
4
|
export { StackspotAPIError } from './error/StackspotAPIError'
|
|
4
5
|
export { NetworkClient } from './network/NetworkClient'
|
package/src/network/AutoQuery.ts
CHANGED
|
@@ -76,6 +76,8 @@ export class AutoQuery<Variables, Result> extends AutoOperation<Variables> imple
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
getKey(variables?: Partial<Variables>) {
|
|
79
|
-
|
|
79
|
+
const key: any[] = [this.apiName, this.fn.name]
|
|
80
|
+
if (variables) key.push(variables)
|
|
81
|
+
return key
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -12,7 +12,10 @@ export class ManualInfiniteQuery<
|
|
|
12
12
|
PageParamName extends keyof Variables,
|
|
13
13
|
Accumulator extends keyof Result | ''
|
|
14
14
|
> extends ManualQuery<Variables, Result> implements InfiniteQueryObject<Variables, Result, Accumulator> {
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(
|
|
16
|
+
config: InfiniteQueryConfig<Variables, Result, PageParamName, Accumulator>
|
|
17
|
+
& { apiName: string, transformError: (error: any) => StackspotAPIError },
|
|
18
|
+
) {
|
|
16
19
|
super(config as FullOperationConfig<any, any>)
|
|
17
20
|
}
|
|
18
21
|
|
|
@@ -22,6 +22,8 @@ export class ManualMutation<
|
|
|
22
22
|
return await this.config.request(
|
|
23
23
|
...[abortController.signal, variables] as Variables extends void ? [AbortSignal] : [AbortSignal, Variables],
|
|
24
24
|
)
|
|
25
|
+
} catch (error) {
|
|
26
|
+
throw this.config.transformError(error)
|
|
25
27
|
} finally {
|
|
26
28
|
this.abortMap.delete(variables)
|
|
27
29
|
}
|
|
@@ -14,11 +14,19 @@ export abstract class ManualOperation<Variables extends Record<string, any> | vo
|
|
|
14
14
|
this.config = config
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
private async makePermissionRequest(variables: Partial<Record<string, any>> | undefined) {
|
|
18
|
+
try {
|
|
19
|
+
// @ts-ignore the following is correct. TS can't correctly infer the conditional type here =(
|
|
20
|
+
return await this.config.permission(variables)
|
|
21
|
+
} catch (error) {
|
|
22
|
+
throw this.config.transformError(error)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
17
26
|
isAllowed(...[variables]: Variables extends void ? [] : [variables?: Partial<Variables>]) {
|
|
18
27
|
return queryClient.fetchQuery({
|
|
19
28
|
queryKey: this.getPermissionKey(variables as Variables),
|
|
20
|
-
|
|
21
|
-
queryFn: () => this.config.permission(variables),
|
|
29
|
+
queryFn: () => this.makePermissionRequest(variables),
|
|
22
30
|
})
|
|
23
31
|
}
|
|
24
32
|
|
|
@@ -27,12 +35,15 @@ export abstract class ManualOperation<Variables extends Record<string, any> | vo
|
|
|
27
35
|
? [options?: Omit<UseQueryOptions, 'queryFn' | 'queryKey'>]
|
|
28
36
|
: [variables?: Partial<Variables>, options?: Omit<UseQueryOptions, 'queryFn' | 'queryKey'>]
|
|
29
37
|
) {
|
|
30
|
-
|
|
38
|
+
/* `this.config.permission` is a function with arity 0 or 1. If it accepts variables, its arity is 1. If it doesn't accept variables,
|
|
39
|
+
its arity is zero. We can use this information to determine what the type of `args` actually is at runtime. If variables are accepted,
|
|
40
|
+
than the 1st argument is the variables and the 2nd is the query options, otherwise, it has a single argument, which is the query
|
|
41
|
+
options. */
|
|
42
|
+
const [variables, options] = this.config.permission.length === 2 ? args : [undefined, args[0]]
|
|
31
43
|
const result = useQuery({
|
|
32
44
|
...options,
|
|
33
45
|
queryKey: this.getPermissionKey(variables as Variables),
|
|
34
|
-
|
|
35
|
-
queryFn: () => this.config.permission(variables),
|
|
46
|
+
queryFn: () => this.makePermissionRequest(variables),
|
|
36
47
|
}, queryClient) as UseQueryResult<boolean, StackspotAPIError>
|
|
37
48
|
return [result.data, result.isPending, result.error, result] as const
|
|
38
49
|
}
|
|
@@ -26,6 +26,8 @@ export class ManualQuery<
|
|
|
26
26
|
return await this.config.request(
|
|
27
27
|
...[abortController.signal, variables] as Variables extends void ? [AbortSignal] : [AbortSignal, Variables],
|
|
28
28
|
)
|
|
29
|
+
} catch (error) {
|
|
30
|
+
throw this.config.transformError(error)
|
|
29
31
|
} finally {
|
|
30
32
|
this.abortMap.delete(variables)
|
|
31
33
|
this.currentRequests.delete(variables)
|