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
@@ -1,65 +0,0 @@
1
- function notEmpty(value) {
2
- return value !== null && value !== undefined;
3
- }
4
- function compactObject(obj) {
5
- return Object.fromEntries(Object.entries(obj).filter(([, value])=>notEmpty(value)));
6
- }
7
-
8
- async function client({ url, method, body, headers, pathParams, queryParams, signal, baseUrl = "", token = null, fetchImpl = fetch }) {
9
- try {
10
- const requestHeaders = compactObject({
11
- "Content-Type": "application/json",
12
- Authorization: token ? `Bearer ${token}` : undefined,
13
- Accept: "application/json",
14
- ...headers
15
- });
16
- /**
17
- * As the fetch API is being used, when multipart/form-data is specified
18
- * the Content-Type header must be deleted so that the browser can set
19
- * the correct boundary.
20
- * https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects#sending_files_using_a_formdata_object
21
- */ if (requestHeaders["Content-Type"]?.toLowerCase().includes("multipart/form-data")) {
22
- delete requestHeaders["Content-Type"];
23
- }
24
- const payload = body instanceof FormData ? body : requestHeaders["Content-Type"] === "application/json" ? JSON.stringify(body) : body;
25
- const fullUrl = `${baseUrl}${resolveUrl(url, queryParams, pathParams)}`;
26
- const response = await fetchImpl(fullUrl, {
27
- signal,
28
- method: method.toUpperCase(),
29
- body: payload,
30
- headers: requestHeaders
31
- });
32
- if (!response.ok) {
33
- let error;
34
- try {
35
- error = await response.json();
36
- } catch (e) {
37
- error = {
38
- status: "unknown",
39
- payload: e instanceof Error ? `Unexpected error (${e.message})` : "Unexpected error"
40
- };
41
- }
42
- throw error;
43
- }
44
- if (response.headers?.get("content-type")?.includes("json")) {
45
- return await response.json();
46
- } else {
47
- // if it is not a json response, assume it is a blob and cast it to TData
48
- return await response.text();
49
- }
50
- } catch (e) {
51
- const errorObject = {
52
- name: "unknown",
53
- message: e instanceof Error ? `Network error (${e.message})` : "Network error",
54
- stack: e
55
- };
56
- throw errorObject;
57
- }
58
- }
59
- const resolveUrl = (url, queryParams = {}, pathParams = {})=>{
60
- let query = new URLSearchParams(queryParams).toString();
61
- if (query) query = `?${query}`;
62
- return url.replace(/\{\w*\}/g, (key)=>pathParams[key.slice(1, -1)] ?? "") + query;
63
- };
64
-
65
- export { client as c };