keycloak-api 1.2.0 → 3.1.1

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 (66) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +6 -2
  3. package/dist/account/components.cjs +19 -19
  4. package/dist/account/components.d.cts +252 -0
  5. package/dist/account/components.d.cts.map +1 -0
  6. package/dist/account/components.d.mts +17 -46
  7. package/dist/account/components.d.mts.map +1 -1
  8. package/dist/account/components.mjs +19 -19
  9. package/dist/account/schemas.cjs +15 -1
  10. package/dist/account/schemas.d.cts +2 -0
  11. package/dist/account/schemas.d.cts.map +1 -0
  12. package/dist/account/schemas.d.mts +1 -658
  13. package/dist/account/schemas.d.mts.map +1 -1
  14. package/dist/account/schemas.mjs +1 -1
  15. package/dist/account/types.d.cts +2 -0
  16. package/dist/account/types.d.cts.map +1 -0
  17. package/dist/account/types.d.mts +1 -488
  18. package/dist/account/types.d.mts.map +1 -1
  19. package/dist/admin/components.cjs +1414 -1307
  20. package/dist/admin/components.d.cts +5357 -0
  21. package/dist/admin/components.d.cts.map +1 -0
  22. package/dist/admin/components.d.mts +667 -2369
  23. package/dist/admin/components.d.mts.map +1 -1
  24. package/dist/admin/components.mjs +1414 -1307
  25. package/dist/admin/schemas.cjs +506 -1
  26. package/dist/admin/schemas.d.cts +2 -0
  27. package/dist/admin/schemas.d.cts.map +1 -0
  28. package/dist/admin/schemas.d.mts +1 -38304
  29. package/dist/admin/schemas.d.mts.map +1 -1
  30. package/dist/admin/schemas.mjs +1 -1
  31. package/dist/admin/types.cjs +3 -1
  32. package/dist/admin/types.d.cts +2 -0
  33. package/dist/admin/types.d.cts.map +1 -0
  34. package/dist/admin/types.d.mts +1 -14736
  35. package/dist/admin/types.d.mts.map +1 -1
  36. package/dist/admin/types.mjs +1 -1
  37. package/dist/{fetcher-caoilmfh.d.ts → fetcher-gzwr3hvv.d.ts} +6 -4
  38. package/dist/fetcher-gzwr3hvv.d.ts.map +1 -0
  39. package/dist/fetcher-jnxrupw5.cjs +117 -0
  40. package/dist/fetcher-jvvyxhrh.js +117 -0
  41. package/dist/index.cjs +27 -22
  42. package/dist/index.d.cts +483 -0
  43. package/dist/index.d.cts.map +1 -0
  44. package/dist/index.d.mts +483 -0
  45. package/dist/index.d.mts.map +1 -0
  46. package/dist/index.d.ts +9178 -7344
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.mjs +32 -25
  49. package/dist/{schemas-hxf19s75.cjs → schemas-c2a8hojk.cjs} +3424 -140
  50. package/dist/schemas-c2hogfk8.d.ts +877 -0
  51. package/dist/schemas-c2hogfk8.d.ts.map +1 -0
  52. package/dist/{schemas-u9zsxojw.js → schemas-eezr3mke.js} +2920 -141
  53. package/dist/schemas-jz60alpw.d.ts +47666 -0
  54. package/dist/schemas-jz60alpw.d.ts.map +1 -0
  55. package/dist/{schemas-jfivc3px.cjs → schemas-l4t53apr.cjs} +74 -3
  56. package/dist/{schemas-mx94q7di.js → schemas-oe6lnvlj.js} +61 -4
  57. package/dist/{types-fb17fnxy.cjs → types-f8akg0ce.cjs} +12 -0
  58. package/dist/types-hfm9r5a8.d.ts +602 -0
  59. package/dist/types-hfm9r5a8.d.ts.map +1 -0
  60. package/dist/{types-pvupsyob.js → types-j1j8d5i8.js} +11 -1
  61. package/dist/types-wu4zpk4a.d.ts +17601 -0
  62. package/dist/types-wu4zpk4a.d.ts.map +1 -0
  63. package/package.json +92 -32
  64. package/dist/fetcher-aq8636lm.cjs +0 -65
  65. package/dist/fetcher-caoilmfh.d.ts.map +0 -1
  66. package/dist/fetcher-letfyywe.js +0 -65
