@stack-spot/portal-network 0.183.0 → 0.184.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 +2412 -2405
- package/dist/api/account.js +1 -1
- package/dist/api/agent-tools.js +1 -1
- package/dist/api/agent.js +1 -1
- package/dist/api/ai.js +1 -1
- package/dist/api/apiManagement.js +1 -1
- package/dist/api/apiRuntime.js +1 -1
- package/dist/api/cloudAccount.js +1 -1
- package/dist/api/cloudPlatform.js +1 -1
- package/dist/api/cloudPlatformHorizon.js +1 -1
- package/dist/api/cloudRuntimes.js +1 -1
- package/dist/api/cloudServices.js +1 -1
- package/dist/api/codeShift.js +1 -1
- package/dist/api/content.js +1 -1
- package/dist/api/dataIntegration.js +1 -1
- package/dist/api/discover.js +1 -1
- package/dist/api/genAiInference.js +1 -1
- package/dist/api/insights.js +1 -1
- package/dist/api/notification.js +1 -1
- package/dist/api/secrets.js +1 -1
- package/dist/api/serviceCatalog.js +1 -1
- package/dist/api/workspace-ai.js +1 -1
- package/dist/api/workspace.js +1 -1
- package/dist/api/workspaceManager.d.ts +16 -10
- package/dist/api/workspaceManager.d.ts.map +1 -1
- package/dist/api/workspaceManager.js +11 -1
- package/dist/api/workspaceManager.js.map +1 -1
- package/dist/api/workspaceSearchEngine.js +1 -1
- package/dist/client/workspace-manager.d.ts +6 -0
- package/dist/client/workspace-manager.d.ts.map +1 -1
- package/dist/client/workspace-manager.js +10 -1
- package/dist/client/workspace-manager.js.map +1 -1
- package/package.json +6 -6
- package/scripts/generate-apis.ts +134 -134
- package/src/api/account.ts +8367 -8367
- package/src/api/agent-tools.ts +2169 -2169
- package/src/api/agent.ts +1083 -1083
- package/src/api/ai.ts +3388 -3388
- package/src/api/apiManagement.ts +570 -570
- package/src/api/apiRuntime.ts +2103 -2103
- package/src/api/cloudAccount.ts +1239 -1239
- package/src/api/cloudPlatform.ts +927 -927
- package/src/api/cloudPlatformHorizon.ts +2655 -2655
- package/src/api/cloudRuntimes.ts +2043 -2043
- package/src/api/cloudServices.ts +1445 -1445
- package/src/api/codeShift.ts +3481 -3481
- package/src/api/content.ts +9785 -9785
- package/src/api/dataIntegration.ts +1657 -1657
- package/src/api/discover.ts +435 -435
- package/src/api/eventBus.ts +171 -171
- package/src/api/genAiInference.ts +603 -603
- package/src/api/insights.ts +310 -310
- package/src/api/notification.ts +334 -334
- package/src/api/secrets.ts +342 -342
- package/src/api/serviceCatalog.ts +2908 -2908
- package/src/api/workflows.ts +1669 -1669
- package/src/api/workspace-ai.ts +677 -677
- package/src/api/workspace.ts +5889 -5889
- package/src/api/workspaceManager.ts +2951 -2936
- package/src/api/workspaceSearchEngine.ts +153 -153
- package/src/api-addresses.ts +120 -120
- package/src/apis-itau.json +225 -225
- package/src/apis.json +225 -225
- package/src/client/account.ts +902 -902
- package/src/client/agent-tools.ts +210 -210
- package/src/client/agent.ts +81 -81
- package/src/client/ai.ts +395 -395
- package/src/client/api-management.ts +40 -40
- package/src/client/cloud-account.ts +70 -70
- package/src/client/cloud-platform-horizon.ts +113 -113
- package/src/client/cloud-platform.ts +163 -163
- package/src/client/cloud-runtimes.ts +129 -129
- package/src/client/cloud-services.ts +94 -94
- package/src/client/code-shift.ts +349 -349
- package/src/client/content.ts +538 -538
- package/src/client/data-integration.ts +191 -191
- package/src/client/discover.ts +89 -89
- package/src/client/event-bus.ts +84 -84
- package/src/client/gen-ai-inference.ts +65 -65
- package/src/client/insights.ts +28 -28
- package/src/client/notification.ts +32 -32
- package/src/client/runtime-manager.ts +76 -76
- package/src/client/secrets.ts +60 -60
- package/src/client/types.ts +377 -377
- package/src/client/workflow.ts +83 -83
- package/src/client/workspace-ai.ts +191 -191
- package/src/client/workspace-manager.ts +564 -560
- package/src/client/workspace-search.ts +39 -39
- package/src/client/workspace.ts +480 -480
- package/src/error/DefaultAPIError.ts +151 -151
- package/src/error/FileUploadError.ts +18 -18
- package/src/error/IgnoredErrorCodes.ts +3 -3
- package/src/error/StackspotAPIError.ts +101 -101
- package/src/error/StreamCanceledError.ts +10 -10
- package/src/error/StreamError.ts +7 -7
- package/src/error/StreamJsonError.ts +10 -10
- package/src/error/dictionary/account.ts +58 -58
- package/src/error/dictionary/action-details.ts +20 -20
- package/src/error/dictionary/action.ts +211 -211
- package/src/error/dictionary/agent-tools.ts +75 -75
- package/src/error/dictionary/ai-inference.ts +28 -28
- package/src/error/dictionary/base.ts +22 -22
- package/src/error/dictionary/cloud-platform.ts +82 -82
- package/src/error/dictionary/cnt-fields.ts +14 -14
- package/src/error/dictionary/cnt.ts +103 -103
- package/src/error/dictionary/code-shift.ts +12 -12
- package/src/error/dictionary/rte.ts +24 -24
- package/src/error/dictionary/rtm.ts +10 -10
- package/src/error/dictionary/secrets.ts +14 -14
- package/src/error/dictionary/workspace-ai.ts +10 -10
- package/src/error/dictionary/workspace-details.ts +15 -15
- package/src/error/dictionary/workspace-fields.ts +10 -10
- package/src/error/dictionary/workspace.ts +209 -209
- package/src/error/types.ts +21 -21
- package/src/index.ts +43 -43
- package/src/network/AutoInfiniteQuery.ts +115 -115
- package/src/network/AutoMutation.ts +27 -27
- package/src/network/AutoOperation.ts +73 -73
- package/src/network/AutoQuery.ts +75 -75
- package/src/network/ManualInfiniteQuery.ts +95 -95
- package/src/network/ManualMutation.ts +40 -40
- package/src/network/ManualOperation.ts +52 -52
- package/src/network/ManualQuery.ts +82 -82
- package/src/network/NetworkClient.ts +167 -167
- package/src/network/ReactQueryNetworkClient.ts +312 -312
- package/src/network/react-query-client.ts +14 -14
- package/src/network/types.ts +294 -294
- package/src/types.ts +1 -1
- package/src/utils/StreamedArray.tsx +146 -146
- package/src/utils/StreamedJson.tsx +166 -166
- package/src/utils/remove-authorization-param.ts +6 -6
- package/src/utils/string.ts +19 -19
- package/src/utils/use-extended-list.ts +80 -80
- package/src/utils/use-streamed-array.ts +17 -17
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +10 -10
package/src/client/account.ts
CHANGED
|
@@ -1,902 +1,902 @@
|
|
|
1
|
-
import { HttpError, RequestOpts } from '@oazapfts/runtime'
|
|
2
|
-
import { getApiAddresses } from '../api-addresses'
|
|
3
|
-
import {
|
|
4
|
-
addAccountMemberFavorite,
|
|
5
|
-
addNewEmailDomain,
|
|
6
|
-
addResourcesToGroup,
|
|
7
|
-
addRoleToMember,
|
|
8
|
-
associateGroupToServiceCredential,
|
|
9
|
-
bindGroupMembers,
|
|
10
|
-
bindRoleGroups,
|
|
11
|
-
bindRoles,
|
|
12
|
-
bindToGroups,
|
|
13
|
-
bindToRoles,
|
|
14
|
-
create,
|
|
15
|
-
create1,
|
|
16
|
-
createAccountRole, createExtension, createExtensionLink,
|
|
17
|
-
createExtensionVersion, createFidoMagicLink, createGroupMapping,
|
|
18
|
-
createPartner,
|
|
19
|
-
createPersonalAccessToken,
|
|
20
|
-
createSecret,
|
|
21
|
-
createServiceCredential,
|
|
22
|
-
createServiceCredential1,
|
|
23
|
-
createTrialAccount,
|
|
24
|
-
createUser,
|
|
25
|
-
deactivateFidoCredentials,
|
|
26
|
-
defaults,
|
|
27
|
-
delete1,
|
|
28
|
-
deleteAccountRole,
|
|
29
|
-
deleteExtension,
|
|
30
|
-
deleteExtensionLink,
|
|
31
|
-
deleteExtensionVersion,
|
|
32
|
-
deleteFidoKey,
|
|
33
|
-
deleteGroupMapping,
|
|
34
|
-
deleteMember,
|
|
35
|
-
deleteMemberFavorite,
|
|
36
|
-
deletePartner, deleteProfileImage,
|
|
37
|
-
deleteResourceFromGroup, deleteRole, deleteSecret, deleteSso,
|
|
38
|
-
disablePersonalAccessTokenGeneration,
|
|
39
|
-
disableSecret,
|
|
40
|
-
disassociateGroupToServiceCredential, enableFidoCredentials,
|
|
41
|
-
enableSecret,
|
|
42
|
-
enterpriseContact,
|
|
43
|
-
findAssociations,
|
|
44
|
-
findSecrets1,
|
|
45
|
-
getAccess,
|
|
46
|
-
getAccount1,
|
|
47
|
-
getAccountMembers,
|
|
48
|
-
getAccountMembers2,
|
|
49
|
-
getAccountRateLimit,
|
|
50
|
-
getAccounts1,
|
|
51
|
-
getAccountSso,
|
|
52
|
-
getActiveExtensionVersion,
|
|
53
|
-
getAllAccountSso,
|
|
54
|
-
getAllGroupMapping,
|
|
55
|
-
getAllMemberFidoCredentials,
|
|
56
|
-
getAllServiceCredentialRateLimit,
|
|
57
|
-
getById,
|
|
58
|
-
getEnabledFeatureFlagsForAccount,
|
|
59
|
-
getExtensionVersion,
|
|
60
|
-
getExternalLinksByType,
|
|
61
|
-
getFeatureFlag,
|
|
62
|
-
getFeatures,
|
|
63
|
-
getFeatures3,
|
|
64
|
-
getGroupById,
|
|
65
|
-
getGroupResources,
|
|
66
|
-
getGroupResources1,
|
|
67
|
-
getGroups,
|
|
68
|
-
getGroups1,
|
|
69
|
-
getMemberById,
|
|
70
|
-
getMemberGroups,
|
|
71
|
-
getMemberGroups1,
|
|
72
|
-
getMemberPreferences,
|
|
73
|
-
getMembers,
|
|
74
|
-
getMembers1,
|
|
75
|
-
getPartnerAccount, getPartnersSharingAllowed,
|
|
76
|
-
getPersonalAccountDetails,
|
|
77
|
-
getPersonalClientCredentials,
|
|
78
|
-
getResources1,
|
|
79
|
-
getResources2,
|
|
80
|
-
getResourcesAndActionsWithStatus1,
|
|
81
|
-
getResourceTypes1,
|
|
82
|
-
getRoleGroups,
|
|
83
|
-
getRoleGroups1,
|
|
84
|
-
getRoleMembers,
|
|
85
|
-
getRoleMembers1,
|
|
86
|
-
getRoles,
|
|
87
|
-
getRoles1,
|
|
88
|
-
getRoles2,
|
|
89
|
-
getRoles3,
|
|
90
|
-
getRoles4, getRoles5,
|
|
91
|
-
getScmProvider,
|
|
92
|
-
getServiceCredential,
|
|
93
|
-
getServiceCredentialByIdRateLimit,
|
|
94
|
-
getServiceCredentialGroups,
|
|
95
|
-
getServiceCredentialPermissions,
|
|
96
|
-
getServiceCredentials,
|
|
97
|
-
getServiceCredentials1,
|
|
98
|
-
isCreatedScmCredentials,
|
|
99
|
-
isCreatedScmCredentials1,
|
|
100
|
-
listAccountMemberFavorites,
|
|
101
|
-
listExtensionLinks,
|
|
102
|
-
listExtensions,
|
|
103
|
-
listExtensionVersions,
|
|
104
|
-
listMemberFavoritesByResource,
|
|
105
|
-
listScmCredentials,
|
|
106
|
-
listScmCredentials2, partialUpdateSso, personalAccessTokenAuthorization,
|
|
107
|
-
personalContact,
|
|
108
|
-
removeRoleFromMember,
|
|
109
|
-
removeTrialAccount,
|
|
110
|
-
resetOtp,
|
|
111
|
-
resetPassword,
|
|
112
|
-
revokeServiceCredential,
|
|
113
|
-
revokeServiceCredential1,
|
|
114
|
-
rotateServiceCredentialSecret,
|
|
115
|
-
save,
|
|
116
|
-
scmCredentialSave, scmCredentialSave1, scmCredentialUpdate, scmCredentialUpdate1, scmDelete, sendDownloadEmail, ssoAddAttributes,
|
|
117
|
-
ssoConfigure, ssoGetAttributesConfig, ssoParseConfigurationFile, update1,
|
|
118
|
-
updateAccountRole,
|
|
119
|
-
updateExtension,
|
|
120
|
-
updateExtensionLink,
|
|
121
|
-
updateFeatureFlag,
|
|
122
|
-
updateGroupMapping,
|
|
123
|
-
updateMemberPreferences,
|
|
124
|
-
updatePartnerAccountAdminData,
|
|
125
|
-
updatePartnerAccountData,
|
|
126
|
-
updatePersonalAccountDetails,
|
|
127
|
-
updateRateLimit,
|
|
128
|
-
updateResourceActions,
|
|
129
|
-
updateRoleWithNewActions,
|
|
130
|
-
updateSalesRepresentatives,
|
|
131
|
-
updateSecret,
|
|
132
|
-
updateServiceCredentialRateLimit,
|
|
133
|
-
updateServiceCredentialScopes,
|
|
134
|
-
updateSso,
|
|
135
|
-
updateUser,
|
|
136
|
-
validateCampaignCode,
|
|
137
|
-
validateNewPartnerData,
|
|
138
|
-
validatePartnerAssociationLimit,
|
|
139
|
-
} from '../api/account'
|
|
140
|
-
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
141
|
-
import { accountDictionary } from '../error/dictionary/account'
|
|
142
|
-
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
143
|
-
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
144
|
-
import { CreateSCMRequest, SCMStatus, UpdateSCMRequest } from './types'
|
|
145
|
-
|
|
146
|
-
class AccountClient extends ReactQueryNetworkClient {
|
|
147
|
-
constructor() {
|
|
148
|
-
super(getApiAddresses().account.url, defaults)
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
152
|
-
return new DefaultAPIError(error.data, error.status, accountDictionary, error.headers)
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Gets credentials from personal service client (create if not exists one to the logged user).
|
|
157
|
-
*/
|
|
158
|
-
generatePersonalClientCredentials = this.mutation(getPersonalClientCredentials)
|
|
159
|
-
/**
|
|
160
|
-
* Creates a Feature Flag
|
|
161
|
-
*/
|
|
162
|
-
createFeatureFlag = this.mutation(create)
|
|
163
|
-
/**
|
|
164
|
-
* Lists all Feature Flags in an Account
|
|
165
|
-
*/
|
|
166
|
-
featureFlags = this.query(getFeatures3)
|
|
167
|
-
/**
|
|
168
|
-
* Lists all Feature Flags in an Account With Pagination
|
|
169
|
-
*/
|
|
170
|
-
featureFlagsWithPagination = this.query(getFeatures)
|
|
171
|
-
/**
|
|
172
|
-
* Gets Partners with whom it is allowed to share content.
|
|
173
|
-
*/
|
|
174
|
-
partners = this.query(getPartnersSharingAllowed)
|
|
175
|
-
/**
|
|
176
|
-
* Gets Partner by account Id
|
|
177
|
-
*/
|
|
178
|
-
partner = this.query(getPartnerAccount)
|
|
179
|
-
/**
|
|
180
|
-
* Creates an Account Order for Partner
|
|
181
|
-
*/
|
|
182
|
-
createPartner = this.mutation(createPartner)
|
|
183
|
-
/**
|
|
184
|
-
* Updates Partner Account data.
|
|
185
|
-
*/
|
|
186
|
-
updatePartner = this.mutation(updatePartnerAccountData)
|
|
187
|
-
/**
|
|
188
|
-
* Updates Partner Account Admin data.
|
|
189
|
-
*/
|
|
190
|
-
updatePartnerAdmin = this.mutation(updatePartnerAccountAdminData)
|
|
191
|
-
/**
|
|
192
|
-
* Deletes Partner
|
|
193
|
-
*/
|
|
194
|
-
deactivatePartner = this.mutation(deletePartner)
|
|
195
|
-
/**
|
|
196
|
-
* Validates new Partner account data
|
|
197
|
-
*/
|
|
198
|
-
validateNewPartnerData = this.mutation(validateNewPartnerData)
|
|
199
|
-
/**
|
|
200
|
-
* Validates the association limit for the partner. Yields `{ isValid: true }` if valid or `{ isValid: false, message: string }`
|
|
201
|
-
* otherwise.
|
|
202
|
-
*/
|
|
203
|
-
validatePartnerAssociationLimit = this.query({
|
|
204
|
-
name: 'validatePartnerAssociationLimit',
|
|
205
|
-
request: async (signal) => {
|
|
206
|
-
try {
|
|
207
|
-
await validatePartnerAssociationLimit({ signal })
|
|
208
|
-
return { isValid: true, message: '' }
|
|
209
|
-
} catch (error) {
|
|
210
|
-
if (error instanceof HttpError) {
|
|
211
|
-
const stkError = this.buildStackSpotError(error)
|
|
212
|
-
if (stkError.status === 422 || stkError.code === 'BAD_USER_INPUT') return { isValid: false, message: stkError.translate() }
|
|
213
|
-
}
|
|
214
|
-
throw error
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
|
-
})
|
|
218
|
-
/**
|
|
219
|
-
* Gets member by id.
|
|
220
|
-
*/
|
|
221
|
-
member = this.query(getMemberById)
|
|
222
|
-
/**
|
|
223
|
-
* Gets all members (paginated).
|
|
224
|
-
*/
|
|
225
|
-
allMembers = this.infiniteQuery(getAccountMembers2)
|
|
226
|
-
/**
|
|
227
|
-
* Gets member Groups (paginated).
|
|
228
|
-
*/
|
|
229
|
-
memberGroups = this.infiniteQuery(getMemberGroups1)
|
|
230
|
-
/**
|
|
231
|
-
* Gets member roles (paginated).
|
|
232
|
-
*/
|
|
233
|
-
memberRoles = this.infiniteQuery(getRoles4)
|
|
234
|
-
/**
|
|
235
|
-
* Gets member resources.
|
|
236
|
-
*/
|
|
237
|
-
memberResources = this.query(getResources2)
|
|
238
|
-
/**
|
|
239
|
-
* Gets All Fido credentials for the given member (paginated).
|
|
240
|
-
*/
|
|
241
|
-
fidoCredentials = this.infiniteQuery(getAllMemberFidoCredentials, { accumulator: 'items' })
|
|
242
|
-
/**
|
|
243
|
-
* Creates member on current tenant.
|
|
244
|
-
*/
|
|
245
|
-
createMember = this.mutation(createUser)
|
|
246
|
-
/**
|
|
247
|
-
* Updates member on current tenant.
|
|
248
|
-
*/
|
|
249
|
-
updateMember = this.mutation(updateUser)
|
|
250
|
-
/**
|
|
251
|
-
* Adds a member to several groups.
|
|
252
|
-
*/
|
|
253
|
-
addMemberToGroups = this.mutation(bindToGroups)
|
|
254
|
-
/**
|
|
255
|
-
* Attributes several roles to a member.
|
|
256
|
-
*/
|
|
257
|
-
addRolesToMember = this.mutation(bindToRoles)
|
|
258
|
-
/**
|
|
259
|
-
* Removes a role from a member.
|
|
260
|
-
*/
|
|
261
|
-
removeRoleFromMember = this.mutation(removeRoleFromMember)
|
|
262
|
-
/**
|
|
263
|
-
* Sends an e-mail to reset the password of the member with the provided e-mail address.
|
|
264
|
-
*/
|
|
265
|
-
resetMemberPassword = this.mutation(resetPassword)
|
|
266
|
-
/**
|
|
267
|
-
* Reset member OTP
|
|
268
|
-
*/
|
|
269
|
-
resetOtp = this.mutation(resetOtp)
|
|
270
|
-
/**
|
|
271
|
-
* Enables Fido credentials for the given member.
|
|
272
|
-
*/
|
|
273
|
-
enableFidoCredentials = this.mutation(enableFidoCredentials)
|
|
274
|
-
/**
|
|
275
|
-
* Disables Fido credentials for the given member.
|
|
276
|
-
*/
|
|
277
|
-
disableFidoCredentials = this.mutation(deactivateFidoCredentials)
|
|
278
|
-
/**
|
|
279
|
-
* Gets group by id.
|
|
280
|
-
*/
|
|
281
|
-
group = this.query(getGroupById)
|
|
282
|
-
/**
|
|
283
|
-
* Get all groups (paginated).
|
|
284
|
-
*/
|
|
285
|
-
allGroups = this.infiniteQuery(getGroups1)
|
|
286
|
-
/**
|
|
287
|
-
* Creates a group.
|
|
288
|
-
*/
|
|
289
|
-
createGroup = this.mutation(save)
|
|
290
|
-
/**
|
|
291
|
-
* Updates a group.
|
|
292
|
-
*/
|
|
293
|
-
updateGroup = this.mutation(update1)
|
|
294
|
-
/**
|
|
295
|
-
* Deletes a group.
|
|
296
|
-
*/
|
|
297
|
-
deleteGroup = this.mutation(delete1)
|
|
298
|
-
/**
|
|
299
|
-
* Gets all members in a group (paginated).
|
|
300
|
-
*/
|
|
301
|
-
groupMembers = this.infiniteQuery(getMembers1)
|
|
302
|
-
/**
|
|
303
|
-
* Adds several members to a group
|
|
304
|
-
*/
|
|
305
|
-
addMembersToGroup = this.mutation(bindGroupMembers)
|
|
306
|
-
/**
|
|
307
|
-
* Removes a member from a group
|
|
308
|
-
*/
|
|
309
|
-
removeMemberFromGroup = this.mutation(deleteMember)
|
|
310
|
-
/**
|
|
311
|
-
* Gets all roles of a group.
|
|
312
|
-
*/
|
|
313
|
-
groupRoles = this.infiniteQuery(getRoles5)
|
|
314
|
-
/**
|
|
315
|
-
* Adds several roles to a group.
|
|
316
|
-
*/
|
|
317
|
-
addRolesToGroup = this.mutation(bindRoles)
|
|
318
|
-
/**
|
|
319
|
-
* Removes a role from a group.
|
|
320
|
-
*/
|
|
321
|
-
removeRoleFromGroup = this.mutation(deleteRole)
|
|
322
|
-
/**
|
|
323
|
-
* Gets all resources of a group (paginated).
|
|
324
|
-
*/
|
|
325
|
-
groupResources = this.infiniteQuery(getGroupResources1)
|
|
326
|
-
/**
|
|
327
|
-
* Adds several resources to a group.
|
|
328
|
-
*/
|
|
329
|
-
addResourcesToGroup = this.mutation(addResourcesToGroup)
|
|
330
|
-
/**
|
|
331
|
-
* Removes a resource from a group.
|
|
332
|
-
*/
|
|
333
|
-
removeResourceFromGroup = this.mutation(deleteResourceFromGroup)
|
|
334
|
-
/**
|
|
335
|
-
* Gets all roles in the account (paginated)
|
|
336
|
-
*/
|
|
337
|
-
allRoles = this.infiniteQuery(getRoles3)
|
|
338
|
-
/**
|
|
339
|
-
* Get a role by id
|
|
340
|
-
*/
|
|
341
|
-
role = this.query({
|
|
342
|
-
name: 'account.role',
|
|
343
|
-
request: async (signal, { id }: { id: string }) => {
|
|
344
|
-
const roles = await getRoles3({ filterBy: 'id', filterValue: id }, { signal })
|
|
345
|
-
if (!roles.length) throw new StackspotAPIError({ status: 404 })
|
|
346
|
-
return roles[0]
|
|
347
|
-
},
|
|
348
|
-
})
|
|
349
|
-
/**
|
|
350
|
-
* Gets all members with the provided role (paginated)
|
|
351
|
-
*/
|
|
352
|
-
roleMembers = this.infiniteQuery(getRoleMembers1)
|
|
353
|
-
/**
|
|
354
|
-
* Creates a role
|
|
355
|
-
*/
|
|
356
|
-
createRole = this.mutation(createAccountRole)
|
|
357
|
-
/**
|
|
358
|
-
* Updates a role
|
|
359
|
-
*/
|
|
360
|
-
updateRole = this.mutation(updateAccountRole)
|
|
361
|
-
/**
|
|
362
|
-
* Deletes a role
|
|
363
|
-
*/
|
|
364
|
-
deleteRole = this.mutation(deleteAccountRole)
|
|
365
|
-
/**
|
|
366
|
-
* Adds a role to several members
|
|
367
|
-
*/
|
|
368
|
-
addRoleToMembers = this.mutation(addRoleToMember)
|
|
369
|
-
/**
|
|
370
|
-
* Gets all groups with the provided role (paginated)
|
|
371
|
-
*/
|
|
372
|
-
roleGroups = this.infiniteQuery(getRoleGroups1)
|
|
373
|
-
/**
|
|
374
|
-
* Adds a role to several groups
|
|
375
|
-
*/
|
|
376
|
-
addRoleToGroups = this.mutation(bindRoleGroups)
|
|
377
|
-
/**
|
|
378
|
-
* Get the actions a role is allowed to perform
|
|
379
|
-
*/
|
|
380
|
-
rolePermissions = this.infiniteQuery(getResourcesAndActionsWithStatus1)
|
|
381
|
-
/**
|
|
382
|
-
* Updates a role with new list of permissions
|
|
383
|
-
*/
|
|
384
|
-
updateRolePermissions = this.mutation(updateRoleWithNewActions)
|
|
385
|
-
/**
|
|
386
|
-
* Updates a specific role permission
|
|
387
|
-
*/
|
|
388
|
-
updateRolePermission = this.mutation(updateResourceActions)
|
|
389
|
-
/**
|
|
390
|
-
* Gets all resources (paginated)
|
|
391
|
-
*/
|
|
392
|
-
allResources = this.infiniteQuery(getResources1)
|
|
393
|
-
/**
|
|
394
|
-
* Gets all resource types (paginated)
|
|
395
|
-
*/
|
|
396
|
-
allResourceTypes = this.infiniteQuery(getResourceTypes1)
|
|
397
|
-
/**
|
|
398
|
-
* Sends an email for downloading the CLI
|
|
399
|
-
*/
|
|
400
|
-
sendDownloadCLIEmail = this.mutation(sendDownloadEmail)
|
|
401
|
-
/**
|
|
402
|
-
* Creates an SCM credential (account level).
|
|
403
|
-
*/
|
|
404
|
-
createSCMCredential = this.mutation(scmCredentialSave1 as (variables: CreateSCMRequest, opts?: RequestOpts) => Promise<unknown>)
|
|
405
|
-
/**
|
|
406
|
-
* Updates an SCM credential (account level).
|
|
407
|
-
*/
|
|
408
|
-
updateSCMCredential = this.mutation(scmCredentialUpdate1 as (variables: UpdateSCMRequest, opts?: RequestOpts) => Promise<unknown>)
|
|
409
|
-
/**
|
|
410
|
-
* Gets all SCM credentials (account level).
|
|
411
|
-
*/
|
|
412
|
-
allSCMCredentials = this.query(listScmCredentials2)
|
|
413
|
-
/**
|
|
414
|
-
* Gets the status for the SCM credential.
|
|
415
|
-
*
|
|
416
|
-
* - If the SCM status is invalid because there's no configuration at the account level, it returns `{ status: 'missing-account' }`.
|
|
417
|
-
* - If the SCM status is invalid because, although the SCM integration is configured, the SCM access is not, it returns
|
|
418
|
-
* `{ status: 'missing-user' }`.
|
|
419
|
-
* - If the SCM status is valid, it returns `{ status: 'valid', mandate: boolean, hasUserConfiguration: boolean }`. `mandate` indicates
|
|
420
|
-
* if the SCM credential is mandatory at the account level for every user. `hasUserConfiguration` indicates if the user currently logged
|
|
421
|
-
* in has an SCM credential configured or not.
|
|
422
|
-
*/
|
|
423
|
-
scmCredentialStatus = this.query({
|
|
424
|
-
name: 'account.scmStatus',
|
|
425
|
-
request: async (signal): Promise<SCMStatus> => {
|
|
426
|
-
try {
|
|
427
|
-
const data = await isCreatedScmCredentials1({ signal })
|
|
428
|
-
return { status: 'valid', ...data }
|
|
429
|
-
} catch (error) {
|
|
430
|
-
if (error instanceof HttpError) {
|
|
431
|
-
// 404 means that the scm integration was not configured
|
|
432
|
-
if (error.status === 404) return { status: 'missing-account' }
|
|
433
|
-
// 422 means that the scm integration is configured, but the scm access is not
|
|
434
|
-
if (error.status === 422) return { status: 'missing-user' }
|
|
435
|
-
}
|
|
436
|
-
throw error
|
|
437
|
-
}
|
|
438
|
-
},
|
|
439
|
-
})
|
|
440
|
-
/**
|
|
441
|
-
* Enables Personal Access Token (PAT) generation.
|
|
442
|
-
*/
|
|
443
|
-
enablePATGeneration = this.mutation(createPersonalAccessToken)
|
|
444
|
-
/**
|
|
445
|
-
* Disables Personal Access Token (PAT) generation.
|
|
446
|
-
*/
|
|
447
|
-
disablePATGeneration = this.mutation(disablePersonalAccessTokenGeneration)
|
|
448
|
-
/**
|
|
449
|
-
* Verifies if Personal Access Token (PAT) generation is enabled.
|
|
450
|
-
*/
|
|
451
|
-
patGenerationEnabled = this.query({
|
|
452
|
-
name: 'account.patEnabled',
|
|
453
|
-
request: async (signal) => {
|
|
454
|
-
try {
|
|
455
|
-
await personalAccessTokenAuthorization({ signal })
|
|
456
|
-
return true
|
|
457
|
-
} catch (error) {
|
|
458
|
-
if (error instanceof HttpError && error.status === 404) return false
|
|
459
|
-
throw error
|
|
460
|
-
}
|
|
461
|
-
},
|
|
462
|
-
})
|
|
463
|
-
/**
|
|
464
|
-
* Verifies if the current user has an SCM credential configured.
|
|
465
|
-
*/
|
|
466
|
-
userHasSCMCredential = this.query({
|
|
467
|
-
name: 'account.userHasSCMCredential',
|
|
468
|
-
request: async (signal) => {
|
|
469
|
-
try {
|
|
470
|
-
await isCreatedScmCredentials({ signal })
|
|
471
|
-
return true
|
|
472
|
-
} catch {
|
|
473
|
-
return false
|
|
474
|
-
}
|
|
475
|
-
},
|
|
476
|
-
})
|
|
477
|
-
/**
|
|
478
|
-
* Creates an SCM credential for the user currently logged in.
|
|
479
|
-
*/
|
|
480
|
-
createUserSCMCredential = this.mutation(scmCredentialSave)
|
|
481
|
-
/**
|
|
482
|
-
* Updates an SCM credential for the user currently logged in.
|
|
483
|
-
*/
|
|
484
|
-
updateUserSCMCredential = this.mutation(scmCredentialUpdate)
|
|
485
|
-
/**
|
|
486
|
-
* Gets all SCM credentials for the user currently logged in.
|
|
487
|
-
*/
|
|
488
|
-
allUserSCMCredentials = this.query(listScmCredentials)
|
|
489
|
-
/**
|
|
490
|
-
* Gets the SCM provider.
|
|
491
|
-
*/
|
|
492
|
-
scmProvider = this.query(getScmProvider)
|
|
493
|
-
/**
|
|
494
|
-
* Deletes the SCM credentials for the user currently logged in.
|
|
495
|
-
*/
|
|
496
|
-
deleteSCMCredentials = this.mutation(scmDelete)
|
|
497
|
-
/**
|
|
498
|
-
* Gets all service credentials (paginated).
|
|
499
|
-
*/
|
|
500
|
-
allServiceCredentials = this.infiniteQuery(getServiceCredentials1)
|
|
501
|
-
/**
|
|
502
|
-
* Gets a service credential by id.
|
|
503
|
-
*/
|
|
504
|
-
serviceCredential = this.query(getServiceCredential)
|
|
505
|
-
/**
|
|
506
|
-
* Gets all the permissions linked to a service credential.
|
|
507
|
-
*/
|
|
508
|
-
serviceCredentialPermissions = this.query(getServiceCredentialPermissions)
|
|
509
|
-
/**
|
|
510
|
-
* Gets all groups linked to a service credential.
|
|
511
|
-
*/
|
|
512
|
-
serviceCredentialGroups = this.query(getServiceCredentialGroups)
|
|
513
|
-
/**
|
|
514
|
-
* Creates a service credential.
|
|
515
|
-
*/
|
|
516
|
-
createServiceCredential = this.mutation(createServiceCredential1)
|
|
517
|
-
/**
|
|
518
|
-
* Adds a service credential to several groups.
|
|
519
|
-
*/
|
|
520
|
-
addServiceCredentialToGroups = this.mutation(associateGroupToServiceCredential)
|
|
521
|
-
/**
|
|
522
|
-
* Removes a service credential from a group.
|
|
523
|
-
*/
|
|
524
|
-
removeServiceCredentialFromGroup = this.mutation(disassociateGroupToServiceCredential)
|
|
525
|
-
/**
|
|
526
|
-
* Revokes a service credential.
|
|
527
|
-
*/
|
|
528
|
-
revokeServiceCredential = this.mutation(revokeServiceCredential1)
|
|
529
|
-
/**
|
|
530
|
-
* Creates a group mapping within an SSO.
|
|
531
|
-
*/
|
|
532
|
-
createSSOGroupMapping = this.mutation(createGroupMapping)
|
|
533
|
-
/**
|
|
534
|
-
* Deletes a group mapping from an SSO.
|
|
535
|
-
*/
|
|
536
|
-
deleteSSOGroupMapping = this.mutation(deleteGroupMapping)
|
|
537
|
-
/**
|
|
538
|
-
* Updates a group mapping within an SSO.
|
|
539
|
-
*/
|
|
540
|
-
updateSSOGroupMapping = this.mutation(updateGroupMapping)
|
|
541
|
-
/**
|
|
542
|
-
* Get All SSO Group Mappings (paginated).
|
|
543
|
-
*/
|
|
544
|
-
allSSOGroupMappings = this.infiniteQuery(getAllGroupMapping, { accumulator: 'items' })
|
|
545
|
-
/**
|
|
546
|
-
* Parses a file with a configuration for an SSO. The protocol can be either SAML or OPENID.
|
|
547
|
-
*/
|
|
548
|
-
parseSSOConfig = this.mutation(ssoParseConfigurationFile)
|
|
549
|
-
/**
|
|
550
|
-
* Creates an SSO. The protocol can be either SAML or OPENID.
|
|
551
|
-
*/
|
|
552
|
-
setupSSO = this.mutation(ssoConfigure)
|
|
553
|
-
/**
|
|
554
|
-
* Gets all SSOs.
|
|
555
|
-
*/
|
|
556
|
-
allSSO = this.query(getAllAccountSso)
|
|
557
|
-
/**
|
|
558
|
-
* Updates an SSO. The payload will replace everything in the current configuration (won't be merged). Use `patchSSO` for merging.
|
|
559
|
-
*/
|
|
560
|
-
updateSSO = this.mutation(updateSso)
|
|
561
|
-
/**
|
|
562
|
-
* Patches an SSO with a partial configuration change.
|
|
563
|
-
*/
|
|
564
|
-
patchSSO = this.mutation(partialUpdateSso)
|
|
565
|
-
/**
|
|
566
|
-
* Gets an SSO by id.
|
|
567
|
-
*/
|
|
568
|
-
sso = this.query(getAccountSso)
|
|
569
|
-
/**
|
|
570
|
-
* Deletes an SSO.
|
|
571
|
-
*/
|
|
572
|
-
deleteSSO = this.mutation(deleteSso)
|
|
573
|
-
/**
|
|
574
|
-
* Gets the attributes of an SSO.
|
|
575
|
-
*/
|
|
576
|
-
ssoAttributes = this.query(ssoGetAttributesConfig)
|
|
577
|
-
/**
|
|
578
|
-
* Updates the attributes in a SSO.
|
|
579
|
-
*/
|
|
580
|
-
updateSSOAttributes = this.mutation(ssoAddAttributes)
|
|
581
|
-
|
|
582
|
-
/**
|
|
583
|
-
* Gets the preferences of a member.
|
|
584
|
-
*/
|
|
585
|
-
preferences = this.query(getMemberPreferences)
|
|
586
|
-
|
|
587
|
-
/**
|
|
588
|
-
* Updates the preferences of a member.
|
|
589
|
-
*/
|
|
590
|
-
updatePreferences = this.mutation(updateMemberPreferences)
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* Get account member favorite resources
|
|
594
|
-
*/
|
|
595
|
-
getAccountMemberFavoriteResources = this.query(listAccountMemberFavorites)
|
|
596
|
-
/**
|
|
597
|
-
* Add account member favorite resource
|
|
598
|
-
*/
|
|
599
|
-
addAccountMemberFavoriteResource = this.mutation(addAccountMemberFavorite)
|
|
600
|
-
/**
|
|
601
|
-
* Get member favorite resources by type
|
|
602
|
-
*/
|
|
603
|
-
getMemberFavoriteResourcesByType = this.query(listMemberFavoritesByResource)
|
|
604
|
-
/**
|
|
605
|
-
* Remove resource from member favorites
|
|
606
|
-
*/
|
|
607
|
-
removeResourceFromMemberFavorites = this.mutation(deleteMemberFavorite)
|
|
608
|
-
/**
|
|
609
|
-
* Validate permission access
|
|
610
|
-
*/
|
|
611
|
-
validatePermissionAccess = this.query({
|
|
612
|
-
name: 'account.getAccess',
|
|
613
|
-
request: async (signal, variables: Parameters<typeof getAccess>[0]) => {
|
|
614
|
-
try {
|
|
615
|
-
await getAccess(variables, { signal })
|
|
616
|
-
return true
|
|
617
|
-
} catch {
|
|
618
|
-
return false
|
|
619
|
-
}
|
|
620
|
-
},
|
|
621
|
-
permission: this.createPermissionFunctionFor(getAccess),
|
|
622
|
-
})
|
|
623
|
-
/**
|
|
624
|
-
* Get all account members with pagination
|
|
625
|
-
*/
|
|
626
|
-
allMembersWithPagination = this.query(getAccountMembers)
|
|
627
|
-
/**
|
|
628
|
-
* Get Members Groups By Profile
|
|
629
|
-
*/
|
|
630
|
-
allMembersGroupsByProfileWithPagination = this.query(getMemberGroups)
|
|
631
|
-
/**
|
|
632
|
-
* Get Members Roles By Profile
|
|
633
|
-
*/
|
|
634
|
-
allMembersRolesByProfileWithPagination = this.query(getRoles1)
|
|
635
|
-
/**
|
|
636
|
-
* Get all account groups with pagination
|
|
637
|
-
*/
|
|
638
|
-
allGroupsWithPagination = this.query(getGroups)
|
|
639
|
-
/**
|
|
640
|
-
* Get all members by group with pagination
|
|
641
|
-
*/
|
|
642
|
-
allMembersByGroupWithPagination = this.query(getMembers)
|
|
643
|
-
/**
|
|
644
|
-
* Get all roles by groups with pagination
|
|
645
|
-
*/
|
|
646
|
-
allRolesByGroupWithPagination = this.query(getRoles2)
|
|
647
|
-
/**
|
|
648
|
-
* Get all resources by groups with pagination
|
|
649
|
-
*/
|
|
650
|
-
allResourcesByGroupWithPagination = this.query(getGroupResources)
|
|
651
|
-
/**
|
|
652
|
-
* Get all roles account with pagination
|
|
653
|
-
*/
|
|
654
|
-
allRolesWithPagination = this.query(getRoles)
|
|
655
|
-
/**
|
|
656
|
-
* Get all members by role with pagination
|
|
657
|
-
*/
|
|
658
|
-
allMembersByRoleWithPagination = this.query(getRoleMembers)
|
|
659
|
-
/**
|
|
660
|
-
* Get all groups by roles with pagination
|
|
661
|
-
*/
|
|
662
|
-
allGroupsByRoleWithPagination = this.query(getRoleGroups)
|
|
663
|
-
/**
|
|
664
|
-
* Get Service Credentials
|
|
665
|
-
*/
|
|
666
|
-
allServiceCredentialsWithPagination = this.query(getServiceCredentials)
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
* Creates an extension.
|
|
670
|
-
*/
|
|
671
|
-
createExtension = this.mutation(createExtension)
|
|
672
|
-
|
|
673
|
-
/**
|
|
674
|
-
* Deletes an extension.
|
|
675
|
-
*/
|
|
676
|
-
deleteExtension = this.mutation(deleteExtension)
|
|
677
|
-
|
|
678
|
-
/**
|
|
679
|
-
* Updates an extension with a patch operation.
|
|
680
|
-
*/
|
|
681
|
-
patchExtension = this.mutation(updateExtension)
|
|
682
|
-
|
|
683
|
-
/**
|
|
684
|
-
* Lists all extensions.
|
|
685
|
-
*/
|
|
686
|
-
extensions = this.query(listExtensions)
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
* Lists all versions of an extension.
|
|
690
|
-
*/
|
|
691
|
-
extensionVersions = this.query(listExtensionVersions)
|
|
692
|
-
|
|
693
|
-
/**
|
|
694
|
-
* Gets a specific version of an extension.
|
|
695
|
-
*/
|
|
696
|
-
getExtensionVersion = this.query(getExtensionVersion)
|
|
697
|
-
|
|
698
|
-
/**
|
|
699
|
-
* Gets the active version of an extension.
|
|
700
|
-
*/
|
|
701
|
-
getActiveExtensionVersion = this.query(getActiveExtensionVersion)
|
|
702
|
-
|
|
703
|
-
/**
|
|
704
|
-
* Creates a new version of an extension.
|
|
705
|
-
*/
|
|
706
|
-
createExtensionVersion = this.mutation(createExtensionVersion)
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* Deletes a specific version of an extension.
|
|
710
|
-
*/
|
|
711
|
-
deleteExtensionVersion = this.mutation(deleteExtensionVersion)
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* Lists all extension links.
|
|
715
|
-
*/
|
|
716
|
-
extensionLinks = this.query(listExtensionLinks)
|
|
717
|
-
|
|
718
|
-
/**
|
|
719
|
-
* Updates an extension link with a patch operation.
|
|
720
|
-
*/
|
|
721
|
-
patchExtensionLink = this.mutation(updateExtensionLink)
|
|
722
|
-
|
|
723
|
-
/**
|
|
724
|
-
* Creates a new extension link.
|
|
725
|
-
*/
|
|
726
|
-
createExtensionLink = this.mutation(createExtensionLink)
|
|
727
|
-
|
|
728
|
-
/**
|
|
729
|
-
* Deletes an extension link.
|
|
730
|
-
*/
|
|
731
|
-
deleteExtensionLink = this.mutation(deleteExtensionLink)
|
|
732
|
-
|
|
733
|
-
/*
|
|
734
|
-
* Delete profile image
|
|
735
|
-
*/
|
|
736
|
-
deleteProfileImage = this.mutation(deleteProfileImage)
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Get secrets
|
|
740
|
-
*/
|
|
741
|
-
getSecrets = this.query(findSecrets1)
|
|
742
|
-
/**
|
|
743
|
-
* Get secret by id
|
|
744
|
-
*/
|
|
745
|
-
getSecret = this.query(getById)
|
|
746
|
-
/**
|
|
747
|
-
* Get secrets by ids
|
|
748
|
-
*/
|
|
749
|
-
getSecretsByIds = this.query({
|
|
750
|
-
name: 'getSecretsByIds',
|
|
751
|
-
request: (signal, variables: { ids: string[], }) => {
|
|
752
|
-
const requests = variables?.ids?.map((secretId) => getById({ secretId }, { signal }))
|
|
753
|
-
return Promise.all(requests)
|
|
754
|
-
}
|
|
755
|
-
})
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* Create secret
|
|
759
|
-
*/
|
|
760
|
-
createSecret = this.mutation(createSecret)
|
|
761
|
-
/**
|
|
762
|
-
* Delete secret
|
|
763
|
-
*/
|
|
764
|
-
deleteSecret = this.mutation(deleteSecret)
|
|
765
|
-
/**
|
|
766
|
-
* Update secret
|
|
767
|
-
*/
|
|
768
|
-
updateSecret = this.mutation(updateSecret)
|
|
769
|
-
/**
|
|
770
|
-
* Enable secret
|
|
771
|
-
*/
|
|
772
|
-
enableSecret = this.mutation(enableSecret)
|
|
773
|
-
/**
|
|
774
|
-
* Disable secret
|
|
775
|
-
*/
|
|
776
|
-
disableSecret = this.mutation(disableSecret)
|
|
777
|
-
|
|
778
|
-
// TRIAL
|
|
779
|
-
/**
|
|
780
|
-
* Create trial account
|
|
781
|
-
*/
|
|
782
|
-
createTrialAccount = this.mutation(createTrialAccount)
|
|
783
|
-
/**
|
|
784
|
-
* Deletes trial account
|
|
785
|
-
*/
|
|
786
|
-
deleteTrialAccount = this.mutation(removeTrialAccount)
|
|
787
|
-
/**
|
|
788
|
-
* Update trial account info
|
|
789
|
-
*/
|
|
790
|
-
updateTrialAccount = this.mutation(updatePersonalAccountDetails)
|
|
791
|
-
/**
|
|
792
|
-
* Creates a personal contact lead
|
|
793
|
-
*/
|
|
794
|
-
personalContact = this.mutation(personalContact)
|
|
795
|
-
/**
|
|
796
|
-
* Creates an enterprise contact lead
|
|
797
|
-
*/
|
|
798
|
-
enterpriseContact = this.mutation(enterpriseContact)
|
|
799
|
-
/**
|
|
800
|
-
* Get trial expiration info
|
|
801
|
-
*/
|
|
802
|
-
trialAccountDetails = this.query(getPersonalAccountDetails)
|
|
803
|
-
/**
|
|
804
|
-
* Get account rate limit
|
|
805
|
-
*/
|
|
806
|
-
getAccountRateLimit = this.query(getAccountRateLimit)
|
|
807
|
-
/**
|
|
808
|
-
* Update Account rate limit
|
|
809
|
-
*/
|
|
810
|
-
updateRateLimit = this.mutation(updateRateLimit)
|
|
811
|
-
/**
|
|
812
|
-
* Get all service credential rate limit
|
|
813
|
-
*/
|
|
814
|
-
getAllServiceCredentialRateLimit = this.query(getAllServiceCredentialRateLimit)
|
|
815
|
-
/**
|
|
816
|
-
* Update service credential rate limit
|
|
817
|
-
*/
|
|
818
|
-
updateServiceCredentialRateLimit = this.mutation(updateServiceCredentialRateLimit)
|
|
819
|
-
/**
|
|
820
|
-
* Get service credential rate limit by id
|
|
821
|
-
*/
|
|
822
|
-
getServiceCredentialByIdRateLimit = this.query(getServiceCredentialByIdRateLimit)
|
|
823
|
-
/**
|
|
824
|
-
* Create a new service credential V2
|
|
825
|
-
*/
|
|
826
|
-
createServiceCredentialV2 = this.mutation(createServiceCredential)
|
|
827
|
-
|
|
828
|
-
/**
|
|
829
|
-
* Rotate the secret of a service credential
|
|
830
|
-
*/
|
|
831
|
-
rotateServiceCredentialSecret = this.mutation(rotateServiceCredentialSecret)
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* Update the scopes of a service credential
|
|
835
|
-
*/
|
|
836
|
-
updateServiceCredentialScopes = this.mutation(updateServiceCredentialScopes)
|
|
837
|
-
|
|
838
|
-
/**
|
|
839
|
-
* Revoke a service credential V2
|
|
840
|
-
*/
|
|
841
|
-
revokeServiceCredentialV2 = this.mutation(revokeServiceCredential)
|
|
842
|
-
|
|
843
|
-
/**
|
|
844
|
-
* Validates a campaign code.
|
|
845
|
-
*/
|
|
846
|
-
validateCampaignCode = this.query(validateCampaignCode)
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* Get feature flag by id
|
|
850
|
-
*/
|
|
851
|
-
featureFlagById = this.query(getFeatureFlag)
|
|
852
|
-
/**
|
|
853
|
-
* Update feature flag by id
|
|
854
|
-
*/
|
|
855
|
-
updateFeatureFlagById = this.mutation(updateFeatureFlag)
|
|
856
|
-
/**
|
|
857
|
-
* Get enabled feature flags for an account
|
|
858
|
-
*/
|
|
859
|
-
getEnabledFeatureFlagsForAccount = this.query(getEnabledFeatureFlagsForAccount)
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
* Retries a external link by type.
|
|
863
|
-
*/
|
|
864
|
-
getExternalLinksByType = this.query(getExternalLinksByType)
|
|
865
|
-
|
|
866
|
-
/** Account admin flow - for backoffice use */
|
|
867
|
-
|
|
868
|
-
/**
|
|
869
|
-
* Create an enterprise account
|
|
870
|
-
*/
|
|
871
|
-
createEnterpriseAccount = this.mutation(create1)
|
|
872
|
-
/**
|
|
873
|
-
* Lists enterprise accounts
|
|
874
|
-
*/
|
|
875
|
-
getEnterpriseAccounts = this.query(getAccounts1)
|
|
876
|
-
/**
|
|
877
|
-
* Get an enterprise account
|
|
878
|
-
*/
|
|
879
|
-
getEnterpriseAccount = this.query(getAccount1)
|
|
880
|
-
/**
|
|
881
|
-
* Adds a new email domain to an existing account
|
|
882
|
-
*/
|
|
883
|
-
addEmailDomain = this.mutation(addNewEmailDomain)
|
|
884
|
-
/**
|
|
885
|
-
* Updates the sales representatives
|
|
886
|
-
*/
|
|
887
|
-
updateSalesRepresentatives = this.mutation(updateSalesRepresentatives)
|
|
888
|
-
/**
|
|
889
|
-
* Create FIDO magic link
|
|
890
|
-
*/
|
|
891
|
-
createFidoMagicLink = this.mutation(createFidoMagicLink)
|
|
892
|
-
/**
|
|
893
|
-
* Delete FIDO key
|
|
894
|
-
*/
|
|
895
|
-
deleteFidoKey = this.mutation(deleteFidoKey)
|
|
896
|
-
/**
|
|
897
|
-
* Find Secret Associations
|
|
898
|
-
*/
|
|
899
|
-
findSecretAssociations = this.infiniteQuery(findAssociations, { accumulator: 'items' })
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
export const accountClient = new AccountClient()
|
|
1
|
+
import { HttpError, RequestOpts } from '@oazapfts/runtime'
|
|
2
|
+
import { getApiAddresses } from '../api-addresses'
|
|
3
|
+
import {
|
|
4
|
+
addAccountMemberFavorite,
|
|
5
|
+
addNewEmailDomain,
|
|
6
|
+
addResourcesToGroup,
|
|
7
|
+
addRoleToMember,
|
|
8
|
+
associateGroupToServiceCredential,
|
|
9
|
+
bindGroupMembers,
|
|
10
|
+
bindRoleGroups,
|
|
11
|
+
bindRoles,
|
|
12
|
+
bindToGroups,
|
|
13
|
+
bindToRoles,
|
|
14
|
+
create,
|
|
15
|
+
create1,
|
|
16
|
+
createAccountRole, createExtension, createExtensionLink,
|
|
17
|
+
createExtensionVersion, createFidoMagicLink, createGroupMapping,
|
|
18
|
+
createPartner,
|
|
19
|
+
createPersonalAccessToken,
|
|
20
|
+
createSecret,
|
|
21
|
+
createServiceCredential,
|
|
22
|
+
createServiceCredential1,
|
|
23
|
+
createTrialAccount,
|
|
24
|
+
createUser,
|
|
25
|
+
deactivateFidoCredentials,
|
|
26
|
+
defaults,
|
|
27
|
+
delete1,
|
|
28
|
+
deleteAccountRole,
|
|
29
|
+
deleteExtension,
|
|
30
|
+
deleteExtensionLink,
|
|
31
|
+
deleteExtensionVersion,
|
|
32
|
+
deleteFidoKey,
|
|
33
|
+
deleteGroupMapping,
|
|
34
|
+
deleteMember,
|
|
35
|
+
deleteMemberFavorite,
|
|
36
|
+
deletePartner, deleteProfileImage,
|
|
37
|
+
deleteResourceFromGroup, deleteRole, deleteSecret, deleteSso,
|
|
38
|
+
disablePersonalAccessTokenGeneration,
|
|
39
|
+
disableSecret,
|
|
40
|
+
disassociateGroupToServiceCredential, enableFidoCredentials,
|
|
41
|
+
enableSecret,
|
|
42
|
+
enterpriseContact,
|
|
43
|
+
findAssociations,
|
|
44
|
+
findSecrets1,
|
|
45
|
+
getAccess,
|
|
46
|
+
getAccount1,
|
|
47
|
+
getAccountMembers,
|
|
48
|
+
getAccountMembers2,
|
|
49
|
+
getAccountRateLimit,
|
|
50
|
+
getAccounts1,
|
|
51
|
+
getAccountSso,
|
|
52
|
+
getActiveExtensionVersion,
|
|
53
|
+
getAllAccountSso,
|
|
54
|
+
getAllGroupMapping,
|
|
55
|
+
getAllMemberFidoCredentials,
|
|
56
|
+
getAllServiceCredentialRateLimit,
|
|
57
|
+
getById,
|
|
58
|
+
getEnabledFeatureFlagsForAccount,
|
|
59
|
+
getExtensionVersion,
|
|
60
|
+
getExternalLinksByType,
|
|
61
|
+
getFeatureFlag,
|
|
62
|
+
getFeatures,
|
|
63
|
+
getFeatures3,
|
|
64
|
+
getGroupById,
|
|
65
|
+
getGroupResources,
|
|
66
|
+
getGroupResources1,
|
|
67
|
+
getGroups,
|
|
68
|
+
getGroups1,
|
|
69
|
+
getMemberById,
|
|
70
|
+
getMemberGroups,
|
|
71
|
+
getMemberGroups1,
|
|
72
|
+
getMemberPreferences,
|
|
73
|
+
getMembers,
|
|
74
|
+
getMembers1,
|
|
75
|
+
getPartnerAccount, getPartnersSharingAllowed,
|
|
76
|
+
getPersonalAccountDetails,
|
|
77
|
+
getPersonalClientCredentials,
|
|
78
|
+
getResources1,
|
|
79
|
+
getResources2,
|
|
80
|
+
getResourcesAndActionsWithStatus1,
|
|
81
|
+
getResourceTypes1,
|
|
82
|
+
getRoleGroups,
|
|
83
|
+
getRoleGroups1,
|
|
84
|
+
getRoleMembers,
|
|
85
|
+
getRoleMembers1,
|
|
86
|
+
getRoles,
|
|
87
|
+
getRoles1,
|
|
88
|
+
getRoles2,
|
|
89
|
+
getRoles3,
|
|
90
|
+
getRoles4, getRoles5,
|
|
91
|
+
getScmProvider,
|
|
92
|
+
getServiceCredential,
|
|
93
|
+
getServiceCredentialByIdRateLimit,
|
|
94
|
+
getServiceCredentialGroups,
|
|
95
|
+
getServiceCredentialPermissions,
|
|
96
|
+
getServiceCredentials,
|
|
97
|
+
getServiceCredentials1,
|
|
98
|
+
isCreatedScmCredentials,
|
|
99
|
+
isCreatedScmCredentials1,
|
|
100
|
+
listAccountMemberFavorites,
|
|
101
|
+
listExtensionLinks,
|
|
102
|
+
listExtensions,
|
|
103
|
+
listExtensionVersions,
|
|
104
|
+
listMemberFavoritesByResource,
|
|
105
|
+
listScmCredentials,
|
|
106
|
+
listScmCredentials2, partialUpdateSso, personalAccessTokenAuthorization,
|
|
107
|
+
personalContact,
|
|
108
|
+
removeRoleFromMember,
|
|
109
|
+
removeTrialAccount,
|
|
110
|
+
resetOtp,
|
|
111
|
+
resetPassword,
|
|
112
|
+
revokeServiceCredential,
|
|
113
|
+
revokeServiceCredential1,
|
|
114
|
+
rotateServiceCredentialSecret,
|
|
115
|
+
save,
|
|
116
|
+
scmCredentialSave, scmCredentialSave1, scmCredentialUpdate, scmCredentialUpdate1, scmDelete, sendDownloadEmail, ssoAddAttributes,
|
|
117
|
+
ssoConfigure, ssoGetAttributesConfig, ssoParseConfigurationFile, update1,
|
|
118
|
+
updateAccountRole,
|
|
119
|
+
updateExtension,
|
|
120
|
+
updateExtensionLink,
|
|
121
|
+
updateFeatureFlag,
|
|
122
|
+
updateGroupMapping,
|
|
123
|
+
updateMemberPreferences,
|
|
124
|
+
updatePartnerAccountAdminData,
|
|
125
|
+
updatePartnerAccountData,
|
|
126
|
+
updatePersonalAccountDetails,
|
|
127
|
+
updateRateLimit,
|
|
128
|
+
updateResourceActions,
|
|
129
|
+
updateRoleWithNewActions,
|
|
130
|
+
updateSalesRepresentatives,
|
|
131
|
+
updateSecret,
|
|
132
|
+
updateServiceCredentialRateLimit,
|
|
133
|
+
updateServiceCredentialScopes,
|
|
134
|
+
updateSso,
|
|
135
|
+
updateUser,
|
|
136
|
+
validateCampaignCode,
|
|
137
|
+
validateNewPartnerData,
|
|
138
|
+
validatePartnerAssociationLimit,
|
|
139
|
+
} from '../api/account'
|
|
140
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
141
|
+
import { accountDictionary } from '../error/dictionary/account'
|
|
142
|
+
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
143
|
+
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
144
|
+
import { CreateSCMRequest, SCMStatus, UpdateSCMRequest } from './types'
|
|
145
|
+
|
|
146
|
+
class AccountClient extends ReactQueryNetworkClient {
|
|
147
|
+
constructor() {
|
|
148
|
+
super(getApiAddresses().account.url, defaults)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
152
|
+
return new DefaultAPIError(error.data, error.status, accountDictionary, error.headers)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Gets credentials from personal service client (create if not exists one to the logged user).
|
|
157
|
+
*/
|
|
158
|
+
generatePersonalClientCredentials = this.mutation(getPersonalClientCredentials)
|
|
159
|
+
/**
|
|
160
|
+
* Creates a Feature Flag
|
|
161
|
+
*/
|
|
162
|
+
createFeatureFlag = this.mutation(create)
|
|
163
|
+
/**
|
|
164
|
+
* Lists all Feature Flags in an Account
|
|
165
|
+
*/
|
|
166
|
+
featureFlags = this.query(getFeatures3)
|
|
167
|
+
/**
|
|
168
|
+
* Lists all Feature Flags in an Account With Pagination
|
|
169
|
+
*/
|
|
170
|
+
featureFlagsWithPagination = this.query(getFeatures)
|
|
171
|
+
/**
|
|
172
|
+
* Gets Partners with whom it is allowed to share content.
|
|
173
|
+
*/
|
|
174
|
+
partners = this.query(getPartnersSharingAllowed)
|
|
175
|
+
/**
|
|
176
|
+
* Gets Partner by account Id
|
|
177
|
+
*/
|
|
178
|
+
partner = this.query(getPartnerAccount)
|
|
179
|
+
/**
|
|
180
|
+
* Creates an Account Order for Partner
|
|
181
|
+
*/
|
|
182
|
+
createPartner = this.mutation(createPartner)
|
|
183
|
+
/**
|
|
184
|
+
* Updates Partner Account data.
|
|
185
|
+
*/
|
|
186
|
+
updatePartner = this.mutation(updatePartnerAccountData)
|
|
187
|
+
/**
|
|
188
|
+
* Updates Partner Account Admin data.
|
|
189
|
+
*/
|
|
190
|
+
updatePartnerAdmin = this.mutation(updatePartnerAccountAdminData)
|
|
191
|
+
/**
|
|
192
|
+
* Deletes Partner
|
|
193
|
+
*/
|
|
194
|
+
deactivatePartner = this.mutation(deletePartner)
|
|
195
|
+
/**
|
|
196
|
+
* Validates new Partner account data
|
|
197
|
+
*/
|
|
198
|
+
validateNewPartnerData = this.mutation(validateNewPartnerData)
|
|
199
|
+
/**
|
|
200
|
+
* Validates the association limit for the partner. Yields `{ isValid: true }` if valid or `{ isValid: false, message: string }`
|
|
201
|
+
* otherwise.
|
|
202
|
+
*/
|
|
203
|
+
validatePartnerAssociationLimit = this.query({
|
|
204
|
+
name: 'validatePartnerAssociationLimit',
|
|
205
|
+
request: async (signal) => {
|
|
206
|
+
try {
|
|
207
|
+
await validatePartnerAssociationLimit({ signal })
|
|
208
|
+
return { isValid: true, message: '' }
|
|
209
|
+
} catch (error) {
|
|
210
|
+
if (error instanceof HttpError) {
|
|
211
|
+
const stkError = this.buildStackSpotError(error)
|
|
212
|
+
if (stkError.status === 422 || stkError.code === 'BAD_USER_INPUT') return { isValid: false, message: stkError.translate() }
|
|
213
|
+
}
|
|
214
|
+
throw error
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
})
|
|
218
|
+
/**
|
|
219
|
+
* Gets member by id.
|
|
220
|
+
*/
|
|
221
|
+
member = this.query(getMemberById)
|
|
222
|
+
/**
|
|
223
|
+
* Gets all members (paginated).
|
|
224
|
+
*/
|
|
225
|
+
allMembers = this.infiniteQuery(getAccountMembers2)
|
|
226
|
+
/**
|
|
227
|
+
* Gets member Groups (paginated).
|
|
228
|
+
*/
|
|
229
|
+
memberGroups = this.infiniteQuery(getMemberGroups1)
|
|
230
|
+
/**
|
|
231
|
+
* Gets member roles (paginated).
|
|
232
|
+
*/
|
|
233
|
+
memberRoles = this.infiniteQuery(getRoles4)
|
|
234
|
+
/**
|
|
235
|
+
* Gets member resources.
|
|
236
|
+
*/
|
|
237
|
+
memberResources = this.query(getResources2)
|
|
238
|
+
/**
|
|
239
|
+
* Gets All Fido credentials for the given member (paginated).
|
|
240
|
+
*/
|
|
241
|
+
fidoCredentials = this.infiniteQuery(getAllMemberFidoCredentials, { accumulator: 'items' })
|
|
242
|
+
/**
|
|
243
|
+
* Creates member on current tenant.
|
|
244
|
+
*/
|
|
245
|
+
createMember = this.mutation(createUser)
|
|
246
|
+
/**
|
|
247
|
+
* Updates member on current tenant.
|
|
248
|
+
*/
|
|
249
|
+
updateMember = this.mutation(updateUser)
|
|
250
|
+
/**
|
|
251
|
+
* Adds a member to several groups.
|
|
252
|
+
*/
|
|
253
|
+
addMemberToGroups = this.mutation(bindToGroups)
|
|
254
|
+
/**
|
|
255
|
+
* Attributes several roles to a member.
|
|
256
|
+
*/
|
|
257
|
+
addRolesToMember = this.mutation(bindToRoles)
|
|
258
|
+
/**
|
|
259
|
+
* Removes a role from a member.
|
|
260
|
+
*/
|
|
261
|
+
removeRoleFromMember = this.mutation(removeRoleFromMember)
|
|
262
|
+
/**
|
|
263
|
+
* Sends an e-mail to reset the password of the member with the provided e-mail address.
|
|
264
|
+
*/
|
|
265
|
+
resetMemberPassword = this.mutation(resetPassword)
|
|
266
|
+
/**
|
|
267
|
+
* Reset member OTP
|
|
268
|
+
*/
|
|
269
|
+
resetOtp = this.mutation(resetOtp)
|
|
270
|
+
/**
|
|
271
|
+
* Enables Fido credentials for the given member.
|
|
272
|
+
*/
|
|
273
|
+
enableFidoCredentials = this.mutation(enableFidoCredentials)
|
|
274
|
+
/**
|
|
275
|
+
* Disables Fido credentials for the given member.
|
|
276
|
+
*/
|
|
277
|
+
disableFidoCredentials = this.mutation(deactivateFidoCredentials)
|
|
278
|
+
/**
|
|
279
|
+
* Gets group by id.
|
|
280
|
+
*/
|
|
281
|
+
group = this.query(getGroupById)
|
|
282
|
+
/**
|
|
283
|
+
* Get all groups (paginated).
|
|
284
|
+
*/
|
|
285
|
+
allGroups = this.infiniteQuery(getGroups1)
|
|
286
|
+
/**
|
|
287
|
+
* Creates a group.
|
|
288
|
+
*/
|
|
289
|
+
createGroup = this.mutation(save)
|
|
290
|
+
/**
|
|
291
|
+
* Updates a group.
|
|
292
|
+
*/
|
|
293
|
+
updateGroup = this.mutation(update1)
|
|
294
|
+
/**
|
|
295
|
+
* Deletes a group.
|
|
296
|
+
*/
|
|
297
|
+
deleteGroup = this.mutation(delete1)
|
|
298
|
+
/**
|
|
299
|
+
* Gets all members in a group (paginated).
|
|
300
|
+
*/
|
|
301
|
+
groupMembers = this.infiniteQuery(getMembers1)
|
|
302
|
+
/**
|
|
303
|
+
* Adds several members to a group
|
|
304
|
+
*/
|
|
305
|
+
addMembersToGroup = this.mutation(bindGroupMembers)
|
|
306
|
+
/**
|
|
307
|
+
* Removes a member from a group
|
|
308
|
+
*/
|
|
309
|
+
removeMemberFromGroup = this.mutation(deleteMember)
|
|
310
|
+
/**
|
|
311
|
+
* Gets all roles of a group.
|
|
312
|
+
*/
|
|
313
|
+
groupRoles = this.infiniteQuery(getRoles5)
|
|
314
|
+
/**
|
|
315
|
+
* Adds several roles to a group.
|
|
316
|
+
*/
|
|
317
|
+
addRolesToGroup = this.mutation(bindRoles)
|
|
318
|
+
/**
|
|
319
|
+
* Removes a role from a group.
|
|
320
|
+
*/
|
|
321
|
+
removeRoleFromGroup = this.mutation(deleteRole)
|
|
322
|
+
/**
|
|
323
|
+
* Gets all resources of a group (paginated).
|
|
324
|
+
*/
|
|
325
|
+
groupResources = this.infiniteQuery(getGroupResources1)
|
|
326
|
+
/**
|
|
327
|
+
* Adds several resources to a group.
|
|
328
|
+
*/
|
|
329
|
+
addResourcesToGroup = this.mutation(addResourcesToGroup)
|
|
330
|
+
/**
|
|
331
|
+
* Removes a resource from a group.
|
|
332
|
+
*/
|
|
333
|
+
removeResourceFromGroup = this.mutation(deleteResourceFromGroup)
|
|
334
|
+
/**
|
|
335
|
+
* Gets all roles in the account (paginated)
|
|
336
|
+
*/
|
|
337
|
+
allRoles = this.infiniteQuery(getRoles3)
|
|
338
|
+
/**
|
|
339
|
+
* Get a role by id
|
|
340
|
+
*/
|
|
341
|
+
role = this.query({
|
|
342
|
+
name: 'account.role',
|
|
343
|
+
request: async (signal, { id }: { id: string }) => {
|
|
344
|
+
const roles = await getRoles3({ filterBy: 'id', filterValue: id }, { signal })
|
|
345
|
+
if (!roles.length) throw new StackspotAPIError({ status: 404 })
|
|
346
|
+
return roles[0]
|
|
347
|
+
},
|
|
348
|
+
})
|
|
349
|
+
/**
|
|
350
|
+
* Gets all members with the provided role (paginated)
|
|
351
|
+
*/
|
|
352
|
+
roleMembers = this.infiniteQuery(getRoleMembers1)
|
|
353
|
+
/**
|
|
354
|
+
* Creates a role
|
|
355
|
+
*/
|
|
356
|
+
createRole = this.mutation(createAccountRole)
|
|
357
|
+
/**
|
|
358
|
+
* Updates a role
|
|
359
|
+
*/
|
|
360
|
+
updateRole = this.mutation(updateAccountRole)
|
|
361
|
+
/**
|
|
362
|
+
* Deletes a role
|
|
363
|
+
*/
|
|
364
|
+
deleteRole = this.mutation(deleteAccountRole)
|
|
365
|
+
/**
|
|
366
|
+
* Adds a role to several members
|
|
367
|
+
*/
|
|
368
|
+
addRoleToMembers = this.mutation(addRoleToMember)
|
|
369
|
+
/**
|
|
370
|
+
* Gets all groups with the provided role (paginated)
|
|
371
|
+
*/
|
|
372
|
+
roleGroups = this.infiniteQuery(getRoleGroups1)
|
|
373
|
+
/**
|
|
374
|
+
* Adds a role to several groups
|
|
375
|
+
*/
|
|
376
|
+
addRoleToGroups = this.mutation(bindRoleGroups)
|
|
377
|
+
/**
|
|
378
|
+
* Get the actions a role is allowed to perform
|
|
379
|
+
*/
|
|
380
|
+
rolePermissions = this.infiniteQuery(getResourcesAndActionsWithStatus1)
|
|
381
|
+
/**
|
|
382
|
+
* Updates a role with new list of permissions
|
|
383
|
+
*/
|
|
384
|
+
updateRolePermissions = this.mutation(updateRoleWithNewActions)
|
|
385
|
+
/**
|
|
386
|
+
* Updates a specific role permission
|
|
387
|
+
*/
|
|
388
|
+
updateRolePermission = this.mutation(updateResourceActions)
|
|
389
|
+
/**
|
|
390
|
+
* Gets all resources (paginated)
|
|
391
|
+
*/
|
|
392
|
+
allResources = this.infiniteQuery(getResources1)
|
|
393
|
+
/**
|
|
394
|
+
* Gets all resource types (paginated)
|
|
395
|
+
*/
|
|
396
|
+
allResourceTypes = this.infiniteQuery(getResourceTypes1)
|
|
397
|
+
/**
|
|
398
|
+
* Sends an email for downloading the CLI
|
|
399
|
+
*/
|
|
400
|
+
sendDownloadCLIEmail = this.mutation(sendDownloadEmail)
|
|
401
|
+
/**
|
|
402
|
+
* Creates an SCM credential (account level).
|
|
403
|
+
*/
|
|
404
|
+
createSCMCredential = this.mutation(scmCredentialSave1 as (variables: CreateSCMRequest, opts?: RequestOpts) => Promise<unknown>)
|
|
405
|
+
/**
|
|
406
|
+
* Updates an SCM credential (account level).
|
|
407
|
+
*/
|
|
408
|
+
updateSCMCredential = this.mutation(scmCredentialUpdate1 as (variables: UpdateSCMRequest, opts?: RequestOpts) => Promise<unknown>)
|
|
409
|
+
/**
|
|
410
|
+
* Gets all SCM credentials (account level).
|
|
411
|
+
*/
|
|
412
|
+
allSCMCredentials = this.query(listScmCredentials2)
|
|
413
|
+
/**
|
|
414
|
+
* Gets the status for the SCM credential.
|
|
415
|
+
*
|
|
416
|
+
* - If the SCM status is invalid because there's no configuration at the account level, it returns `{ status: 'missing-account' }`.
|
|
417
|
+
* - If the SCM status is invalid because, although the SCM integration is configured, the SCM access is not, it returns
|
|
418
|
+
* `{ status: 'missing-user' }`.
|
|
419
|
+
* - If the SCM status is valid, it returns `{ status: 'valid', mandate: boolean, hasUserConfiguration: boolean }`. `mandate` indicates
|
|
420
|
+
* if the SCM credential is mandatory at the account level for every user. `hasUserConfiguration` indicates if the user currently logged
|
|
421
|
+
* in has an SCM credential configured or not.
|
|
422
|
+
*/
|
|
423
|
+
scmCredentialStatus = this.query({
|
|
424
|
+
name: 'account.scmStatus',
|
|
425
|
+
request: async (signal): Promise<SCMStatus> => {
|
|
426
|
+
try {
|
|
427
|
+
const data = await isCreatedScmCredentials1({ signal })
|
|
428
|
+
return { status: 'valid', ...data }
|
|
429
|
+
} catch (error) {
|
|
430
|
+
if (error instanceof HttpError) {
|
|
431
|
+
// 404 means that the scm integration was not configured
|
|
432
|
+
if (error.status === 404) return { status: 'missing-account' }
|
|
433
|
+
// 422 means that the scm integration is configured, but the scm access is not
|
|
434
|
+
if (error.status === 422) return { status: 'missing-user' }
|
|
435
|
+
}
|
|
436
|
+
throw error
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
})
|
|
440
|
+
/**
|
|
441
|
+
* Enables Personal Access Token (PAT) generation.
|
|
442
|
+
*/
|
|
443
|
+
enablePATGeneration = this.mutation(createPersonalAccessToken)
|
|
444
|
+
/**
|
|
445
|
+
* Disables Personal Access Token (PAT) generation.
|
|
446
|
+
*/
|
|
447
|
+
disablePATGeneration = this.mutation(disablePersonalAccessTokenGeneration)
|
|
448
|
+
/**
|
|
449
|
+
* Verifies if Personal Access Token (PAT) generation is enabled.
|
|
450
|
+
*/
|
|
451
|
+
patGenerationEnabled = this.query({
|
|
452
|
+
name: 'account.patEnabled',
|
|
453
|
+
request: async (signal) => {
|
|
454
|
+
try {
|
|
455
|
+
await personalAccessTokenAuthorization({ signal })
|
|
456
|
+
return true
|
|
457
|
+
} catch (error) {
|
|
458
|
+
if (error instanceof HttpError && error.status === 404) return false
|
|
459
|
+
throw error
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
})
|
|
463
|
+
/**
|
|
464
|
+
* Verifies if the current user has an SCM credential configured.
|
|
465
|
+
*/
|
|
466
|
+
userHasSCMCredential = this.query({
|
|
467
|
+
name: 'account.userHasSCMCredential',
|
|
468
|
+
request: async (signal) => {
|
|
469
|
+
try {
|
|
470
|
+
await isCreatedScmCredentials({ signal })
|
|
471
|
+
return true
|
|
472
|
+
} catch {
|
|
473
|
+
return false
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
})
|
|
477
|
+
/**
|
|
478
|
+
* Creates an SCM credential for the user currently logged in.
|
|
479
|
+
*/
|
|
480
|
+
createUserSCMCredential = this.mutation(scmCredentialSave)
|
|
481
|
+
/**
|
|
482
|
+
* Updates an SCM credential for the user currently logged in.
|
|
483
|
+
*/
|
|
484
|
+
updateUserSCMCredential = this.mutation(scmCredentialUpdate)
|
|
485
|
+
/**
|
|
486
|
+
* Gets all SCM credentials for the user currently logged in.
|
|
487
|
+
*/
|
|
488
|
+
allUserSCMCredentials = this.query(listScmCredentials)
|
|
489
|
+
/**
|
|
490
|
+
* Gets the SCM provider.
|
|
491
|
+
*/
|
|
492
|
+
scmProvider = this.query(getScmProvider)
|
|
493
|
+
/**
|
|
494
|
+
* Deletes the SCM credentials for the user currently logged in.
|
|
495
|
+
*/
|
|
496
|
+
deleteSCMCredentials = this.mutation(scmDelete)
|
|
497
|
+
/**
|
|
498
|
+
* Gets all service credentials (paginated).
|
|
499
|
+
*/
|
|
500
|
+
allServiceCredentials = this.infiniteQuery(getServiceCredentials1)
|
|
501
|
+
/**
|
|
502
|
+
* Gets a service credential by id.
|
|
503
|
+
*/
|
|
504
|
+
serviceCredential = this.query(getServiceCredential)
|
|
505
|
+
/**
|
|
506
|
+
* Gets all the permissions linked to a service credential.
|
|
507
|
+
*/
|
|
508
|
+
serviceCredentialPermissions = this.query(getServiceCredentialPermissions)
|
|
509
|
+
/**
|
|
510
|
+
* Gets all groups linked to a service credential.
|
|
511
|
+
*/
|
|
512
|
+
serviceCredentialGroups = this.query(getServiceCredentialGroups)
|
|
513
|
+
/**
|
|
514
|
+
* Creates a service credential.
|
|
515
|
+
*/
|
|
516
|
+
createServiceCredential = this.mutation(createServiceCredential1)
|
|
517
|
+
/**
|
|
518
|
+
* Adds a service credential to several groups.
|
|
519
|
+
*/
|
|
520
|
+
addServiceCredentialToGroups = this.mutation(associateGroupToServiceCredential)
|
|
521
|
+
/**
|
|
522
|
+
* Removes a service credential from a group.
|
|
523
|
+
*/
|
|
524
|
+
removeServiceCredentialFromGroup = this.mutation(disassociateGroupToServiceCredential)
|
|
525
|
+
/**
|
|
526
|
+
* Revokes a service credential.
|
|
527
|
+
*/
|
|
528
|
+
revokeServiceCredential = this.mutation(revokeServiceCredential1)
|
|
529
|
+
/**
|
|
530
|
+
* Creates a group mapping within an SSO.
|
|
531
|
+
*/
|
|
532
|
+
createSSOGroupMapping = this.mutation(createGroupMapping)
|
|
533
|
+
/**
|
|
534
|
+
* Deletes a group mapping from an SSO.
|
|
535
|
+
*/
|
|
536
|
+
deleteSSOGroupMapping = this.mutation(deleteGroupMapping)
|
|
537
|
+
/**
|
|
538
|
+
* Updates a group mapping within an SSO.
|
|
539
|
+
*/
|
|
540
|
+
updateSSOGroupMapping = this.mutation(updateGroupMapping)
|
|
541
|
+
/**
|
|
542
|
+
* Get All SSO Group Mappings (paginated).
|
|
543
|
+
*/
|
|
544
|
+
allSSOGroupMappings = this.infiniteQuery(getAllGroupMapping, { accumulator: 'items' })
|
|
545
|
+
/**
|
|
546
|
+
* Parses a file with a configuration for an SSO. The protocol can be either SAML or OPENID.
|
|
547
|
+
*/
|
|
548
|
+
parseSSOConfig = this.mutation(ssoParseConfigurationFile)
|
|
549
|
+
/**
|
|
550
|
+
* Creates an SSO. The protocol can be either SAML or OPENID.
|
|
551
|
+
*/
|
|
552
|
+
setupSSO = this.mutation(ssoConfigure)
|
|
553
|
+
/**
|
|
554
|
+
* Gets all SSOs.
|
|
555
|
+
*/
|
|
556
|
+
allSSO = this.query(getAllAccountSso)
|
|
557
|
+
/**
|
|
558
|
+
* Updates an SSO. The payload will replace everything in the current configuration (won't be merged). Use `patchSSO` for merging.
|
|
559
|
+
*/
|
|
560
|
+
updateSSO = this.mutation(updateSso)
|
|
561
|
+
/**
|
|
562
|
+
* Patches an SSO with a partial configuration change.
|
|
563
|
+
*/
|
|
564
|
+
patchSSO = this.mutation(partialUpdateSso)
|
|
565
|
+
/**
|
|
566
|
+
* Gets an SSO by id.
|
|
567
|
+
*/
|
|
568
|
+
sso = this.query(getAccountSso)
|
|
569
|
+
/**
|
|
570
|
+
* Deletes an SSO.
|
|
571
|
+
*/
|
|
572
|
+
deleteSSO = this.mutation(deleteSso)
|
|
573
|
+
/**
|
|
574
|
+
* Gets the attributes of an SSO.
|
|
575
|
+
*/
|
|
576
|
+
ssoAttributes = this.query(ssoGetAttributesConfig)
|
|
577
|
+
/**
|
|
578
|
+
* Updates the attributes in a SSO.
|
|
579
|
+
*/
|
|
580
|
+
updateSSOAttributes = this.mutation(ssoAddAttributes)
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Gets the preferences of a member.
|
|
584
|
+
*/
|
|
585
|
+
preferences = this.query(getMemberPreferences)
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Updates the preferences of a member.
|
|
589
|
+
*/
|
|
590
|
+
updatePreferences = this.mutation(updateMemberPreferences)
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Get account member favorite resources
|
|
594
|
+
*/
|
|
595
|
+
getAccountMemberFavoriteResources = this.query(listAccountMemberFavorites)
|
|
596
|
+
/**
|
|
597
|
+
* Add account member favorite resource
|
|
598
|
+
*/
|
|
599
|
+
addAccountMemberFavoriteResource = this.mutation(addAccountMemberFavorite)
|
|
600
|
+
/**
|
|
601
|
+
* Get member favorite resources by type
|
|
602
|
+
*/
|
|
603
|
+
getMemberFavoriteResourcesByType = this.query(listMemberFavoritesByResource)
|
|
604
|
+
/**
|
|
605
|
+
* Remove resource from member favorites
|
|
606
|
+
*/
|
|
607
|
+
removeResourceFromMemberFavorites = this.mutation(deleteMemberFavorite)
|
|
608
|
+
/**
|
|
609
|
+
* Validate permission access
|
|
610
|
+
*/
|
|
611
|
+
validatePermissionAccess = this.query({
|
|
612
|
+
name: 'account.getAccess',
|
|
613
|
+
request: async (signal, variables: Parameters<typeof getAccess>[0]) => {
|
|
614
|
+
try {
|
|
615
|
+
await getAccess(variables, { signal })
|
|
616
|
+
return true
|
|
617
|
+
} catch {
|
|
618
|
+
return false
|
|
619
|
+
}
|
|
620
|
+
},
|
|
621
|
+
permission: this.createPermissionFunctionFor(getAccess),
|
|
622
|
+
})
|
|
623
|
+
/**
|
|
624
|
+
* Get all account members with pagination
|
|
625
|
+
*/
|
|
626
|
+
allMembersWithPagination = this.query(getAccountMembers)
|
|
627
|
+
/**
|
|
628
|
+
* Get Members Groups By Profile
|
|
629
|
+
*/
|
|
630
|
+
allMembersGroupsByProfileWithPagination = this.query(getMemberGroups)
|
|
631
|
+
/**
|
|
632
|
+
* Get Members Roles By Profile
|
|
633
|
+
*/
|
|
634
|
+
allMembersRolesByProfileWithPagination = this.query(getRoles1)
|
|
635
|
+
/**
|
|
636
|
+
* Get all account groups with pagination
|
|
637
|
+
*/
|
|
638
|
+
allGroupsWithPagination = this.query(getGroups)
|
|
639
|
+
/**
|
|
640
|
+
* Get all members by group with pagination
|
|
641
|
+
*/
|
|
642
|
+
allMembersByGroupWithPagination = this.query(getMembers)
|
|
643
|
+
/**
|
|
644
|
+
* Get all roles by groups with pagination
|
|
645
|
+
*/
|
|
646
|
+
allRolesByGroupWithPagination = this.query(getRoles2)
|
|
647
|
+
/**
|
|
648
|
+
* Get all resources by groups with pagination
|
|
649
|
+
*/
|
|
650
|
+
allResourcesByGroupWithPagination = this.query(getGroupResources)
|
|
651
|
+
/**
|
|
652
|
+
* Get all roles account with pagination
|
|
653
|
+
*/
|
|
654
|
+
allRolesWithPagination = this.query(getRoles)
|
|
655
|
+
/**
|
|
656
|
+
* Get all members by role with pagination
|
|
657
|
+
*/
|
|
658
|
+
allMembersByRoleWithPagination = this.query(getRoleMembers)
|
|
659
|
+
/**
|
|
660
|
+
* Get all groups by roles with pagination
|
|
661
|
+
*/
|
|
662
|
+
allGroupsByRoleWithPagination = this.query(getRoleGroups)
|
|
663
|
+
/**
|
|
664
|
+
* Get Service Credentials
|
|
665
|
+
*/
|
|
666
|
+
allServiceCredentialsWithPagination = this.query(getServiceCredentials)
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Creates an extension.
|
|
670
|
+
*/
|
|
671
|
+
createExtension = this.mutation(createExtension)
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Deletes an extension.
|
|
675
|
+
*/
|
|
676
|
+
deleteExtension = this.mutation(deleteExtension)
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* Updates an extension with a patch operation.
|
|
680
|
+
*/
|
|
681
|
+
patchExtension = this.mutation(updateExtension)
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Lists all extensions.
|
|
685
|
+
*/
|
|
686
|
+
extensions = this.query(listExtensions)
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Lists all versions of an extension.
|
|
690
|
+
*/
|
|
691
|
+
extensionVersions = this.query(listExtensionVersions)
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Gets a specific version of an extension.
|
|
695
|
+
*/
|
|
696
|
+
getExtensionVersion = this.query(getExtensionVersion)
|
|
697
|
+
|
|
698
|
+
/**
|
|
699
|
+
* Gets the active version of an extension.
|
|
700
|
+
*/
|
|
701
|
+
getActiveExtensionVersion = this.query(getActiveExtensionVersion)
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Creates a new version of an extension.
|
|
705
|
+
*/
|
|
706
|
+
createExtensionVersion = this.mutation(createExtensionVersion)
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* Deletes a specific version of an extension.
|
|
710
|
+
*/
|
|
711
|
+
deleteExtensionVersion = this.mutation(deleteExtensionVersion)
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Lists all extension links.
|
|
715
|
+
*/
|
|
716
|
+
extensionLinks = this.query(listExtensionLinks)
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Updates an extension link with a patch operation.
|
|
720
|
+
*/
|
|
721
|
+
patchExtensionLink = this.mutation(updateExtensionLink)
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Creates a new extension link.
|
|
725
|
+
*/
|
|
726
|
+
createExtensionLink = this.mutation(createExtensionLink)
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Deletes an extension link.
|
|
730
|
+
*/
|
|
731
|
+
deleteExtensionLink = this.mutation(deleteExtensionLink)
|
|
732
|
+
|
|
733
|
+
/*
|
|
734
|
+
* Delete profile image
|
|
735
|
+
*/
|
|
736
|
+
deleteProfileImage = this.mutation(deleteProfileImage)
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Get secrets
|
|
740
|
+
*/
|
|
741
|
+
getSecrets = this.query(findSecrets1)
|
|
742
|
+
/**
|
|
743
|
+
* Get secret by id
|
|
744
|
+
*/
|
|
745
|
+
getSecret = this.query(getById)
|
|
746
|
+
/**
|
|
747
|
+
* Get secrets by ids
|
|
748
|
+
*/
|
|
749
|
+
getSecretsByIds = this.query({
|
|
750
|
+
name: 'getSecretsByIds',
|
|
751
|
+
request: (signal, variables: { ids: string[], }) => {
|
|
752
|
+
const requests = variables?.ids?.map((secretId) => getById({ secretId }, { signal }))
|
|
753
|
+
return Promise.all(requests)
|
|
754
|
+
}
|
|
755
|
+
})
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Create secret
|
|
759
|
+
*/
|
|
760
|
+
createSecret = this.mutation(createSecret)
|
|
761
|
+
/**
|
|
762
|
+
* Delete secret
|
|
763
|
+
*/
|
|
764
|
+
deleteSecret = this.mutation(deleteSecret)
|
|
765
|
+
/**
|
|
766
|
+
* Update secret
|
|
767
|
+
*/
|
|
768
|
+
updateSecret = this.mutation(updateSecret)
|
|
769
|
+
/**
|
|
770
|
+
* Enable secret
|
|
771
|
+
*/
|
|
772
|
+
enableSecret = this.mutation(enableSecret)
|
|
773
|
+
/**
|
|
774
|
+
* Disable secret
|
|
775
|
+
*/
|
|
776
|
+
disableSecret = this.mutation(disableSecret)
|
|
777
|
+
|
|
778
|
+
// TRIAL
|
|
779
|
+
/**
|
|
780
|
+
* Create trial account
|
|
781
|
+
*/
|
|
782
|
+
createTrialAccount = this.mutation(createTrialAccount)
|
|
783
|
+
/**
|
|
784
|
+
* Deletes trial account
|
|
785
|
+
*/
|
|
786
|
+
deleteTrialAccount = this.mutation(removeTrialAccount)
|
|
787
|
+
/**
|
|
788
|
+
* Update trial account info
|
|
789
|
+
*/
|
|
790
|
+
updateTrialAccount = this.mutation(updatePersonalAccountDetails)
|
|
791
|
+
/**
|
|
792
|
+
* Creates a personal contact lead
|
|
793
|
+
*/
|
|
794
|
+
personalContact = this.mutation(personalContact)
|
|
795
|
+
/**
|
|
796
|
+
* Creates an enterprise contact lead
|
|
797
|
+
*/
|
|
798
|
+
enterpriseContact = this.mutation(enterpriseContact)
|
|
799
|
+
/**
|
|
800
|
+
* Get trial expiration info
|
|
801
|
+
*/
|
|
802
|
+
trialAccountDetails = this.query(getPersonalAccountDetails)
|
|
803
|
+
/**
|
|
804
|
+
* Get account rate limit
|
|
805
|
+
*/
|
|
806
|
+
getAccountRateLimit = this.query(getAccountRateLimit)
|
|
807
|
+
/**
|
|
808
|
+
* Update Account rate limit
|
|
809
|
+
*/
|
|
810
|
+
updateRateLimit = this.mutation(updateRateLimit)
|
|
811
|
+
/**
|
|
812
|
+
* Get all service credential rate limit
|
|
813
|
+
*/
|
|
814
|
+
getAllServiceCredentialRateLimit = this.query(getAllServiceCredentialRateLimit)
|
|
815
|
+
/**
|
|
816
|
+
* Update service credential rate limit
|
|
817
|
+
*/
|
|
818
|
+
updateServiceCredentialRateLimit = this.mutation(updateServiceCredentialRateLimit)
|
|
819
|
+
/**
|
|
820
|
+
* Get service credential rate limit by id
|
|
821
|
+
*/
|
|
822
|
+
getServiceCredentialByIdRateLimit = this.query(getServiceCredentialByIdRateLimit)
|
|
823
|
+
/**
|
|
824
|
+
* Create a new service credential V2
|
|
825
|
+
*/
|
|
826
|
+
createServiceCredentialV2 = this.mutation(createServiceCredential)
|
|
827
|
+
|
|
828
|
+
/**
|
|
829
|
+
* Rotate the secret of a service credential
|
|
830
|
+
*/
|
|
831
|
+
rotateServiceCredentialSecret = this.mutation(rotateServiceCredentialSecret)
|
|
832
|
+
|
|
833
|
+
/**
|
|
834
|
+
* Update the scopes of a service credential
|
|
835
|
+
*/
|
|
836
|
+
updateServiceCredentialScopes = this.mutation(updateServiceCredentialScopes)
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Revoke a service credential V2
|
|
840
|
+
*/
|
|
841
|
+
revokeServiceCredentialV2 = this.mutation(revokeServiceCredential)
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
|
+
* Validates a campaign code.
|
|
845
|
+
*/
|
|
846
|
+
validateCampaignCode = this.query(validateCampaignCode)
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Get feature flag by id
|
|
850
|
+
*/
|
|
851
|
+
featureFlagById = this.query(getFeatureFlag)
|
|
852
|
+
/**
|
|
853
|
+
* Update feature flag by id
|
|
854
|
+
*/
|
|
855
|
+
updateFeatureFlagById = this.mutation(updateFeatureFlag)
|
|
856
|
+
/**
|
|
857
|
+
* Get enabled feature flags for an account
|
|
858
|
+
*/
|
|
859
|
+
getEnabledFeatureFlagsForAccount = this.query(getEnabledFeatureFlagsForAccount)
|
|
860
|
+
|
|
861
|
+
/**
|
|
862
|
+
* Retries a external link by type.
|
|
863
|
+
*/
|
|
864
|
+
getExternalLinksByType = this.query(getExternalLinksByType)
|
|
865
|
+
|
|
866
|
+
/** Account admin flow - for backoffice use */
|
|
867
|
+
|
|
868
|
+
/**
|
|
869
|
+
* Create an enterprise account
|
|
870
|
+
*/
|
|
871
|
+
createEnterpriseAccount = this.mutation(create1)
|
|
872
|
+
/**
|
|
873
|
+
* Lists enterprise accounts
|
|
874
|
+
*/
|
|
875
|
+
getEnterpriseAccounts = this.query(getAccounts1)
|
|
876
|
+
/**
|
|
877
|
+
* Get an enterprise account
|
|
878
|
+
*/
|
|
879
|
+
getEnterpriseAccount = this.query(getAccount1)
|
|
880
|
+
/**
|
|
881
|
+
* Adds a new email domain to an existing account
|
|
882
|
+
*/
|
|
883
|
+
addEmailDomain = this.mutation(addNewEmailDomain)
|
|
884
|
+
/**
|
|
885
|
+
* Updates the sales representatives
|
|
886
|
+
*/
|
|
887
|
+
updateSalesRepresentatives = this.mutation(updateSalesRepresentatives)
|
|
888
|
+
/**
|
|
889
|
+
* Create FIDO magic link
|
|
890
|
+
*/
|
|
891
|
+
createFidoMagicLink = this.mutation(createFidoMagicLink)
|
|
892
|
+
/**
|
|
893
|
+
* Delete FIDO key
|
|
894
|
+
*/
|
|
895
|
+
deleteFidoKey = this.mutation(deleteFidoKey)
|
|
896
|
+
/**
|
|
897
|
+
* Find Secret Associations
|
|
898
|
+
*/
|
|
899
|
+
findSecretAssociations = this.infiniteQuery(findAssociations, { accumulator: 'items' })
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
export const accountClient = new AccountClient()
|