@stack-spot/portal-network 0.15.0 → 0.16.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.
@@ -1078,6 +1078,10 @@ export type UpdateGroupPermissionsRequest = {
1078
1078
  /** Slug from resource */
1079
1079
  resourceSlug: string;
1080
1080
  };
1081
+ export type AddNewEmailDomainRequest = {
1082
+ /** Email domains list that account users will use to login into StackSpot. Example: zup.com.br */
1083
+ domains: string[];
1084
+ };
1081
1085
  export type AccountSsoAttributesConfigResponse = {
1082
1086
  /** Id from SSO */
1083
1087
  id: string;
@@ -2553,6 +2557,26 @@ export function resetPassword({ memberEmailRequest }: {
2553
2557
  body: memberEmailRequest
2554
2558
  })));
2555
2559
  }
2560
+ /**
2561
+ * Reset member OTP
2562
+ */
2563
+ export function resetOtp(opts?: Oazapfts.RequestOpts) {
2564
+ return oazapfts.ok(oazapfts.fetchJson<{
2565
+ status: 204;
2566
+ } | {
2567
+ status: 403;
2568
+ data: ErrorResponse;
2569
+ } | {
2570
+ status: 422;
2571
+ data: ErrorResponse;
2572
+ } | {
2573
+ status: 500;
2574
+ data: ErrorResponse;
2575
+ }>("/v1/members/reset-otp", {
2576
+ ...opts,
2577
+ method: "POST"
2578
+ }));
2579
+ }
2556
2580
  /**
2557
2581
  * Invite new members to account
2558
2582
  */
