@keycloak/keycloak-admin-client 19.0.0-dev.3 → 19.0.0-dev.30

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.
Files changed (162) hide show
  1. package/README.md +10 -10
  2. package/lib/client.d.ts +24 -22
  3. package/lib/client.js +68 -181
  4. package/lib/client.js.map +1 -1
  5. package/lib/defs/AccessTokenAccess.js +1 -2
  6. package/lib/defs/PermissonRepresentation.js +1 -2
  7. package/lib/defs/accessTokenCertConf.js +1 -2
  8. package/lib/defs/accessTokenRepresentation.d.ts +4 -4
  9. package/lib/defs/accessTokenRepresentation.js +1 -2
  10. package/lib/defs/addressClaimSet.js +1 -2
  11. package/lib/defs/adminEventRepresentation.d.ts +1 -1
  12. package/lib/defs/adminEventRepresentation.js +1 -2
  13. package/lib/defs/authDetailsRepresentation.js +1 -2
  14. package/lib/defs/authenticationExecutionExportRepresentation.js +1 -2
  15. package/lib/defs/authenticationExecutionInfoRepresentation.js +1 -2
  16. package/lib/defs/authenticationFlowRepresentation.d.ts +1 -1
  17. package/lib/defs/authenticationFlowRepresentation.js +1 -2
  18. package/lib/defs/authenticatorConfigInfoRepresentation.js +1 -2
  19. package/lib/defs/authenticatorConfigRepresentation.js +1 -2
  20. package/lib/defs/certificateRepresentation.js +1 -2
  21. package/lib/defs/clientInitialAccessPresentation.js +1 -2
  22. package/lib/defs/clientPoliciesRepresentation.d.ts +1 -1
  23. package/lib/defs/clientPoliciesRepresentation.js +1 -2
  24. package/lib/defs/clientPolicyConditionRepresentation.js +1 -2
  25. package/lib/defs/clientPolicyExecutorRepresentation.js +1 -2
  26. package/lib/defs/clientPolicyRepresentation.d.ts +1 -1
  27. package/lib/defs/clientPolicyRepresentation.js +1 -2
  28. package/lib/defs/clientProfileRepresentation.d.ts +1 -1
  29. package/lib/defs/clientProfileRepresentation.js +1 -2
  30. package/lib/defs/clientProfilesRepresentation.d.ts +1 -1
  31. package/lib/defs/clientProfilesRepresentation.js +1 -2
  32. package/lib/defs/clientRepresentation.d.ts +2 -2
  33. package/lib/defs/clientRepresentation.js +1 -2
  34. package/lib/defs/clientScopeRepresentation.d.ts +1 -1
  35. package/lib/defs/clientScopeRepresentation.js +1 -2
  36. package/lib/defs/componentExportRepresentation.js +1 -2
  37. package/lib/defs/componentRepresentation.js +1 -2
  38. package/lib/defs/componentTypeRepresentation.d.ts +1 -1
  39. package/lib/defs/componentTypeRepresentation.js +1 -2
  40. package/lib/defs/configPropertyRepresentation.js +1 -2
  41. package/lib/defs/credentialRepresentation.js +1 -2
  42. package/lib/defs/evaluationResultRepresentation.d.ts +4 -4
  43. package/lib/defs/evaluationResultRepresentation.js +1 -2
  44. package/lib/defs/eventRepresentation.d.ts +1 -1
  45. package/lib/defs/eventRepresentation.js +1 -2
  46. package/lib/defs/eventTypes.js +1 -2
  47. package/lib/defs/federatedIdentityRepresentation.js +1 -2
  48. package/lib/defs/globalRequestResult.js +1 -2
  49. package/lib/defs/groupRepresentation.js +1 -2
  50. package/lib/defs/identityProviderMapperRepresentation.js +1 -2
  51. package/lib/defs/identityProviderMapperTypeRepresentation.d.ts +1 -1
  52. package/lib/defs/identityProviderMapperTypeRepresentation.js +1 -2
  53. package/lib/defs/identityProviderRepresentation.js +1 -2
  54. package/lib/defs/keyMetadataRepresentation.js +1 -2
  55. package/lib/defs/keystoreConfig.js +1 -2
  56. package/lib/defs/managementPermissionReference.js +1 -2
  57. package/lib/defs/mappingsRepresentation.d.ts +1 -1
  58. package/lib/defs/mappingsRepresentation.js +1 -2
  59. package/lib/defs/passwordPolicyTypeRepresentation.js +1 -2
  60. package/lib/defs/policyEvaluationResponse.d.ts +3 -3
  61. package/lib/defs/policyEvaluationResponse.js +1 -2
  62. package/lib/defs/policyProviderRepresentation.js +1 -2
  63. package/lib/defs/policyRepresentation.js +6 -9
  64. package/lib/defs/policyRepresentation.js.map +1 -1
  65. package/lib/defs/policyResultRepresentation.d.ts +2 -1
  66. package/lib/defs/policyResultRepresentation.js +1 -2
  67. package/lib/defs/profileInfoRepresentation.js +1 -2
  68. package/lib/defs/protocolMapperRepresentation.js +1 -2
  69. package/lib/defs/realmEventsConfigRepresentation.js +1 -2
  70. package/lib/defs/realmRepresentation.d.ts +10 -10
  71. package/lib/defs/realmRepresentation.js +1 -2
  72. package/lib/defs/requiredActionProviderRepresentation.js +2 -5
  73. package/lib/defs/requiredActionProviderRepresentation.js.map +1 -1
  74. package/lib/defs/requiredActionProviderSimpleRepresentation.js +1 -2
  75. package/lib/defs/resourceEvaluation.d.ts +1 -1
  76. package/lib/defs/resourceEvaluation.js +1 -2
  77. package/lib/defs/resourceRepresentation.d.ts +2 -2
  78. package/lib/defs/resourceRepresentation.js +1 -2
  79. package/lib/defs/resourceServerRepresentation.d.ts +3 -3
  80. package/lib/defs/resourceServerRepresentation.js +1 -2
  81. package/lib/defs/roleRepresentation.js +1 -2
  82. package/lib/defs/rolesRepresentation.d.ts +1 -1
  83. package/lib/defs/rolesRepresentation.js +1 -2
  84. package/lib/defs/scopeRepresentation.d.ts +2 -2
  85. package/lib/defs/scopeRepresentation.js +1 -2
  86. package/lib/defs/serverInfoRepesentation.d.ts +6 -6
  87. package/lib/defs/serverInfoRepesentation.js +1 -2
  88. package/lib/defs/synchronizationResultRepresentation.js +1 -2
  89. package/lib/defs/systemInfoRepersantation.js +1 -2
  90. package/lib/defs/testLdapConnection.js +1 -2
  91. package/lib/defs/userConsentRepresentation.js +1 -2
  92. package/lib/defs/userProfileConfig.js +1 -2
  93. package/lib/defs/userRepresentation.d.ts +5 -5
  94. package/lib/defs/userRepresentation.js +1 -2
  95. package/lib/defs/userSessionRepresentation.js +1 -2
  96. package/lib/defs/whoAmIRepresentation.js +1 -2
  97. package/lib/index.d.ts +2 -2
  98. package/lib/index.js +4 -7
  99. package/lib/index.js.map +1 -1
  100. package/lib/resources/agent.d.ts +2 -2
  101. package/lib/resources/agent.js +115 -193
  102. package/lib/resources/agent.js.map +1 -1
  103. package/lib/resources/attackDetection.d.ts +5 -5
  104. package/lib/resources/attackDetection.js +16 -41
  105. package/lib/resources/attackDetection.js.map +1 -1
  106. package/lib/resources/authenticationManagement.d.ts +36 -35
  107. package/lib/resources/authenticationManagement.js +72 -97
  108. package/lib/resources/authenticationManagement.js.map +1 -1
  109. package/lib/resources/cache.d.ts +3 -3
  110. package/lib/resources/cache.js +12 -37
  111. package/lib/resources/cache.js.map +1 -1
  112. package/lib/resources/clientPolicies.d.ts +9 -9
  113. package/lib/resources/clientPolicies.js +19 -44
  114. package/lib/resources/clientPolicies.js.map +1 -1
  115. package/lib/resources/clientScopes.d.ts +29 -27
  116. package/lib/resources/clientScopes.js +92 -185
  117. package/lib/resources/clientScopes.js.map +1 -1
  118. package/lib/resources/clients.d.ts +98 -92
  119. package/lib/resources/clients.js +228 -309
  120. package/lib/resources/clients.js.map +1 -1
  121. package/lib/resources/components.d.ts +9 -9
  122. package/lib/resources/components.js +22 -47
  123. package/lib/resources/components.js.map +1 -1
  124. package/lib/resources/groups.d.ts +26 -25
  125. package/lib/resources/groups.js +53 -78
  126. package/lib/resources/groups.js.map +1 -1
  127. package/lib/resources/identityProviders.d.ts +19 -19
  128. package/lib/resources/identityProviders.js +40 -65
  129. package/lib/resources/identityProviders.js.map +1 -1
  130. package/lib/resources/realms.d.ts +40 -39
  131. package/lib/resources/realms.js +73 -98
  132. package/lib/resources/realms.js.map +1 -1
  133. package/lib/resources/resource.d.ts +3 -3
  134. package/lib/resources/resource.js +12 -26
  135. package/lib/resources/resource.js.map +1 -1
  136. package/lib/resources/roles.d.ts +16 -16
  137. package/lib/resources/roles.js +42 -67
  138. package/lib/resources/roles.js.map +1 -1
  139. package/lib/resources/serverInfo.d.ts +4 -4
  140. package/lib/resources/serverInfo.js +9 -34
  141. package/lib/resources/serverInfo.js.map +1 -1
  142. package/lib/resources/sessions.d.ts +3 -3
  143. package/lib/resources/sessions.js +12 -37
  144. package/lib/resources/sessions.js.map +1 -1
  145. package/lib/resources/userStorageProvider.d.ts +8 -8
  146. package/lib/resources/userStorageProvider.js +20 -45
  147. package/lib/resources/userStorageProvider.js.map +1 -1
  148. package/lib/resources/users.d.ts +51 -51
  149. package/lib/resources/users.js +95 -120
  150. package/lib/resources/users.js.map +1 -1
  151. package/lib/resources/whoAmI.d.ts +4 -4
  152. package/lib/resources/whoAmI.js +12 -37
  153. package/lib/resources/whoAmI.js.map +1 -1
  154. package/lib/utils/auth.js +30 -82
  155. package/lib/utils/auth.js.map +1 -1
  156. package/lib/utils/constants.d.ts +1 -1
  157. package/lib/utils/constants.js +2 -5
  158. package/lib/utils/constants.js.map +1 -1
  159. package/package.json +24 -17
  160. package/lib/defs/accessTokenAuthorization.d.ts +0 -4
  161. package/lib/defs/accessTokenAuthorization.js +0 -3
  162. package/lib/defs/accessTokenAuthorization.js.map +0 -1