package/dist/index.mjs CHANGED
@@ -1,14 +1,30 @@
1
- export { operationsByPath as accountOperationsByPath, operationsByTag as accountOperationsByTag, tagDictionary as accountTagDictionary } from './account/components.mjs';
2
- export { ah as accountSchemas } from './schemas-mx94q7di.js';
3
- export { operationsByPath as adminOperationsByPath, operationsByTag as adminOperationsByTag, tagDictionary as adminTagDictionary } from './admin/components.mjs';
4
- export { To as adminSchemas } from './schemas-u9zsxojw.js';
5
- export { t as adminTypes } from './types-pvupsyob.js';
6
- import { c as client } from './fetcher-letfyywe.js';
1
+ import { operationsByPath } from './account/components.mjs';
2
+ export { operationsByTag as accountOperationsByTag, tagDictionary as accountTagDictionary } from './account/components.mjs';
3
+ export { av as accountSchemas } from './schemas-oe6lnvlj.js';
4
+ import { operationsByPath as operationsByPath$1 } from './admin/components.mjs';
5
+ export { operationsByTag as adminOperationsByTag, tagDictionary as adminTagDictionary } from './admin/components.mjs';
6
+ export { $h as adminSchemas } from './schemas-eezr3mke.js';
7
+ export { t as adminTypes } from './types-j1j8d5i8.js';
7
8
 
8
9
  var types = {
9
10
  __proto__: null
10
11
  };
11
12
 
13
+ function findOperation(operations, endpoint) {
14
+ if (!Object.hasOwn(operations, endpoint)) throw new Error(`Unknown endpoint: ${endpoint}`);
15
+ return operations[endpoint];
16
+ }
17
+ // The caller's per-call config, such as extra headers, layers over the client's own.
18
+ function withConfig(params, clientConfig) {
19
+ const { config, ...rest } = params ?? {};
20
+ return {
21
+ ...rest,
22
+ config: {
23
+ ...clientConfig,
24
+ ...config
25
+ }
26
+ };
27
+ }
12
28
  class KeycloakAdminApi {
13
29
  #baseUrl;
14
30
  #token;
@@ -19,17 +35,13 @@ class KeycloakAdminApi {
19
35
  this.#fetch = options.fetch || fetch;
20
36
  if (!this.#fetch) throw new Error("Fetch is required");
21
37
  }
22
- async request(endpoint, params) {
23
- const [method = "", url = ""] = endpoint.split(" ");
24
- const extraParams = params || {};
25
- const result = await client({
26
- ...extraParams,
27
- method,
28
- url,
38
+ async request(endpoint, ...[params]) {
39
+ const operation = findOperation(operationsByPath$1, endpoint);
40
+ const result = await operation(withConfig(params, {
29
41
  baseUrl: this.#baseUrl,
30
42
  token: this.#token,
31
43
  fetchImpl: this.#fetch
32
- });
44
+ }));
33
45
  return result;
34
46
  }
35
47
  }
@@ -45,20 +57,15 @@ class KeycloakAccountApi {
45
57
  this.#fetch = options.fetch || fetch;
46
58
  if (!this.#fetch) throw new Error("Fetch is required");
47
59
  }
48
- async request(endpoint, params) {
49
- const baseUrl = `${this.#baseUrl}/realms/${this.#realm}`;
50
- const [method = "", url = ""] = endpoint.split(" ");
51
- const extraParams = params || {};
52
- const result = await client({
53
- ...extraParams,
54
- method,
55
- url,
56
- baseUrl,
60
+ async request(endpoint, ...[params]) {
61
+ const operation = findOperation(operationsByPath, endpoint);
62
+ const result = await operation(withConfig(params, {
63
+ baseUrl: `${this.#baseUrl.replace(/\/+$/, "")}/realms/${this.#realm}`,
57
64
  token: this.#token,
58
65
  fetchImpl: this.#fetch
59
- });
66
+ }));
60
67
  return result;
61
68
  }
62
69
  }
63
70
 
64
- export { KeycloakAccountApi, KeycloakAdminApi, types as accountTypes };
71
+ export { KeycloakAccountApi, KeycloakAdminApi, operationsByPath as accountOperationsByPath, types as accountTypes, operationsByPath$1 as adminOperationsByPath };