keycloak-api 0.2.1 → 0.2.3

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > keycloak-api@0.2.1 build /home/runner/work/openapi-clients/openapi-clients/packages/keycloak-api
2
+ > keycloak-api@0.2.3 build /home/runner/work/openapi-clients/openapi-clients/packages/keycloak-api
3
3
  > unbuild
4
4
 
5
5
  [info] Automatically detected entries: src/index [esm] [cjs] [dts]
@@ -10,5 +10,5 @@
10
10
 
11
11
  [log] dist/index.mjs (total size: 132 kB, chunk size: 132 kB, exports: AccountExtra, AdminExtra, KeycloakAccountApi, KeycloakAdminApi)
12
12
 
13
- Σ Total dist size (byte size): 3.6 MB
13
+ Σ Total dist size (byte size): 3.59 MB
14
14
  [log]
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # keycloak-api
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - e9199f6: Remove realm from account pathParams
8
+
9
+ ## 0.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 44ab118: Add accept header
14
+
3
15
  ## 0.2.1
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -23,6 +23,7 @@ async function fetch$1({
23
23
  const requestHeaders = compactObject({
24
24
  "Content-Type": "application/json",
25
25
  Authorization: token ? `Bearer ${token}` : void 0,
26
+ Accept: "application/json",
26
27
  ...headers
27
28
  });
28
29
  if (requestHeaders["Content-Type"]?.toLowerCase().includes("multipart/form-data")) {
@@ -86,18 +87,21 @@ class KeycloakAdminApi {
86
87
  }
87
88
  class KeycloakAccountApi {
88
89
  #baseUrl;
90
+ #realm;
89
91
  #token;
90
92
  #fetch;
91
93
  constructor(options) {
92
94
  this.#baseUrl = options.baseUrl;
95
+ this.#realm = options.realm;
93
96
  this.#token = options.token;
94
97
  this.#fetch = options.fetch || fetch;
95
98
  if (!this.#fetch) throw new Error("Fetch is required");
96
99
  }
97
100
  async request(endpoint, params) {
101
+ const baseUrl = `${this.#baseUrl}/realms/${this.#realm}`;
98
102
  const [method = "", url = ""] = endpoint.split(" ");
99
103
  const extraParams = params || {};
100
- const result = await fetch$1({ ...extraParams, method, url, baseUrl: this.#baseUrl, token: this.#token, fetchImpl: this.#fetch });
104
+ const result = await fetch$1({ ...extraParams, method, url, baseUrl, token: this.#token, fetchImpl: this.#fetch });
101
105
  return result;
102
106
  }
103
107
  }
@@ -1658,125 +1662,135 @@ const extra$1 = {
1658
1662
  };
1659
1663
 
1660
1664
  const getAccount = (variables, signal) => fetch$1({
1661
- url: "/{realm}/account/",
1665
+ url: "/account/",
1662
1666
  method: "get",
1663
1667
  ...variables,
1664
1668
  signal
1665
1669
  });
1666
1670
  const updateAccount = (variables, signal) => fetch$1({
1667
- url: "/{realm}/account/",
1671
+ url: "/account/",
1668
1672
  method: "post",
1669
1673
  ...variables,
1670
1674
  signal
1671
1675
  });
1672
- const getApplications = (variables, signal) => fetch$1({ url: "/{realm}/account/applications", method: "get", ...variables, signal });
1676
+ const getApplications = (variables, signal) => fetch$1({
1677
+ url: "/account/applications",
1678
+ method: "get",
1679
+ ...variables,
1680
+ signal
1681
+ });
1673
1682
  const getConsent = (variables, signal) => fetch$1({
1674
- url: "/{realm}/account/applications/{clientId}/consent",
1683
+ url: "/account/applications/{clientId}/consent",
1675
1684
  method: "get",
1676
1685
  ...variables,
1677
1686
  signal
1678
1687
  });
1679
1688
  const createConsent = (variables, signal) => fetch$1({
1680
- url: "/{realm}/account/applications/{clientId}/consent",
1689
+ url: "/account/applications/{clientId}/consent",
1681
1690
  method: "post",
1682
1691
  ...variables,
1683
1692
  signal
1684
1693
  });
1685
1694
  const updateConsent = (variables, signal) => fetch$1({
1686
- url: "/{realm}/account/applications/{clientId}/consent",
1695
+ url: "/account/applications/{clientId}/consent",
1687
1696
  method: "put",
1688
1697
  ...variables,
1689
1698
  signal
1690
1699
  });
1691
1700
  const deleteConsent = (variables, signal) => fetch$1({
1692
- url: "/{realm}/account/applications/{clientId}/consent",
1701
+ url: "/account/applications/{clientId}/consent",
1693
1702
  method: "delete",
1694
1703
  ...variables,
1695
1704
  signal
1696
1705
  });
1697
- const getCredentials = (variables, signal) => fetch$1({ url: "/{realm}/account/credentials", method: "get", ...variables, signal });
1706
+ const getCredentials = (variables, signal) => fetch$1({
1707
+ url: "/account/credentials",
1708
+ method: "get",
1709
+ ...variables,
1710
+ signal
1711
+ });
1698
1712
  const deleteCredential = (variables, signal) => fetch$1({
1699
- url: "/{realm}/account/credentials/{credentialId}",
1713
+ url: "/account/credentials/{credentialId}",
1700
1714
  method: "delete",
1701
1715
  ...variables,
1702
1716
  signal
1703
1717
  });
1704
1718
  const updateCredentialLabel = (variables, signal) => fetch$1({
1705
- url: "/{realm}/account/credentials/{credentialId}/label",
1719
+ url: "/account/credentials/{credentialId}/label",
1706
1720
  method: "put",
1707
1721
  ...variables,
1708
1722
  signal
1709
1723
  });
1710
1724
  const getSessions = (variables, signal) => fetch$1({
1711
- url: "/{realm}/account/sessions",
1725
+ url: "/account/sessions",
1712
1726
  method: "get",
1713
1727
  ...variables,
1714
1728
  signal
1715
1729
  });
1716
1730
  const deleteCurrentSession = (variables, signal) => fetch$1({
1717
- url: "/{realm}/account/sessions",
1731
+ url: "/account/sessions",
1718
1732
  method: "delete",
1719
1733
  ...variables,
1720
1734
  signal
1721
1735
  });
1722
1736
  const getDevices = (variables, signal) => fetch$1({
1723
- url: "/{realm}/account/sessions/devices",
1737
+ url: "/account/sessions/devices",
1724
1738
  method: "get",
1725
1739
  ...variables,
1726
1740
  signal
1727
1741
  });
1728
1742
  const deleteSession = (variables, signal) => fetch$1({
1729
- url: "/{realm}/account/sessions/{sessionId}",
1743
+ url: "/account/sessions/{sessionId}",
1730
1744
  method: "delete",
1731
1745
  ...variables,
1732
1746
  signal
1733
1747
  });
1734
1748
  const getLinkedAccounts = (variables, signal) => fetch$1({
1735
- url: "/{realm}/account/linked-accounts",
1749
+ url: "/account/linked-accounts",
1736
1750
  method: "get",
1737
1751
  ...variables,
1738
1752
  signal
1739
1753
  });
1740
- const buildLinkingUri = (variables, signal) => fetch$1({ url: "/{realm}/account/linked-accounts/{providerId}", method: "get", ...variables, signal });
1754
+ const buildLinkingUri = (variables, signal) => fetch$1({ url: "/account/linked-accounts/{providerId}", method: "get", ...variables, signal });
1741
1755
  const deleteLinkedProvider = (variables, signal) => fetch$1({
1742
- url: "/{realm}/account/linked-accounts/{providerId}",
1756
+ url: "/account/linked-accounts/{providerId}",
1743
1757
  method: "delete",
1744
1758
  ...variables,
1745
1759
  signal
1746
1760
  });
1747
1761
  const getGroups = (variables, signal) => fetch$1({
1748
- url: "/{realm}/account/groups",
1762
+ url: "/account/groups",
1749
1763
  method: "get",
1750
1764
  ...variables,
1751
1765
  signal
1752
1766
  });
1753
1767
  const getOrganizations = (variables, signal) => fetch$1({
1754
- url: "/{realm}/account/organizations",
1768
+ url: "/account/organizations",
1755
1769
  method: "get",
1756
1770
  ...variables,
1757
1771
  signal
1758
1772
  });
1759
1773
 
1760
1774
  const operationsByPath = {
1761
- "GET /{realm}/account/": getAccount,
1762
- "POST /{realm}/account/": updateAccount,
1763
- "GET /{realm}/account/applications": getApplications,
1764
- "GET /{realm}/account/applications/{clientId}/consent": getConsent,
1765
- "POST /{realm}/account/applications/{clientId}/consent": createConsent,
1766
- "PUT /{realm}/account/applications/{clientId}/consent": updateConsent,
1767
- "DELETE /{realm}/account/applications/{clientId}/consent": deleteConsent,
1768
- "GET /{realm}/account/credentials": getCredentials,
1769
- "DELETE /{realm}/account/credentials/{credentialId}": deleteCredential,
1770
- "PUT /{realm}/account/credentials/{credentialId}/label": updateCredentialLabel,
1771
- "GET /{realm}/account/sessions": getSessions,
1772
- "DELETE /{realm}/account/sessions": deleteCurrentSession,
1773
- "GET /{realm}/account/sessions/devices": getDevices,
1774
- "DELETE /{realm}/account/sessions/{sessionId}": deleteSession,
1775
- "GET /{realm}/account/linked-accounts": getLinkedAccounts,
1776
- "GET /{realm}/account/linked-accounts/{providerId}": buildLinkingUri,
1777
- "DELETE /{realm}/account/linked-accounts/{providerId}": deleteLinkedProvider,
1778
- "GET /{realm}/account/groups": getGroups,
1779
- "GET /{realm}/account/organizations": getOrganizations
1775
+ "GET /account/": getAccount,
1776
+ "POST /account/": updateAccount,
1777
+ "GET /account/applications": getApplications,
1778
+ "GET /account/applications/{clientId}/consent": getConsent,
1779
+ "POST /account/applications/{clientId}/consent": createConsent,
1780
+ "PUT /account/applications/{clientId}/consent": updateConsent,
1781
+ "DELETE /account/applications/{clientId}/consent": deleteConsent,
1782
+ "GET /account/credentials": getCredentials,
1783
+ "DELETE /account/credentials/{credentialId}": deleteCredential,
1784
+ "PUT /account/credentials/{credentialId}/label": updateCredentialLabel,
1785
+ "GET /account/sessions": getSessions,
1786
+ "DELETE /account/sessions": deleteCurrentSession,
1787
+ "GET /account/sessions/devices": getDevices,
1788
+ "DELETE /account/sessions/{sessionId}": deleteSession,
1789
+ "GET /account/linked-accounts": getLinkedAccounts,
1790
+ "GET /account/linked-accounts/{providerId}": buildLinkingUri,
1791
+ "DELETE /account/linked-accounts/{providerId}": deleteLinkedProvider,
1792
+ "GET /account/groups": getGroups,
1793
+ "GET /account/organizations": getOrganizations
1780
1794
  };
1781
1795
 
1782
1796
  const extra = {