@@ -1,607 +1,526 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
- step((generator = generator.apply(thisArg, _arguments || [])).next());
35
- });
36
- };
37
- var __generator = (this && this.__generator) || function (thisArg, body) {
38
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
- function verb(n) { return function (v) { return step([n, v]); }; }
41
- function step(op) {
42
- if (f) throw new TypeError("Generator is already executing.");
43
- while (_) try {
44
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
- if (y = 0, t) op = [op[0] & 2, t.value];
46
- switch (op[0]) {
47
- case 0: case 1: t = op; break;
48
- case 4: _.label++; return { value: op[1], done: false };
49
- case 5: _.label++; y = op[1]; op = [0]; continue;
50
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
- default:
52
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
- if (t[2]) _.ops.pop();
57
- _.trys.pop(); continue;
58
- }
59
- op = body.call(thisArg, _);
60
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
- }
63
- };
64
- var __importDefault = (this && this.__importDefault) || function (mod) {
65
- return (mod && mod.__esModule) ? mod : { "default": mod };
66
- };
67
- exports.__esModule = true;
68
- exports.Clients = void 0;
69
- var resource_1 = __importDefault(require("./resource"));
70
- var Clients = (function (_super) {
71
- __extends(Clients, _super);
72
- function Clients(client) {
73
- var _this = _super.call(this, client, {
1
+ import Resource from './resource.js';
2
+ export class Clients extends Resource {
3
+ constructor(client) {
4
+ super(client, {
74
5
  path: '/admin/realms/{realm}/clients',
75
- getUrlParams: function () { return ({
76
- realm: client.realmName
77
- }); },
78
- getBaseUrl: function () { return client.baseUrl; }
79
- }) || this;
80
- _this.find = _this.makeRequest({
81
- method: 'GET'
82
- });
83
- _this.create = _this.makeRequest({
6
+ getUrlParams: () => ({
7
+ realm: client.realmName,
8
+ }),
9
+ getBaseUrl: () => client.baseUrl,
10
+ });
11
+ this.find = this.makeRequest({
12
+ method: 'GET',
13
+ });
14
+ this.create = this.makeRequest({
84
15
  method: 'POST',
85
- returnResourceIdInLocationHeader: { field: 'id' }
16
+ returnResourceIdInLocationHeader: { field: 'id' },
86
17
  });
87
- _this.findOne = _this.makeRequest({
18
+ this.findOne = this.makeRequest({
88
19
  method: 'GET',
89
20
  path: '/{id}',
90
21
  urlParamKeys: ['id'],
91
- catchNotFound: true
22
+ catchNotFound: true,
92
23
  });
93
- _this.update = _this.makeUpdateRequest({
24
+ this.update = this.makeUpdateRequest({
94
25
  method: 'PUT',
95
26
  path: '/{id}',
96
- urlParamKeys: ['id']
27
+ urlParamKeys: ['id'],
97
28
  });
98
- _this.del = _this.makeRequest({
29
+ this.del = this.makeRequest({
99
30
  method: 'DELETE',
100
31
  path: '/{id}',
101
- urlParamKeys: ['id']
32
+ urlParamKeys: ['id'],
102
33
  });
103
- _this.createRole = _this.makeRequest({
34
+ this.createRole = this.makeRequest({
104
35
  method: 'POST',
105
36
  path: '/{id}/roles',
106
37
  urlParamKeys: ['id'],
107
- returnResourceIdInLocationHeader: { field: 'roleName' }
38
+ returnResourceIdInLocationHeader: { field: 'roleName' },
108
39
  });
109
- _this.listRoles = _this.makeRequest({
40
+ this.listRoles = this.makeRequest({
110
41
  method: 'GET',
111
42
  path: '/{id}/roles',
112
- urlParamKeys: ['id']
43
+ urlParamKeys: ['id'],
113
44
  });
114
- _this.findRole = _this.makeRequest({
45
+ this.findRole = this.makeRequest({
115
46
  method: 'GET',
116
47
  path: '/{id}/roles/{roleName}',
117
48
  urlParamKeys: ['id', 'roleName'],
118
- catchNotFound: true
49
+ catchNotFound: true,
119
50
  });
120
- _this.updateRole = _this.makeUpdateRequest({
51
+ this.updateRole = this.makeUpdateRequest({
121
52
  method: 'PUT',
122
53
  path: '/{id}/roles/{roleName}',
123
- urlParamKeys: ['id', 'roleName']
54
+ urlParamKeys: ['id', 'roleName'],
124
55
  });
125
- _this.delRole = _this.makeRequest({
56
+ this.delRole = this.makeRequest({
126
57
  method: 'DELETE',
127
58
  path: '/{id}/roles/{roleName}',
128
- urlParamKeys: ['id', 'roleName']
59
+ urlParamKeys: ['id', 'roleName'],
129
60
  });
130
- _this.findUsersWithRole = _this.makeRequest({
61
+ this.findUsersWithRole = this.makeRequest({
131
62
  method: 'GET',
132
63
  path: '/{id}/roles/{roleName}/users',
133
- urlParamKeys: ['id', 'roleName']
64
+ urlParamKeys: ['id', 'roleName'],
134
65
  });
135
- _this.getServiceAccountUser = _this.makeRequest({
66
+ this.getServiceAccountUser = this.makeRequest({
136
67
  method: 'GET',
137
68
  path: '/{id}/service-account-user',
138
- urlParamKeys: ['id']
69
+ urlParamKeys: ['id'],
139
70
  });
140
- _this.generateNewClientSecret = _this.makeRequest({
71
+ this.generateNewClientSecret = this.makeRequest({
141
72
  method: 'POST',
142
73
  path: '/{id}/client-secret',
143
- urlParamKeys: ['id']
74
+ urlParamKeys: ['id'],
144
75
  });
145
- _this.generateRegistrationAccessToken = _this.makeRequest({
76
+ this.invalidateSecret = this.makeRequest({
77
+ method: 'DELETE',
78
+ path: '/{id}/client-secret/rotated',
79
+ urlParamKeys: ['id'],
80
+ });
81
+ this.generateRegistrationAccessToken = this.makeRequest({
146
82
  method: 'POST',
147
83
  path: '/{id}/registration-access-token',
148
- urlParamKeys: ['id']
84
+ urlParamKeys: ['id'],
149
85
  });
150
- _this.getClientSecret = _this.makeRequest({
86
+ this.getClientSecret = this.makeRequest({
151
87
  method: 'GET',
152
88
  path: '/{id}/client-secret',
153
- urlParamKeys: ['id']
89
+ urlParamKeys: ['id'],
154
90
  });
155
- _this.listDefaultClientScopes = _this.makeRequest({
91
+ this.listDefaultClientScopes = this.makeRequest({
156
92
  method: 'GET',
157
93
  path: '/{id}/default-client-scopes',
158
- urlParamKeys: ['id']
94
+ urlParamKeys: ['id'],
159
95
  });
160
- _this.addDefaultClientScope = _this.makeRequest({
96
+ this.addDefaultClientScope = this.makeRequest({
161
97
  method: 'PUT',
162
98
  path: '/{id}/default-client-scopes/{clientScopeId}',
163
- urlParamKeys: ['id', 'clientScopeId']
99
+ urlParamKeys: ['id', 'clientScopeId'],
164
100
  });
165
- _this.delDefaultClientScope = _this.makeRequest({
101
+ this.delDefaultClientScope = this.makeRequest({
166
102
  method: 'DELETE',
167
103
  path: '/{id}/default-client-scopes/{clientScopeId}',
168
- urlParamKeys: ['id', 'clientScopeId']
104
+ urlParamKeys: ['id', 'clientScopeId'],
169
105
  });
170
- _this.listOptionalClientScopes = _this.makeRequest({
106
+ this.listOptionalClientScopes = this.makeRequest({
171
107
  method: 'GET',
172
108
  path: '/{id}/optional-client-scopes',
173
- urlParamKeys: ['id']
109
+ urlParamKeys: ['id'],
174
110
  });
175
- _this.addOptionalClientScope = _this.makeRequest({
111
+ this.addOptionalClientScope = this.makeRequest({
176
112
  method: 'PUT',
177
113
  path: '/{id}/optional-client-scopes/{clientScopeId}',
178
- urlParamKeys: ['id', 'clientScopeId']
114
+ urlParamKeys: ['id', 'clientScopeId'],
179
115
  });
180
- _this.delOptionalClientScope = _this.makeRequest({
116
+ this.delOptionalClientScope = this.makeRequest({
181
117
  method: 'DELETE',
182
118
  path: '/{id}/optional-client-scopes/{clientScopeId}',
183
- urlParamKeys: ['id', 'clientScopeId']
119
+ urlParamKeys: ['id', 'clientScopeId'],
184
120
  });
185
- _this.addMultipleProtocolMappers = _this.makeUpdateRequest({
121
+ this.addMultipleProtocolMappers = this.makeUpdateRequest({
186
122
  method: 'POST',
187
123
  path: '/{id}/protocol-mappers/add-models',
188
- urlParamKeys: ['id']
124
+ urlParamKeys: ['id'],
189
125
  });
190
- _this.addProtocolMapper = _this.makeUpdateRequest({
126
+ this.addProtocolMapper = this.makeUpdateRequest({
191
127
  method: 'POST',
192
128
  path: '/{id}/protocol-mappers/models',
193
- urlParamKeys: ['id']
129
+ urlParamKeys: ['id'],
194
130
  });
195
- _this.listProtocolMappers = _this.makeRequest({
131
+ this.listProtocolMappers = this.makeRequest({
196
132
  method: 'GET',
197
133
  path: '/{id}/protocol-mappers/models',
198
- urlParamKeys: ['id']
134
+ urlParamKeys: ['id'],
199
135
  });
200
- _this.findProtocolMapperById = _this.makeRequest({
136
+ this.findProtocolMapperById = this.makeRequest({
201
137
  method: 'GET',
202
138
  path: '/{id}/protocol-mappers/models/{mapperId}',
203
139
  urlParamKeys: ['id', 'mapperId'],
204
- catchNotFound: true
140
+ catchNotFound: true,
205
141
  });
206
- _this.findProtocolMappersByProtocol = _this.makeRequest({
142
+ this.findProtocolMappersByProtocol = this.makeRequest({
207
143
  method: 'GET',
208
144
  path: '/{id}/protocol-mappers/protocol/{protocol}',
209
145
  urlParamKeys: ['id', 'protocol'],
210
- catchNotFound: true
146
+ catchNotFound: true,
211
147
  });
212
- _this.updateProtocolMapper = _this.makeUpdateRequest({
148
+ this.updateProtocolMapper = this.makeUpdateRequest({
213
149
  method: 'PUT',
214
150
  path: '/{id}/protocol-mappers/models/{mapperId}',
215
- urlParamKeys: ['id', 'mapperId']
151
+ urlParamKeys: ['id', 'mapperId'],
216
152
  });
217
- _this.delProtocolMapper = _this.makeRequest({
153
+ this.delProtocolMapper = this.makeRequest({
218
154
  method: 'DELETE',
219
155
  path: '/{id}/protocol-mappers/models/{mapperId}',
220
- urlParamKeys: ['id', 'mapperId']
156
+ urlParamKeys: ['id', 'mapperId'],
221
157
  });
222
- _this.listScopeMappings = _this.makeRequest({
158
+ this.listScopeMappings = this.makeRequest({
223
159
  method: 'GET',
224
160
  path: '/{id}/scope-mappings',
225
- urlParamKeys: ['id']
161
+ urlParamKeys: ['id'],
226
162
  });
227
- _this.addClientScopeMappings = _this.makeUpdateRequest({
163
+ this.addClientScopeMappings = this.makeUpdateRequest({
228
164
  method: 'POST',
229
165
  path: '/{id}/scope-mappings/clients/{client}',
230
- urlParamKeys: ['id', 'client']
166
+ urlParamKeys: ['id', 'client'],
231
167
  });
232
- _this.listClientScopeMappings = _this.makeRequest({
168
+ this.listClientScopeMappings = this.makeRequest({
233
169
  method: 'GET',
234
170
  path: '/{id}/scope-mappings/clients/{client}',
235
- urlParamKeys: ['id', 'client']
171
+ urlParamKeys: ['id', 'client'],
236
172
  });
237
- _this.listAvailableClientScopeMappings = _this.makeRequest({
173
+ this.listAvailableClientScopeMappings = this.makeRequest({
238
174
  method: 'GET',
239
175
  path: '/{id}/scope-mappings/clients/{client}/available',
240
- urlParamKeys: ['id', 'client']
176
+ urlParamKeys: ['id', 'client'],
241
177
  });
242
- _this.listCompositeClientScopeMappings = _this.makeRequest({
178
+ this.listCompositeClientScopeMappings = this.makeRequest({
243
179
  method: 'GET',
244
180
  path: '/{id}/scope-mappings/clients/{client}/composite',
245
- urlParamKeys: ['id', 'client']
181
+ urlParamKeys: ['id', 'client'],
246
182
  });
247
- _this.delClientScopeMappings = _this.makeUpdateRequest({
183
+ this.delClientScopeMappings = this.makeUpdateRequest({
248
184
  method: 'DELETE',
249
185
  path: '/{id}/scope-mappings/clients/{client}',
250
- urlParamKeys: ['id', 'client']
186
+ urlParamKeys: ['id', 'client'],
251
187
  });
252
- _this.evaluatePermission = _this.makeRequest({
188
+ this.evaluatePermission = this.makeRequest({
253
189
  method: 'GET',
254
190
  path: '/{id}/evaluate-scopes/scope-mappings/{roleContainer}/{type}',
255
191
  urlParamKeys: ['id', 'roleContainer', 'type'],
256
- queryParamKeys: ['scope']
192
+ queryParamKeys: ['scope'],
257
193
  });
258
- _this.evaluateListProtocolMapper = _this.makeRequest({
194
+ this.evaluateListProtocolMapper = this.makeRequest({
259
195
  method: 'GET',
260
196
  path: '/{id}/evaluate-scopes/protocol-mappers',
261
197
  urlParamKeys: ['id'],
262
- queryParamKeys: ['scope']
198
+ queryParamKeys: ['scope'],
263
199
  });
264
- _this.evaluateGenerateAccessToken = _this.makeRequest({
200
+ this.evaluateGenerateAccessToken = this.makeRequest({
265
201
  method: 'GET',
266
202
  path: '/{id}/evaluate-scopes/generate-example-access-token',
267
203
  urlParamKeys: ['id'],
268
- queryParamKeys: ['scope', 'userId']
204
+ queryParamKeys: ['scope', 'userId'],
269
205
  });
270
- _this.evaluateGenerateUserInfo = _this.makeRequest({
206
+ this.evaluateGenerateUserInfo = this.makeRequest({
271
207
  method: 'GET',
272
208
  path: '/{id}/evaluate-scopes/generate-example-userinfo',
273
209
  urlParamKeys: ['id'],
274
- queryParamKeys: ['scope', 'userId']
210
+ queryParamKeys: ['scope', 'userId'],
275
211
  });
276
- _this.evaluateGenerateIdToken = _this.makeRequest({
212
+ this.evaluateGenerateIdToken = this.makeRequest({
277
213
  method: 'GET',
278
214
  path: '/{id}/evaluate-scopes/generate-example-id-token',
279
215
  urlParamKeys: ['id'],
280
- queryParamKeys: ['scope', 'userId']
216
+ queryParamKeys: ['scope', 'userId'],
281
217
  });
282
- _this.addRealmScopeMappings = _this.makeUpdateRequest({
218
+ this.addRealmScopeMappings = this.makeUpdateRequest({
283
219
  method: 'POST',
284
220
  path: '/{id}/scope-mappings/realm',
285
- urlParamKeys: ['id', 'client']
221
+ urlParamKeys: ['id', 'client'],
286
222
  });
287
- _this.listRealmScopeMappings = _this.makeRequest({
223
+ this.listRealmScopeMappings = this.makeRequest({
288
224
  method: 'GET',
289
225
  path: '/{id}/scope-mappings/realm',
290
- urlParamKeys: ['id']
226
+ urlParamKeys: ['id'],
291
227
  });
292
- _this.listAvailableRealmScopeMappings = _this.makeRequest({
228
+ this.listAvailableRealmScopeMappings = this.makeRequest({
293
229
  method: 'GET',
294
230
  path: '/{id}/scope-mappings/realm/available',
295
- urlParamKeys: ['id']
231
+ urlParamKeys: ['id'],
296
232
  });
297
- _this.listCompositeRealmScopeMappings = _this.makeRequest({
233
+ this.listCompositeRealmScopeMappings = this.makeRequest({
298
234
  method: 'GET',
299
235
  path: '/{id}/scope-mappings/realm/composite',
300
- urlParamKeys: ['id']
236
+ urlParamKeys: ['id'],
301
237
  });
302
- _this.delRealmScopeMappings = _this.makeUpdateRequest({
238
+ this.delRealmScopeMappings = this.makeUpdateRequest({
303
239
  method: 'DELETE',
304
240
  path: '/{id}/scope-mappings/realm',
305
- urlParamKeys: ['id']
241
+ urlParamKeys: ['id'],
306
242
  });
307
- _this.listSessions = _this.makeRequest({
243
+ this.listSessions = this.makeRequest({
308
244
  method: 'GET',
309
245
  path: '/{id}/user-sessions',
310
- urlParamKeys: ['id']
246
+ urlParamKeys: ['id'],
311
247
  });
312
- _this.listOfflineSessions = _this.makeRequest({
248
+ this.listOfflineSessions = this.makeRequest({
313
249
  method: 'GET',
314
250
  path: '/{id}/offline-sessions',
315
- urlParamKeys: ['id']
251
+ urlParamKeys: ['id'],
316
252
  });
317
- _this.getSessionCount = _this.makeRequest({
253
+ this.getSessionCount = this.makeRequest({
318
254
  method: 'GET',
319
255
  path: '/{id}/session-count',
320
- urlParamKeys: ['id']
256
+ urlParamKeys: ['id'],
321
257
  });
322
- _this.getResourceServer = _this.makeRequest({
258
+ this.getResourceServer = this.makeRequest({
323
259
  method: 'GET',
324
260
  path: '{id}/authz/resource-server',
325
- urlParamKeys: ['id']
261
+ urlParamKeys: ['id'],
326
262
  });
327
- _this.updateResourceServer = _this.makeUpdateRequest({
263
+ this.updateResourceServer = this.makeUpdateRequest({
328
264
  method: 'PUT',
329
265
  path: '{id}/authz/resource-server',
330
- urlParamKeys: ['id']
266
+ urlParamKeys: ['id'],
331
267
  });
332
- _this.listResources = _this.makeRequest({
268
+ this.listResources = this.makeRequest({
333
269
  method: 'GET',
334
270
  path: '{id}/authz/resource-server/resource',
335
- urlParamKeys: ['id']
271
+ urlParamKeys: ['id'],
336
272
  });
337
- _this.createResource = _this.makeUpdateRequest({
273
+ this.createResource = this.makeUpdateRequest({
338
274
  method: 'POST',
339
275
  path: '{id}/authz/resource-server/resource',
340
- urlParamKeys: ['id']
276
+ urlParamKeys: ['id'],
341
277
  });
342
- _this.getResource = _this.makeRequest({
278
+ this.getResource = this.makeRequest({
343
279
  method: 'GET',
344
280
  path: '{id}/authz/resource-server/resource/{resourceId}',
345
- urlParamKeys: ['id', 'resourceId']
281
+ urlParamKeys: ['id', 'resourceId'],
346
282
  });
347
- _this.updateResource = _this.makeUpdateRequest({
283
+ this.updateResource = this.makeUpdateRequest({
348
284
  method: 'PUT',
349
285
  path: '/{id}/authz/resource-server/resource/{resourceId}',
350
- urlParamKeys: ['id', 'resourceId']
286
+ urlParamKeys: ['id', 'resourceId'],
351
287
  });
352
- _this.delResource = _this.makeRequest({
288
+ this.delResource = this.makeRequest({
353
289
  method: 'DELETE',
354
290
  path: '/{id}/authz/resource-server/resource/{resourceId}',
355
- urlParamKeys: ['id', 'resourceId']
291
+ urlParamKeys: ['id', 'resourceId'],
356
292
  });
357
- _this.importResource = _this.makeUpdateRequest({
293
+ this.importResource = this.makeUpdateRequest({
358
294
  method: 'POST',
359
295
  path: '/{id}/authz/resource-server/import',
360
- urlParamKeys: ['id']
296
+ urlParamKeys: ['id'],
361
297
  });
362
- _this.exportResource = _this.makeRequest({
298
+ this.exportResource = this.makeRequest({
363
299
  method: 'GET',
364
300
  path: '/{id}/authz/resource-server/settings',
365
- urlParamKeys: ['id']
301
+ urlParamKeys: ['id'],
366
302
  });
367
- _this.evaluateResource = _this.makeUpdateRequest({
303
+ this.evaluateResource = this.makeUpdateRequest({
368
304
  method: 'POST',
369
305
  path: '{id}/authz/resource-server/policy/evaluate',
370
- urlParamKeys: ['id']
306
+ urlParamKeys: ['id'],
371
307
  });
372
- _this.listPolicies = _this.makeRequest({
308
+ this.listPolicies = this.makeRequest({
373
309
  method: 'GET',
374
310
  path: '{id}/authz/resource-server/policy',
375
- urlParamKeys: ['id']
311
+ urlParamKeys: ['id'],
376
312
  });
377
- _this.findPolicyByName = _this.makeRequest({
313
+ this.findPolicyByName = this.makeRequest({
378
314
  method: 'GET',
379
315
  path: '{id}/authz/resource-server/policy/search',
380
- urlParamKeys: ['id']
316
+ urlParamKeys: ['id'],
381
317
  });
382
- _this.updatePolicy = _this.makeUpdateRequest({
318
+ this.updatePolicy = this.makeUpdateRequest({
383
319
  method: 'PUT',
384
320
  path: '/{id}/authz/resource-server/policy/{type}/{policyId}',
385
- urlParamKeys: ['id', 'type', 'policyId']
321
+ urlParamKeys: ['id', 'type', 'policyId'],
386
322
  });
387
- _this.createPolicy = _this.makeUpdateRequest({
323
+ this.createPolicy = this.makeUpdateRequest({
388
324
  method: 'POST',
389
325
  path: '/{id}/authz/resource-server/policy/{type}',
390
- urlParamKeys: ['id', 'type']
326
+ urlParamKeys: ['id', 'type'],
391
327
  });
392
- _this.findOnePolicy = _this.makeRequest({
328
+ this.findOnePolicy = this.makeRequest({
393
329
  method: 'GET',
394
330
  path: '/{id}/authz/resource-server/policy/{type}/{policyId}',
395
331
  urlParamKeys: ['id', 'type', 'policyId'],
396
- catchNotFound: true
332
+ catchNotFound: true,
397
333
  });
398
- _this.listDependentPolicies = _this.makeRequest({
334
+ this.listDependentPolicies = this.makeRequest({
399
335
  method: 'GET',
400
336
  path: '/{id}/authz/resource-server/policy/{policyId}/dependentPolicies',
401
- urlParamKeys: ['id', 'policyId']
337
+ urlParamKeys: ['id', 'policyId'],
402
338
  });
403
- _this.delPolicy = _this.makeRequest({
339
+ this.delPolicy = this.makeRequest({
404
340
  method: 'DELETE',
405
341
  path: '{id}/authz/resource-server/policy/{policyId}',
406
- urlParamKeys: ['id', 'policyId']
342
+ urlParamKeys: ['id', 'policyId'],
407
343
  });
408
- _this.listPolicyProviders = _this.makeRequest({
344
+ this.listPolicyProviders = this.makeRequest({
409
345
  method: 'GET',
410
346
  path: '/{id}/authz/resource-server/policy/providers',
411
- urlParamKeys: ['id']
347
+ urlParamKeys: ['id'],
412
348
  });
413
- _this.listAllScopes = _this.makeRequest({
349
+ this.listAllScopes = this.makeRequest({
414
350
  method: 'GET',
415
351
  path: '/{id}/authz/resource-server/scope',
416
- urlParamKeys: ['id']
352
+ urlParamKeys: ['id'],
417
353
  });
418
- _this.listAllResourcesByScope = _this.makeRequest({
354
+ this.listAllResourcesByScope = this.makeRequest({
419
355
  method: 'GET',
420
356
  path: '/{id}/authz/resource-server/scope/{scopeId}/resources',
421
- urlParamKeys: ['id', 'scopeId']
357
+ urlParamKeys: ['id', 'scopeId'],
422
358
  });
423
- _this.listAllPermissionsByScope = _this.makeRequest({
359
+ this.listAllPermissionsByScope = this.makeRequest({
424
360
  method: 'GET',
425
361
  path: '/{id}/authz/resource-server/scope/{scopeId}/permissions',
426
- urlParamKeys: ['id', 'scopeId']
362
+ urlParamKeys: ['id', 'scopeId'],
427
363
  });
428
- _this.listPermissionsByResource = _this.makeRequest({
364
+ this.listPermissionsByResource = this.makeRequest({
429
365
  method: 'GET',
430
366
  path: '/{id}/authz/resource-server/resource/{resourceId}/permissions',
431
- urlParamKeys: ['id', 'resourceId']
367
+ urlParamKeys: ['id', 'resourceId'],
432
368
  });
433
- _this.listScopesByResource = _this.makeRequest({
369
+ this.listScopesByResource = this.makeRequest({
434
370
  method: 'GET',
435
371
  path: '/{id}/authz/resource-server/resource/{resourceName}/scopes',
436
- urlParamKeys: ['id', 'resourceName']
372
+ urlParamKeys: ['id', 'resourceName'],
437
373
  });
438
- _this.createAuthorizationScope = _this.makeUpdateRequest({
374
+ this.createAuthorizationScope = this.makeUpdateRequest({
439
375
  method: 'POST',
440
376
  path: '{id}/authz/resource-server/scope',
441
- urlParamKeys: ['id']
377
+ urlParamKeys: ['id'],
442
378
  });
443
- _this.updateAuthorizationScope = _this.makeUpdateRequest({
379
+ this.updateAuthorizationScope = this.makeUpdateRequest({
444
380
  method: 'PUT',
445
381
  path: '/{id}/authz/resource-server/scope/{scopeId}',
446
- urlParamKeys: ['id', 'scopeId']
382
+ urlParamKeys: ['id', 'scopeId'],
447
383
  });
448
- _this.getAuthorizationScope = _this.makeRequest({
384
+ this.getAuthorizationScope = this.makeRequest({
449
385
  method: 'GET',
450
386
  path: '/{id}/authz/resource-server/scope/{scopeId}',
451
- urlParamKeys: ['id', 'scopeId']
387
+ urlParamKeys: ['id', 'scopeId'],
452
388
  });
453
- _this.delAuthorizationScope = _this.makeRequest({
389
+ this.delAuthorizationScope = this.makeRequest({
454
390
  method: 'DELETE',
455
391
  path: '/{id}/authz/resource-server/scope/{scopeId}',
456
- urlParamKeys: ['id', 'scopeId']
392
+ urlParamKeys: ['id', 'scopeId'],
457
393
  });
458
- _this.findPermissions = _this.makeRequest({
394
+ this.findPermissions = this.makeRequest({
459
395
  method: 'GET',
460
396
  path: '{id}/authz/resource-server/permission',
461
- urlParamKeys: ['id']
397
+ urlParamKeys: ['id'],
462
398
  });
463
- _this.createPermission = _this.makeUpdateRequest({
399
+ this.createPermission = this.makeUpdateRequest({
464
400
  method: 'POST',
465
401
  path: '/{id}/authz/resource-server/permission/{type}',
466
- urlParamKeys: ['id', 'type']
402
+ urlParamKeys: ['id', 'type'],
467
403
  });
468
- _this.updatePermission = _this.makeUpdateRequest({
404
+ this.updatePermission = this.makeUpdateRequest({
469
405
  method: 'PUT',
470
406
  path: '/{id}/authz/resource-server/permission/{type}/{permissionId}',
471
- urlParamKeys: ['id', 'type', 'permissionId']
407
+ urlParamKeys: ['id', 'type', 'permissionId'],
472
408
  });
473
- _this.delPermission = _this.makeRequest({
409
+ this.delPermission = this.makeRequest({
474
410
  method: 'DELETE',
475
411
  path: '/{id}/authz/resource-server/permission/{type}/{permissionId}',
476
- urlParamKeys: ['id', 'type', 'permissionId']
412
+ urlParamKeys: ['id', 'type', 'permissionId'],
477
413
  });
478
- _this.findOnePermission = _this.makeRequest({
414
+ this.findOnePermission = this.makeRequest({
479
415
  method: 'GET',
480
416
  path: '/{id}/authz/resource-server/permission/{type}/{permissionId}',
481
- urlParamKeys: ['id', 'type', 'permissionId']
417
+ urlParamKeys: ['id', 'type', 'permissionId'],
482
418
  });
483
- _this.getAssociatedScopes = _this.makeRequest({
419
+ this.getAssociatedScopes = this.makeRequest({
484
420
  method: 'GET',
485
421
  path: '/{id}/authz/resource-server/policy/{permissionId}/scopes',
486
- urlParamKeys: ['id', 'permissionId']
422
+ urlParamKeys: ['id', 'permissionId'],
487
423
  });
488
- _this.getAssociatedResources = _this.makeRequest({
424
+ this.getAssociatedResources = this.makeRequest({
489
425
  method: 'GET',
490
426
  path: '/{id}/authz/resource-server/policy/{permissionId}/resources',
491
- urlParamKeys: ['id', 'permissionId']
427
+ urlParamKeys: ['id', 'permissionId'],
492
428
  });
493
- _this.getAssociatedPolicies = _this.makeRequest({
429
+ this.getAssociatedPolicies = this.makeRequest({
494
430
  method: 'GET',
495
431
  path: '/{id}/authz/resource-server/policy/{permissionId}/associatedPolicies',
496
- urlParamKeys: ['id', 'permissionId']
432
+ urlParamKeys: ['id', 'permissionId'],
497
433
  });
498
- _this.getOfflineSessionCount = _this.makeRequest({
434
+ this.getOfflineSessionCount = this.makeRequest({
499
435
  method: 'GET',
500
436
  path: '/{id}/offline-session-count',
501
- urlParamKeys: ['id']
437
+ urlParamKeys: ['id'],
502
438
  });
503
- _this.getInstallationProviders = _this.makeRequest({
439
+ this.getInstallationProviders = this.makeRequest({
504
440
  method: 'GET',
505
441
  path: '/{id}/installation/providers/{providerId}',
506
- urlParamKeys: ['id', 'providerId']
442
+ urlParamKeys: ['id', 'providerId'],
507
443
  });
508
- _this.pushRevocation = _this.makeRequest({
444
+ this.pushRevocation = this.makeRequest({
509
445
  method: 'POST',
510
446
  path: '/{id}/push-revocation',
511
- urlParamKeys: ['id']
447
+ urlParamKeys: ['id'],
512
448
  });
513
- _this.addClusterNode = _this.makeRequest({
449
+ this.addClusterNode = this.makeRequest({
514
450
  method: 'POST',
515
451
  path: '/{id}/nodes',
516
- urlParamKeys: ['id']
452
+ urlParamKeys: ['id'],
517
453
  });
518
- _this.deleteClusterNode = _this.makeRequest({
454
+ this.deleteClusterNode = this.makeRequest({
519
455
  method: 'DELETE',
520
456
  path: '/{id}/nodes/{node}',
521
- urlParamKeys: ['id', 'node']
457
+ urlParamKeys: ['id', 'node'],
522
458
  });
523
- _this.testNodesAvailable = _this.makeRequest({
459
+ this.testNodesAvailable = this.makeRequest({
524
460
  method: 'GET',
525
461
  path: '/{id}/test-nodes-available',
526
- urlParamKeys: ['id']
462
+ urlParamKeys: ['id'],
527
463
  });
528
- _this.getKeyInfo = _this.makeRequest({
464
+ this.getKeyInfo = this.makeRequest({
529
465
  method: 'GET',
530
466
  path: '/{id}/certificates/{attr}',
531
- urlParamKeys: ['id', 'attr']
467
+ urlParamKeys: ['id', 'attr'],
532
468
  });
533
- _this.generateKey = _this.makeRequest({
469
+ this.generateKey = this.makeRequest({
534
470
  method: 'POST',
535
471
  path: '/{id}/certificates/{attr}/generate',
536
- urlParamKeys: ['id', 'attr']
472
+ urlParamKeys: ['id', 'attr'],
537
473
  });
538
- _this.downloadKey = _this.makeUpdateRequest({
474
+ this.downloadKey = this.makeUpdateRequest({
539
475
  method: 'POST',
540
476
  path: '/{id}/certificates/{attr}/download',
541
- urlParamKeys: ['id', 'attr']
477
+ urlParamKeys: ['id', 'attr'],
542
478
  });
543
- _this.generateAndDownloadKey = _this.makeUpdateRequest({
479
+ this.generateAndDownloadKey = this.makeUpdateRequest({
544
480
  method: 'POST',
545
481
  path: '/{id}/certificates/{attr}/generate-and-download',
546
- urlParamKeys: ['id', 'attr']
482
+ urlParamKeys: ['id', 'attr'],
547
483
  });
548
- _this.uploadKey = _this.makeUpdateRequest({
484
+ this.uploadKey = this.makeUpdateRequest({
549
485
  method: 'POST',
550
486
  path: '/{id}/certificates/{attr}/upload',
551
- urlParamKeys: ['id', 'attr']
487
+ urlParamKeys: ['id', 'attr'],
552
488
  });
553
- _this.uploadCertificate = _this.makeUpdateRequest({
489
+ this.uploadCertificate = this.makeUpdateRequest({
554
490
  method: 'POST',
555
491
  path: '/{id}/certificates/{attr}/upload-certificate',
556
- urlParamKeys: ['id', 'attr']
492
+ urlParamKeys: ['id', 'attr'],
557
493
  });
558
- _this.updateFineGrainPermission = _this.makeUpdateRequest({
494
+ this.updateFineGrainPermission = this.makeUpdateRequest({
559
495
  method: 'PUT',
560
496
  path: '/{id}/management/permissions',
561
- urlParamKeys: ['id']
497
+ urlParamKeys: ['id'],
562
498
  });
563
- _this.listFineGrainPermissions = _this.makeRequest({
499
+ this.listFineGrainPermissions = this.makeRequest({
564
500
  method: 'GET',
565
501
  path: '/{id}/management/permissions',
566
- urlParamKeys: ['id']
502
+ urlParamKeys: ['id'],
503
+ });
504
+ }
505
+ async createOrUpdatePolicy(payload) {
506
+ const policyFound = await this.findPolicyByName({
507
+ id: payload.id,
508
+ name: payload.policyName,
509
+ });
510
+ if (policyFound) {
511
+ await this.updatePolicy({ id: payload.id, policyId: policyFound.id, type: payload.policy.type }, payload.policy);
512
+ return this.findPolicyByName({ id: payload.id, name: payload.policyName });
513
+ }
514
+ else {
515
+ return this.createPolicy({ id: payload.id, type: payload.policy.type }, payload.policy);
516
+ }
517
+ }
518
+ async findProtocolMapperByName(payload) {
519
+ const allProtocolMappers = await this.listProtocolMappers({
520
+ id: payload.id,
521
+ ...(payload.realm ? { realm: payload.realm } : {}),
567
522
  });
568
- return _this;
523
+ return allProtocolMappers.find((mapper) => mapper.name === payload.name);
569
524
  }
570
- Clients.prototype.createOrUpdatePolicy = function (payload) {
571
- return __awaiter(this, void 0, void 0, function () {
572
- var policyFound;
573
- return __generator(this, function (_a) {
574
- switch (_a.label) {
575
- case 0: return [4, this.findPolicyByName({
576
- id: payload.id,
577
- name: payload.policyName
578
- })];
579
- case 1:
580
- policyFound = _a.sent();
581
- if (!policyFound) return [3, 3];
582
- return [4, this.updatePolicy({ id: payload.id, policyId: policyFound.id, type: payload.policy.type }, payload.policy)];
583
- case 2:
584
- _a.sent();
585
- return [2, this.findPolicyByName({ id: payload.id, name: payload.policyName })];
586
- case 3: return [2, this.createPolicy({ id: payload.id, type: payload.policy.type }, payload.policy)];
587
- }
588
- });
589
- });
590
- };
591
- Clients.prototype.findProtocolMapperByName = function (payload) {
592
- return __awaiter(this, void 0, void 0, function () {
593
- var allProtocolMappers;
594
- return __generator(this, function (_a) {
595
- switch (_a.label) {
596
- case 0: return [4, this.listProtocolMappers(__assign({ id: payload.id }, (payload.realm ? { realm: payload.realm } : {})))];
597
- case 1:
598
- allProtocolMappers = _a.sent();
599
- return [2, allProtocolMappers.find(function (mapper) { return mapper.name === payload.name; })];
600
- }
601
- });
602
- });
603
- };
604
- return Clients;
605
- }(resource_1["default"]));
606
- exports.Clients = Clients;
525
+ }
607
526
  //# sourceMappingURL=clients.js.map