@keycloak/keycloak-admin-client 19.0.0-dev.4 → 19.0.0-dev.40

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 (165) 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 +3 -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 +15 -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 +7 -7
  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 +56 -51
  149. package/lib/resources/users.js +100 -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/lib/utils/stringifyQueryParams.d.ts +1 -0
  160. package/lib/utils/stringifyQueryParams.js +5 -0
  161. package/lib/utils/stringifyQueryParams.js.map +1 -0
  162. package/package.json +25 -19
  163. package/lib/defs/accessTokenAuthorization.d.ts +0 -4
  164. package/lib/defs/accessTokenAuthorization.js +0 -3
  165. package/lib/defs/accessTokenAuthorization.js.map +0 -1
@@ -1,212 +1,134 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- 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;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
50
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
51
- if (ar || !(i in from)) {
52
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
53
- ar[i] = from[i];
54
- }
55
- }
56
- return to.concat(ar || Array.prototype.slice.call(from));
57
- };
58
- var __importDefault = (this && this.__importDefault) || function (mod) {
59
- return (mod && mod.__esModule) ? mod : { "default": mod };
60
- };
61
- exports.__esModule = true;
62
- exports.Agent = void 0;
63
- var url_join_1 = __importDefault(require("url-join"));
64
- var url_template_1 = __importDefault(require("url-template"));
65
- var axios_1 = __importDefault(require("axios"));
66
- var query_string_1 = __importDefault(require("query-string"));
67
- var lodash_1 = require("lodash");
68
- var SLASH = '/';
69
- var Agent = (function () {
70
- function Agent(_a) {
71
- var client = _a.client, _b = _a.path, path = _b === void 0 ? '/' : _b, _c = _a.getUrlParams, getUrlParams = _c === void 0 ? function () { return ({}); } : _c, _d = _a.getBaseUrl, getBaseUrl = _d === void 0 ? function () { return client.baseUrl; } : _d;
1
+ import axios from 'axios';
2
+ import { isUndefined, last, omit, pick } from 'lodash-es';
3
+ import urlJoin from 'url-join';
4
+ import { parseTemplate } from 'url-template';
5
+ import { stringifyQueryParams } from '../utils/stringifyQueryParams.js';
6
+ const SLASH = '/';
7
+ export class Agent {
8
+ constructor({ client, path = '/', getUrlParams = () => ({}), getBaseUrl = () => client.baseUrl, }) {
72
9
  this.client = client;
73
10
  this.getBaseParams = getUrlParams;
74
11
  this.getBaseUrl = getBaseUrl;
75
12
  this.basePath = path;
76
13
  }
77
- Agent.prototype.request = function (_a) {
78
- var _this = this;
79
- var method = _a.method, _b = _a.path, path = _b === void 0 ? '' : _b, _c = _a.urlParamKeys, urlParamKeys = _c === void 0 ? [] : _c, _d = _a.queryParamKeys, queryParamKeys = _d === void 0 ? [] : _d, _e = _a.catchNotFound, catchNotFound = _e === void 0 ? false : _e, keyTransform = _a.keyTransform, payloadKey = _a.payloadKey, returnResourceIdInLocationHeader = _a.returnResourceIdInLocationHeader, ignoredKeys = _a.ignoredKeys, headers = _a.headers;
80
- return function (payload, options) {
81
- if (payload === void 0) { payload = {}; }
82
- return __awaiter(_this, void 0, void 0, function () {
83
- var baseParams, queryParams, allUrlParamKeys, urlParams, omittedKeys;
84
- var _a, _b, _c, _d;
85
- return __generator(this, function (_e) {
86
- baseParams = (_b = (_a = this.getBaseParams) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : {};
87
- queryParams = queryParamKeys ? (0, lodash_1.pick)(payload, queryParamKeys) : null;
88
- allUrlParamKeys = __spreadArray(__spreadArray([], Object.keys(baseParams), true), urlParamKeys, true);
89
- urlParams = __assign(__assign({}, baseParams), (0, lodash_1.pick)(payload, allUrlParamKeys));
90
- omittedKeys = ignoredKeys
91
- ? __spreadArray(__spreadArray([], allUrlParamKeys, true), queryParamKeys, true).filter(function (key) { return !ignoredKeys.includes(key); })
92
- : __spreadArray(__spreadArray([], allUrlParamKeys, true), queryParamKeys, true);
93
- payload = (0, lodash_1.omit)(payload, omittedKeys);
94
- if (keyTransform) {
95
- this.transformKey(payload, keyTransform);
96
- this.transformKey(queryParams, keyTransform);
97
- }
98
- return [2, this.requestWithParams(__assign(__assign({ method: method, path: path, payload: payload, urlParams: urlParams, queryParams: queryParams, catchNotFound: catchNotFound }, ((_d = (_c = this.client.getGlobalRequestArgOptions()) !== null && _c !== void 0 ? _c : options) !== null && _d !== void 0 ? _d : {})), { payloadKey: payloadKey, returnResourceIdInLocationHeader: returnResourceIdInLocationHeader, headers: headers }))];
99
- });
14
+ request({ method, path = '', urlParamKeys = [], queryParamKeys = [], catchNotFound = false, keyTransform, payloadKey, returnResourceIdInLocationHeader, ignoredKeys, headers, }) {
15
+ return async (payload = {}, options) => {
16
+ const baseParams = this.getBaseParams?.() ?? {};
17
+ const queryParams = queryParamKeys ? pick(payload, queryParamKeys) : null;
18
+ const allUrlParamKeys = [...Object.keys(baseParams), ...urlParamKeys];
19
+ const urlParams = { ...baseParams, ...pick(payload, allUrlParamKeys) };
20
+ const omittedKeys = ignoredKeys
21
+ ? [...allUrlParamKeys, ...queryParamKeys].filter((key) => !ignoredKeys.includes(key))
22
+ : [...allUrlParamKeys, ...queryParamKeys];
23
+ payload = omit(payload, omittedKeys);
24
+ if (keyTransform) {
25
+ this.transformKey(payload, keyTransform);
26
+ this.transformKey(queryParams, keyTransform);
27
+ }
28
+ return this.requestWithParams({
29
+ method,
30
+ path,
31
+ payload,
32
+ urlParams,
33
+ queryParams,
34
+ catchNotFound,
35
+ ...(this.client.getGlobalRequestArgOptions() ?? options ?? {}),
36
+ payloadKey,
37
+ returnResourceIdInLocationHeader,
38
+ headers,
100
39
  });
101
40
  };
102
- };
103
- Agent.prototype.updateRequest = function (_a) {
104
- var _this = this;
105
- var method = _a.method, _b = _a.path, path = _b === void 0 ? '' : _b, _c = _a.urlParamKeys, urlParamKeys = _c === void 0 ? [] : _c, _d = _a.queryParamKeys, queryParamKeys = _d === void 0 ? [] : _d, _e = _a.catchNotFound, catchNotFound = _e === void 0 ? false : _e, keyTransform = _a.keyTransform, payloadKey = _a.payloadKey, returnResourceIdInLocationHeader = _a.returnResourceIdInLocationHeader, headers = _a.headers;
106
- return function (query, payload) {
107
- if (query === void 0) { query = {}; }
108
- if (payload === void 0) { payload = {}; }
109
- return __awaiter(_this, void 0, void 0, function () {
110
- var baseParams, queryParams, allUrlParamKeys, urlParams;
111
- var _a, _b;
112
- return __generator(this, function (_c) {
113
- baseParams = (_b = (_a = this.getBaseParams) === null || _a === void 0 ? void 0 : _a.call(this)) !== null && _b !== void 0 ? _b : {};
114
- queryParams = queryParamKeys ? (0, lodash_1.pick)(query, queryParamKeys) : null;
115
- allUrlParamKeys = __spreadArray(__spreadArray([], Object.keys(baseParams), true), urlParamKeys, true);
116
- urlParams = __assign(__assign({}, baseParams), (0, lodash_1.pick)(query, allUrlParamKeys));
117
- if (keyTransform) {
118
- this.transformKey(queryParams, keyTransform);
119
- }
120
- return [2, this.requestWithParams({
121
- method: method,
122
- path: path,
123
- payload: payload,
124
- urlParams: urlParams,
125
- queryParams: queryParams,
126
- catchNotFound: catchNotFound,
127
- payloadKey: payloadKey,
128
- returnResourceIdInLocationHeader: returnResourceIdInLocationHeader,
129
- headers: headers
130
- })];
131
- });
41
+ }
42
+ updateRequest({ method, path = '', urlParamKeys = [], queryParamKeys = [], catchNotFound = false, keyTransform, payloadKey, returnResourceIdInLocationHeader, headers }) {
43
+ return async (query = {}, payload = {}) => {
44
+ const baseParams = this.getBaseParams?.() ?? {};
45
+ const queryParams = queryParamKeys ? pick(query, queryParamKeys) : null;
46
+ const allUrlParamKeys = [...Object.keys(baseParams), ...urlParamKeys];
47
+ const urlParams = {
48
+ ...baseParams,
49
+ ...pick(query, allUrlParamKeys),
50
+ };
51
+ if (keyTransform) {
52
+ this.transformKey(queryParams, keyTransform);
53
+ }
54
+ return this.requestWithParams({
55
+ method,
56
+ path,
57
+ payload,
58
+ urlParams,
59
+ queryParams,
60
+ catchNotFound,
61
+ payloadKey,
62
+ returnResourceIdInLocationHeader,
63
+ headers,
132
64
  });
133
65
  };
134
- };
135
- Agent.prototype.requestWithParams = function (_a) {
136
- var _b, _c, _d;
137
- var method = _a.method, path = _a.path, payload = _a.payload, urlParams = _a.urlParams, queryParams = _a.queryParams, catchNotFound = _a.catchNotFound, payloadKey = _a.payloadKey, returnResourceIdInLocationHeader = _a.returnResourceIdInLocationHeader, headers = _a.headers;
138
- return __awaiter(this, void 0, void 0, function () {
139
- var newPath, pathTemplate, parsedPath, url, requestConfig, _e, _f, _g, res, locationHeader, resourceId, field, err_1;
140
- var _h, _j;
141
- return __generator(this, function (_k) {
142
- switch (_k.label) {
143
- case 0:
144
- newPath = (0, url_join_1["default"])(this.basePath, path);
145
- pathTemplate = url_template_1["default"].parse(newPath);
146
- parsedPath = pathTemplate.expand(urlParams);
147
- url = "".concat((_c = (_b = this.getBaseUrl) === null || _b === void 0 ? void 0 : _b.call(this)) !== null && _c !== void 0 ? _c : '').concat(parsedPath);
148
- requestConfig = __assign(__assign({ paramsSerializer: function (params) { return query_string_1["default"].stringify(params); } }, (this.client.getRequestConfig() || {})), { method: method, url: url });
149
- _e = requestConfig;
150
- _f = [__assign({}, requestConfig.headers)];
151
- _h = {};
152
- _g = "bearer ".concat;
153
- return [4, this.client.getAccessToken()];
154
- case 1:
155
- _e.headers = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.Authorization = _g.apply("bearer ", [_k.sent()]), _h)])), headers]);
156
- if (method === 'GET') {
157
- requestConfig.params = payload;
158
- }
159
- else {
160
- requestConfig.data = payloadKey ? payload[payloadKey] : payload;
161
- }
162
- if (queryParams) {
163
- requestConfig.params = requestConfig.params
164
- ? __assign(__assign({}, requestConfig.params), queryParams) : queryParams;
165
- }
166
- _k.label = 2;
167
- case 2:
168
- _k.trys.push([2, 4, , 5]);
169
- return [4, (0, axios_1["default"])(requestConfig)];
170
- case 3:
171
- res = _k.sent();
172
- if (returnResourceIdInLocationHeader) {
173
- locationHeader = res.headers.location;
174
- if (typeof locationHeader !== 'string') {
175
- throw new Error("location header is not found in request: ".concat(res.config.url));
176
- }
177
- resourceId = (0, lodash_1.last)(locationHeader.split(SLASH));
178
- if (!resourceId) {
179
- throw new Error("resourceId is not found in Location header from request: ".concat(res.config.url));
180
- }
181
- field = returnResourceIdInLocationHeader.field;
182
- return [2, (_j = {}, _j[field] = resourceId, _j)];
183
- }
184
- return [2, res.data];
185
- case 4:
186
- err_1 = _k.sent();
187
- if (axios_1["default"].isAxiosError(err_1) && ((_d = err_1.response) === null || _d === void 0 ? void 0 : _d.status) === 404 && catchNotFound) {
188
- return [2, null];
189
- }
190
- throw err_1;
191
- case 5: return [2];
66
+ }
67
+ async requestWithParams({ method, path, payload, urlParams, queryParams, catchNotFound, payloadKey, returnResourceIdInLocationHeader, headers }) {
68
+ const newPath = urlJoin(this.basePath, path);
69
+ const pathTemplate = parseTemplate(newPath);
70
+ const parsedPath = pathTemplate.expand(urlParams);
71
+ const url = `${this.getBaseUrl?.() ?? ''}${parsedPath}`;
72
+ const requestConfig = {
73
+ paramsSerializer: (params) => stringifyQueryParams(params),
74
+ ...(this.client.getRequestConfig() || {}),
75
+ method,
76
+ url,
77
+ };
78
+ requestConfig.headers = {
79
+ ...requestConfig.headers,
80
+ Authorization: `bearer ${await this.client.getAccessToken()}`,
81
+ ...headers
82
+ };
83
+ if (method === 'GET') {
84
+ requestConfig.params = payload;
85
+ }
86
+ else {
87
+ requestConfig.data = payloadKey ? payload[payloadKey] : payload;
88
+ }
89
+ if (queryParams) {
90
+ requestConfig.params = requestConfig.params
91
+ ? {
92
+ ...requestConfig.params,
93
+ ...queryParams,
192
94
  }
193
- });
194
- });
195
- };
196
- Agent.prototype.transformKey = function (payload, keyMapping) {
95
+ : queryParams;
96
+ }
97
+ try {
98
+ const res = await axios.default(requestConfig);
99
+ if (returnResourceIdInLocationHeader) {
100
+ const locationHeader = res.headers.location;
101
+ if (typeof locationHeader !== 'string') {
102
+ throw new Error(`location header is not found in request: ${res.config.url}`);
103
+ }
104
+ const resourceId = last(locationHeader.split(SLASH));
105
+ if (!resourceId) {
106
+ throw new Error(`resourceId is not found in Location header from request: ${res.config.url}`);
107
+ }
108
+ const { field } = returnResourceIdInLocationHeader;
109
+ return { [field]: resourceId };
110
+ }
111
+ return res.data;
112
+ }
113
+ catch (err) {
114
+ if (axios.default.isAxiosError(err) && err.response?.status === 404 && catchNotFound) {
115
+ return null;
116
+ }
117
+ throw err;
118
+ }
119
+ }
120
+ transformKey(payload, keyMapping) {
197
121
  if (!payload) {
198
122
  return;
199
123
  }
200
- Object.keys(keyMapping).some(function (key) {
201
- if ((0, lodash_1.isUndefined)(payload[key])) {
124
+ Object.keys(keyMapping).some((key) => {
125
+ if (isUndefined(payload[key])) {
202
126
  return false;
203
127
  }
204
- var newKey = keyMapping[key];
128
+ const newKey = keyMapping[key];
205
129
  payload[newKey] = payload[key];
206
130
  delete payload[key];
207
131
  });
208
- };
209
- return Agent;
210
- }());
211
- exports.Agent = Agent;
132
+ }
133
+ }
212
134
  //# sourceMappingURL=agent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/resources/agent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAA+B;AAC/B,8DAAoC;AACpC,gDAA6E;AA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AAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACnC,IAAI,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE;gBAE7B,OAAO,KAAK,CAAC;aACd;YACD,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;YAC/B,OAAO,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAC/B,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
- import Resource from './resource';
2
- import KeycloakAdminClient from '..';
1
+ import Resource from './resource.js';
2
+ import type KeycloakAdminClient from '../index.js';
3
3
  export declare class AttackDetection extends Resource<{
4
4
  realm?: string;
5
5
  }> {
@@ -7,14 +7,14 @@ export declare class AttackDetection extends Resource<{
7
7
  id: string;
8
8
  } & {
9
9
  realm?: string | undefined;
10
- }) | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<Record<string, any> | undefined>;
10
+ }) | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<Record<string, any> | undefined>;
11
11
  del: (payload?: ({
12
12
  id: string;
13
13
  } & {
14
14
  realm?: string | undefined;
15
- }) | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<void>;
15
+ }) | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<void>;
16
16
  delAll: (payload?: {
17
17
  realm?: string | undefined;
18
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<void>;
18
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<void>;
19
19
  constructor(client: KeycloakAdminClient);
20
20
  }
@@ -1,53 +1,28 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
- exports.__esModule = true;
21
- exports.AttackDetection = void 0;
22
- var resource_1 = __importDefault(require("./resource"));
23
- var AttackDetection = (function (_super) {
24
- __extends(AttackDetection, _super);
25
- function AttackDetection(client) {
26
- var _this = _super.call(this, client, {
1
+ import Resource from './resource.js';
2
+ export class AttackDetection extends Resource {
3
+ constructor(client) {
4
+ super(client, {
27
5
  path: '/admin/realms/{realm}/attack-detection/brute-force',
28
- getUrlParams: function () { return ({
29
- realm: client.realmName
30
- }); },
31
- getBaseUrl: function () { return client.baseUrl; }
32
- }) || this;
33
- _this.findOne = _this.makeRequest({
6
+ getUrlParams: () => ({
7
+ realm: client.realmName,
8
+ }),
9
+ getBaseUrl: () => client.baseUrl,
10
+ });
11
+ this.findOne = this.makeRequest({
34
12
  method: 'GET',
35
13
  path: '/users/{id}',
36
14
  urlParamKeys: ['id'],
37
- catchNotFound: true
15
+ catchNotFound: true,
38
16
  });
39
- _this.del = _this.makeRequest({
17
+ this.del = this.makeRequest({
40
18
  method: 'DELETE',
41
19
  path: '/users/{id}',
42
- urlParamKeys: ['id']
20
+ urlParamKeys: ['id'],
43
21
  });
44
- _this.delAll = _this.makeRequest({
22
+ this.delAll = this.makeRequest({
45
23
  method: 'DELETE',
46
- path: '/users'
24
+ path: '/users',
47
25
  });
48
- return _this;
49
26
  }
50
- return AttackDetection;
51
- }(resource_1["default"]));
52
- exports.AttackDetection = AttackDetection;
27
+ }
53
28
  //# sourceMappingURL=attackDetection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attackDetection.js","sourceRoot":"","sources":["../../src/resources/attackDetection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,wDAAkC;AAGlC;IAAqC,mCAA0B;IAsB7D,yBAAY,MAA2B;QAAvC,YACE,kBAAM,MAAM,EAAE;YACZ,IAAI,EAAE,oDAAoD;YAC1D,YAAY,EAAE,cAAM,OAAA,CAAC;gBACnB,KAAK,EAAE,MAAM,CAAC,SAAS;aACxB,CAAC,EAFkB,CAElB;YACF,UAAU,EAAE,cAAM,OAAA,MAAM,CAAC,OAAO,EAAd,CAAc;SACjC,CAAC,SACH;QA7BM,aAAO,GAAG,KAAI,CAAC,WAAW,CAG/B;YACA,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,aAAa;YACnB,YAAY,EAAE,CAAC,IAAI,CAAC;YACpB,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QAEI,SAAG,GAAG,KAAI,CAAC,WAAW,CAAqB;YAChD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,aAAa;YACnB,YAAY,EAAE,CAAC,IAAI,CAAC;SACrB,CAAC,CAAC;QAEI,YAAM,GAAG,KAAI,CAAC,WAAW,CAAW;YACzC,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;;IAUH,CAAC;IACH,sBAAC;AAAD,CAAC,AA/BD,CAAqC,qBAAQ,GA+B5C;AA/BY,0CAAe"}
1
+ {"version":3,"file":"attackDetection.js","sourceRoot":"","sources":["../../src/resources/attackDetection.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAGrC,MAAM,OAAO,eAAgB,SAAQ,QAA0B;IAsB7D,YAAY,MAA2B;QACrC,KAAK,CAAC,MAAM,EAAE;YACZ,IAAI,EAAE,oDAAoD;YAC1D,YAAY,EAAE,GAAG,EAAE,CAAC,CAAC;gBACnB,KAAK,EAAE,MAAM,CAAC,SAAS;aACxB,CAAC;YACF,UAAU,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO;SACjC,CAAC,CAAC;QA5BE,YAAO,GAAG,IAAI,CAAC,WAAW,CAG/B;YACA,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,aAAa;YACnB,YAAY,EAAE,CAAC,IAAI,CAAC;YACpB,aAAa,EAAE,IAAI;SACpB,CAAC,CAAC;QAEI,QAAG,GAAG,IAAI,CAAC,WAAW,CAAqB;YAChD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,aAAa;YACnB,YAAY,EAAE,CAAC,IAAI,CAAC;SACrB,CAAC,CAAC;QAEI,WAAM,GAAG,IAAI,CAAC,WAAW,CAAW;YACzC,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;IAUH,CAAC;CACF"}
@@ -1,88 +1,89 @@
1
- import Resource from './resource';
2
- import RequiredActionProviderRepresentation from '../defs/requiredActionProviderRepresentation';
3
- import { KeycloakAdminClient } from '../client';
4
- import AuthenticationExecutionInfoRepresentation from '../defs/authenticationExecutionInfoRepresentation';
5
- import AuthenticationFlowRepresentation from '../defs/authenticationFlowRepresentation';
6
- import AuthenticatorConfigRepresentation, { AuthenticationProviderRepresentation } from '../defs/authenticatorConfigRepresentation';
7
- import AuthenticatorConfigInfoRepresentation from '../defs/authenticatorConfigInfoRepresentation';
8
- import RequiredActionProviderSimpleRepresentation from '../defs/requiredActionProviderSimpleRepresentation';
1
+ import Resource from './resource.js';
2
+ import type RequiredActionProviderRepresentation from '../defs/requiredActionProviderRepresentation.js';
3
+ import type { KeycloakAdminClient } from '../client.js';
4
+ import type AuthenticationExecutionInfoRepresentation from '../defs/authenticationExecutionInfoRepresentation.js';
5
+ import type AuthenticationFlowRepresentation from '../defs/authenticationFlowRepresentation.js';
6
+ import type AuthenticatorConfigRepresentation from '../defs/authenticatorConfigRepresentation.js';
7
+ import type { AuthenticationProviderRepresentation } from '../defs/authenticatorConfigRepresentation.js';
8
+ import type AuthenticatorConfigInfoRepresentation from '../defs/authenticatorConfigInfoRepresentation.js';
9
+ import type RequiredActionProviderSimpleRepresentation from '../defs/requiredActionProviderSimpleRepresentation.js';
9
10
  export declare class AuthenticationManagement extends Resource {
10
- registerRequiredAction: (payload?: Record<string, any> | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
11
- getRequiredActions: (payload?: (void & {}) | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<RequiredActionProviderRepresentation[]>;
11
+ registerRequiredAction: (payload?: Record<string, any> | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
12
+ getRequiredActions: (payload?: (void & {}) | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<RequiredActionProviderRepresentation[]>;
12
13
  getRequiredActionForAlias: (payload?: {
13
14
  alias: string;
14
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
15
- getClientAuthenticatorProviders: (payload?: (void & {}) | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationProviderRepresentation[]>;
16
- getAuthenticatorProviders: (payload?: (void & {}) | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationProviderRepresentation[]>;
17
- getFormActionProviders: (payload?: (void & {}) | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationProviderRepresentation[]>;
15
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
16
+ getClientAuthenticatorProviders: (payload?: (void & {}) | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationProviderRepresentation[]>;
17
+ getAuthenticatorProviders: (payload?: (void & {}) | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationProviderRepresentation[]>;
18
+ getFormActionProviders: (payload?: (void & {}) | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationProviderRepresentation[]>;
18
19
  updateRequiredAction: (query: {
19
20
  alias: string;
20
21
  }, payload: RequiredActionProviderRepresentation) => Promise<void>;
21
22
  deleteRequiredAction: (payload?: {
22
23
  alias: string;
23
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<void>;
24
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<void>;
24
25
  lowerRequiredActionPriority: (payload?: {
25
26
  alias: string;
26
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
27
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
27
28
  raiseRequiredActionPriority: (payload?: {
28
29
  alias: string;
29
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
30
- getUnregisteredRequiredActions: (payload?: (void & {}) | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<RequiredActionProviderSimpleRepresentation[]>;
31
- getFlows: (payload?: (void & {}) | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationFlowRepresentation[]>;
30
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
31
+ getUnregisteredRequiredActions: (payload?: (void & {}) | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<RequiredActionProviderSimpleRepresentation[]>;
32
+ getFlows: (payload?: {} | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationFlowRepresentation[]>;
32
33
  getFlow: (payload?: {
33
34
  flowId: string;
34
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationFlowRepresentation>;
35
- getFormProviders: (payload?: (void & {}) | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationProviderRepresentation[]>;
36
- createFlow: (payload?: AuthenticationFlowRepresentation | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationFlowRepresentation>;
35
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationFlowRepresentation>;
36
+ getFormProviders: (payload?: (void & {}) | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationProviderRepresentation[]>;
37
+ createFlow: (payload?: AuthenticationFlowRepresentation | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationFlowRepresentation>;
37
38
  copyFlow: (payload?: {
38
39
  flow: string;
39
40
  newName: string;
40
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
41
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
41
42
  deleteFlow: (payload?: {
42
43
  flowId: string;
43
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
44
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
44
45
  updateFlow: (query: {
45
46
  flowId: string;
46
47
  }, payload: AuthenticationFlowRepresentation) => Promise<any>;
47
48
  getExecutions: (payload?: {
48
49
  flow: string;
49
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationExecutionInfoRepresentation[]>;
50
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationExecutionInfoRepresentation[]>;
50
51
  addExecution: (query: {
51
52
  flow: string;
52
53
  }, payload: AuthenticationExecutionInfoRepresentation) => Promise<any>;
53
54
  addExecutionToFlow: (payload?: {
54
55
  flow: string;
55
56
  provider: string;
56
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationExecutionInfoRepresentation>;
57
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationExecutionInfoRepresentation>;
57
58
  addFlowToFlow: (payload?: {
58
59
  flow: string;
59
60
  alias: string;
60
61
  type: string;
61
62
  provider: string;
62
63
  description: string;
63
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationFlowRepresentation>;
64
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticationFlowRepresentation>;
64
65
  updateExecution: (query: {
65
66
  flow: string;
66
67
  }, payload: AuthenticationExecutionInfoRepresentation) => Promise<any>;
67
68
  delExecution: (payload?: {
68
69
  id: string;
69
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
70
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
70
71
  lowerPriorityExecution: (payload?: {
71
72
  id: string;
72
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
73
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
73
74
  raisePriorityExecution: (payload?: {
74
75
  id: string;
75
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
76
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
76
77
  getConfigDescription: (payload?: {
77
78
  providerId: string;
78
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticatorConfigInfoRepresentation>;
79
- createConfig: (payload?: AuthenticatorConfigRepresentation | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticatorConfigRepresentation>;
80
- updateConfig: (payload?: AuthenticatorConfigRepresentation | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<void>;
79
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticatorConfigInfoRepresentation>;
80
+ createConfig: (payload?: AuthenticatorConfigRepresentation | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticatorConfigRepresentation>;
81
+ updateConfig: (payload?: AuthenticatorConfigRepresentation | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<void>;
81
82
  getConfig: (payload?: {
82
83
  id: string;
83
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticatorConfigRepresentation>;
84
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<AuthenticatorConfigRepresentation>;
84
85
  delConfig: (payload?: {
85
86
  id: string;
86
- } | undefined, options?: Pick<import("./agent").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
87
+ } | undefined, options?: Pick<import("./agent.js").RequestArgs, "catchNotFound"> | undefined) => Promise<any>;
87
88
  constructor(client: KeycloakAdminClient);
88
89
  }