@@ -2635,7 +2659,7 @@ export function createUserInvitation({ createUserInvitationRequest }: {
2635
2659
  /**
2636
2660
  * Get Groups
2637
2661
  */
2638
- export function getGroups({ size, page, sort, direction, search, filterMode, filterBy, filterValue, multiFilterMode, filterIn }: {
2662
+ export function getGroups({ size, page, sort, direction, search, filterMode, filterBy, filterValue, multiFilterMode, filterIn, includeDefaultGroup }: {
2639
2663
  size?: any;
2640
2664
  page?: any;
2641
2665
  sort?: string;
@@ -2646,6 +2670,7 @@ export function getGroups({ size, page, sort, direction, search, filterMode, fil
2646
2670
  filterValue?: string;
2647
2671
  multiFilterMode?: string;
2648
2672
  filterIn?: any;
2673
+ includeDefaultGroup?: boolean;
2649
2674
  }, opts?: Oazapfts.RequestOpts) {
2650
2675
  return oazapfts.ok(oazapfts.fetchJson<{
2651
2676
  status: 200;
@@ -2666,7 +2691,8 @@ export function getGroups({ size, page, sort, direction, search, filterMode, fil
2666
2691
  filterBy,
2667
2692
  filterValue,
2668
2693
  multiFilterMode,
2669
- filterIn
2694
+ filterIn,
2695
+ includeDefaultGroup
2670
2696
  }))}`, {
2671
2697
  ...opts
2672
2698
  }));
@@ -3321,9 +3347,13 @@ export function ssoConfigure({ protocol, accountSsoCreateRequest }: {
3321
3347
  /**
3322
3348
  * Parse SSO configuration file
3323
3349
  */
3324
- export function ssoParseConfigurationFile({ protocol, file }: {
3325
- protocol: string;
3326
- file: Blob;
3350
+ export function ssoParseConfigurationFile({ protocol, body }: {
3351
+ protocol: "SAML" | "OPENID";
3352
+ body?: {
3353
+ name?: string;
3354
+ alias?: string;
3355
+ file: Blob;
3356
+ };
3327
3357
  }, opts?: Oazapfts.RequestOpts) {
3328
3358
  return oazapfts.ok(oazapfts.fetchJson<{
3329
3359
  status: 200;
@@ -3334,12 +3364,11 @@ export function ssoParseConfigurationFile({ protocol, file }: {
3334
3364
  } | {
3335
3365
  status: 500;
3336
3366
  data: ErrorResponse;
3337
- }>(`/v1/accounts/sso/protocol/${encodeURIComponent(protocol)}/parser${QS.query(QS.explode({
3338
- file
3339
- }))}`, {
3367
+ }>(`/v1/accounts/sso/protocol/${encodeURIComponent(protocol)}/parser`, oazapfts.multipart({
3340
3368
  ...opts,
3341
- method: "POST"
3342
- }));
3369
+ method: "POST",
3370
+ body
3371
+ })));
3343
3372
  }
3344
3373
  /**
3345
3374
  * Create Account Freemium
@@ -3873,6 +3902,19 @@ export function disable({ id }: {
3873
3902
  method: "PATCH"
3874
3903
  }));
3875
3904
  }
3905
+ /**
3906
+ * Adds a new email domain to an existing account
3907
+ */
3908
+ export function addNewEmailDomain({ accountId, addNewEmailDomainRequest }: {
3909
+ accountId: string;
3910
+ addNewEmailDomainRequest: AddNewEmailDomainRequest;
3911
+ }, opts?: Oazapfts.RequestOpts) {
3912
+ return oazapfts.ok(oazapfts.fetchText(`/v1/admin/accounts/${encodeURIComponent(accountId)}/domains`, oazapfts.json({
3913
+ ...opts,
3914
+ method: "PATCH",
3915
+ body: addNewEmailDomainRequest
3916
+ })));
3917
+ }
3876
3918
  /**
3877
3919
  * Get configured account SSO attributes
3878
3920
  */
@@ -4475,6 +4517,28 @@ export function getAuthenticationConfig({ tenantSlug }: {
4475
4517
  ...opts
4476
4518
  }));
4477
4519
  }
4520
+ /**
4521
+ * Get an account by ID
4522
+ */
4523
+ export function getAccount1({ accountId }: {
4524
+ accountId: string;
4525
+ }, opts?: Oazapfts.RequestOpts) {
4526
+ return oazapfts.ok(oazapfts.fetchJson<{
4527
+ status: 200;
4528
+ data: AccountResponse;
4529
+ } | {
4530
+ status: 400;
4531
+ data: ErrorResponse;
4532
+ } | {
4533
+ status: 404;
4534
+ data: ErrorResponse;
4535
+ } | {
4536
+ status: 500;
4537
+ data: ErrorResponse;
4538
+ }>(`/v1/admin/accounts/${encodeURIComponent(accountId)}`, {
4539
+ ...opts
4540
+ }));
4541
+ }
4478
4542
  /**
4479
4543
  * Get account data (tenant, IDP alias, account freemium available to user) by email
4480
4544
  */
@@ -7,17 +7,21 @@ import {
7
7
  bindGroupMembers,
8
8
  bindRoleGroups,
9
9
  bindRoles,
10
- bindToGroups, bindToRoles, create, createAccountRole, createPartner,
10
+ bindToGroups, bindToRoles, create, createAccountRole, createGroupMapping, createPartner,
11
11
  createPersonalAccessToken,
12
12
  createServiceCredential1,
13
13
  createUser,
14
14
  deactivateFidoCredentials,
15
15
  defaults,
16
16
  deleteAccountRole,
17
+ deleteGroupMapping,
17
18
  deleteMember,
18
- deletePartner, deleteResourceFromGroup, deleteRole, deleteV1GroupsByGroupId, disablePersonalAccessTokenGeneration,
19
+ deletePartner, deleteResourceFromGroup, deleteRole, deleteSso, deleteV1GroupsByGroupId, disablePersonalAccessTokenGeneration,
19
20
  disassociateGroupToServiceCredential, enableFidoCredentials,
20
21
  getAccountMembers1,
22
+ getAccountSso,
23
+ getAllAccountSso,
24
+ getAllGroupMapping,
21
25
  getAllMemberFidoCredentials, getFeatures,
22
26
  getGroupById,
23
27
  getGroupResources,
@@ -41,13 +45,17 @@ import {
41
45
  getServiceCredentialPermissions,
42
46
  getServiceCredentials,
43
47
  isCreatedScmCredentials,
44
- isCreatedScmCredentials1, listScmCredentials, listScmCredentials1, personalAccessTokenAuthorization, removeRoleFromMember,
48
+ isCreatedScmCredentials1, listScmCredentials, listScmCredentials1, partialUpdateSso, personalAccessTokenAuthorization,
49
+ removeRoleFromMember,
45
50
  resetPassword, revokeServiceCredential1, save,
46
- scmCredentialSave, scmCredentialSave1, scmCredentialUpdate, scmCredentialUpdate1, scmDelete, sendDownloadEmail, update1,
51
+ scmCredentialSave, scmCredentialSave1, scmCredentialUpdate, scmCredentialUpdate1, scmDelete, sendDownloadEmail, ssoAddAttributes,
52
+ ssoConfigure, ssoGetAttributesConfig, ssoParseConfigurationFile, update1,
47
53
  updateAccountRole,
54
+ updateGroupMapping,
48
55
  updatePartnerAccountAdminData,
49
56
  updatePartnerAccountData,
50
57
  updateRoleWithNewActions,
58
+ updateSso,
51
59
  updateUser,
52
60
  validateNewPartnerData,
53
61
  validatePartnerAssociationLimit,
@@ -434,6 +442,58 @@ class AccountClient extends ReactQueryNetworkClient {
434
442
  * Revokes a service credential.
435
443
  */
436
444
  revokeServiceCredential = this.mutation(revokeServiceCredential1)
445
+ /**
446
+ * Creates a group mapping within an SSO.
447
+ */
448
+ createSSOGroupMapping = this.mutation(createGroupMapping)
449
+ /**
450
+ * Deletes a group mapping from an SSO.
451
+ */
452
+ deleteSSOGroupMapping = this.mutation(deleteGroupMapping)
453
+ /**
454
+ * Updates a group mapping within an SSO.
455
+ */
456
+ updateSSOGroupMapping = this.mutation(updateGroupMapping)
457
+ /**
458
+ * Get All SSO Group Mappings (paginated).
459
+ */
460
+ allSSOGroupMappings = this.infiniteQuery(getAllGroupMapping, { accumulator: 'items' })
461
+ /**
462
+ * Parses a file with a configuration for an SSO. The protocol can be either SAML or OPENID.
463
+ */
464
+ parseSSOConfig = this.mutation(ssoParseConfigurationFile)
465
+ /**
466
+ * Creates an SSO. The protocol can be either SAML or OPENID.
467
+ */
468
+ setupSSO = this.mutation(ssoConfigure)
469
+ /**
470
+ * Gets all SSOs.
471
+ */
472
+ allSSO = this.query(getAllAccountSso)
473
+ /**
474
+ * Updates an SSO. The payload will replace everything in the current configuration (won't be merged). Use `patchSSO` for merging.
475
+ */
476
+ updateSSO = this.mutation(updateSso)
477
+ /**
478
+ * Patches an SSO with a partial configuration change.
479
+ */
480
+ patchSSO = this.mutation(partialUpdateSso)
481
+ /**
482
+ * Gets an SSO by id.
483
+ */
484
+ sso = this.query(getAccountSso)
485
+ /**
486
+ * Deletes an SSO.
487
+ */
488
+ deleteSSO = this.mutation(deleteSso)
489
+ /**
490
+ * Gets the attributes of an SSO.
491
+ */
492
+ ssoAttributes = this.query(ssoGetAttributesConfig)
493
+ /**
494
+ * Updates the attributes in a SSO.
495
+ */
496
+ updateSSOAttributes = this.mutation(ssoAddAttributes)
437
497
  }
438
498
 
439
499
  export const accountClient = new AccountClient()
@@ -9,7 +9,7 @@ import apis from '../apis.json'
9
9
  import { DefaultAPIError } from '../error/DefaultAPIError'
10
10
  import { StackspotAPIError } from '../error/StackspotAPIError'
11
11
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
12
- import { CostAllocationResult, CostAllocationVariables, FixedManagedService, OazapftsFunction, ReplaceResult } from './types'
12
+ import { CostAllocationResult, CostAllocationVariables, FixedManagedService, FixVariables, OazapftsFunction, ReplaceResult } from './types'
13
13
 
14
14
  class CloudServicesClient extends ReactQueryNetworkClient {
15
15
  constructor() {
@@ -23,7 +23,7 @@ class CloudServicesClient extends ReactQueryNetworkClient {
23
23
  /**
24
24
  * Gets overview of costs over the current month, last month and last 3 months.
25
25
  */
26
- costOverview = this.query(getCostOverview)
26
+ costOverview = this.query(getCostOverview as unknown as FixVariables<typeof getCostOverview, { sortOrder?: 'asc' | 'desc' }>)
27
27
  /**
28
28
  * Gets a CSV file with the data of `costOverview`.
29
29
  */
@@ -104,10 +104,15 @@ export interface FixedManagedService extends Omit<ManagedService, 'resources'> {
104
104
 
105
105
  export type OazapftsFunction<Variables = any, Result = any> = (variables: Variables, opts?: RequestOpts) => Promise<Result>
106
106
 
107
+ type Unpromisify<T> = T extends Promise<infer R> ? Unpromisify<R> : T
108
+
107
109
  export type FixVariables<
108
110
  T extends OazapftsFunction,
109
111
  Fix extends Record<string, any>,
110
- > = OazapftsFunction<Omit<Parameters<T>[0], keyof Fix> & { [K in keyof Fix as Fix[K] extends never ? never : K]: Fix[K] }, ReturnType<T>>
112
+ > = OazapftsFunction<
113
+ Omit<Parameters<T>[0], keyof Fix> & { [K in keyof Fix as Fix[K] extends never ? never : K]: Fix[K] },
114
+ Unpromisify<ReturnType<T>>
115
+ >
111
116
 
112
117
  export type ReplaceResult<T extends (...args: any[]) => Promise<any>, Fix> = (...args: Parameters<T>) => Promise<Fix>
113
118