keycloak-api 0.2.2 → 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.2 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,11 @@
1
1
  # keycloak-api
2
2
 
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - e9199f6: Remove realm from account pathParams
8
+
3
9
  ## 0.2.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -87,18 +87,21 @@ class KeycloakAdminApi {
87
87
  }
88
88
  class KeycloakAccountApi {
89
89
  #baseUrl;
90
+ #realm;
90
91
  #token;
91
92
  #fetch;
92
93
  constructor(options) {
93
94
  this.#baseUrl = options.baseUrl;
95
+ this.#realm = options.realm;
94
96
  this.#token = options.token;
95
97
  this.#fetch = options.fetch || fetch;
96
98
  if (!this.#fetch) throw new Error("Fetch is required");
97
99
  }
98
100
  async request(endpoint, params) {
101
+ const baseUrl = `${this.#baseUrl}/realms/${this.#realm}`;
99
102
  const [method = "", url = ""] = endpoint.split(" ");
100
103
  const extraParams = params || {};
101
- 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 });
102
105
  return result;
103
106
  }
104
107
  }
@@ -1659,125 +1662,135 @@ const extra$1 = {
1659
1662
  };
1660
1663
 
1661
1664
  const getAccount = (variables, signal) => fetch$1({
1662
- url: "/{realm}/account/",
1665
+ url: "/account/",
1663
1666
  method: "get",
1664
1667
  ...variables,
1665
1668
  signal
1666
1669
  });
1667
1670
  const updateAccount = (variables, signal) => fetch$1({
1668
- url: "/{realm}/account/",
1671
+ url: "/account/",
1669
1672
  method: "post",
1670
1673
  ...variables,
1671
1674
  signal
1672
1675
  });
1673
- 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
+ });
1674
1682
  const getConsent = (variables, signal) => fetch$1({
1675
- url: "/{realm}/account/applications/{clientId}/consent",
1683
+ url: "/account/applications/{clientId}/consent",
1676
1684
  method: "get",
1677
1685
  ...variables,
1678
1686
  signal
1679
1687
  });
1680
1688
  const createConsent = (variables, signal) => fetch$1({
1681
- url: "/{realm}/account/applications/{clientId}/consent",
1689
+ url: "/account/applications/{clientId}/consent",
1682
1690
  method: "post",
1683
1691
  ...variables,
1684
1692
  signal
1685
1693
  });
1686
1694
  const updateConsent = (variables, signal) => fetch$1({
1687
- url: "/{realm}/account/applications/{clientId}/consent",
1695
+ url: "/account/applications/{clientId}/consent",
1688
1696
  method: "put",
1689
1697
  ...variables,
1690
1698
  signal
1691
1699
  });
1692
1700
  const deleteConsent = (variables, signal) => fetch$1({
1693
- url: "/{realm}/account/applications/{clientId}/consent",
1701
+ url: "/account/applications/{clientId}/consent",
1694
1702
  method: "delete",
1695
1703
  ...variables,
1696
1704
  signal
1697
1705
  });
1698
- 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
+ });
1699
1712
  const deleteCredential = (variables, signal) => fetch$1({
1700
- url: "/{realm}/account/credentials/{credentialId}",
1713
+ url: "/account/credentials/{credentialId}",
1701
1714
  method: "delete",
1702
1715
  ...variables,
1703
1716
  signal
1704
1717
  });
1705
1718
  const updateCredentialLabel = (variables, signal) => fetch$1({
1706
- url: "/{realm}/account/credentials/{credentialId}/label",
1719
+ url: "/account/credentials/{credentialId}/label",
1707
1720
  method: "put",
1708
1721
  ...variables,
1709
1722
  signal
1710
1723
  });
1711
1724
  const getSessions = (variables, signal) => fetch$1({
1712
- url: "/{realm}/account/sessions",
1725
+ url: "/account/sessions",
1713
1726
  method: "get",
1714
1727
  ...variables,
1715
1728
  signal
1716
1729
  });
1717
1730
  const deleteCurrentSession = (variables, signal) => fetch$1({
1718
- url: "/{realm}/account/sessions",
1731
+ url: "/account/sessions",
1719
1732
  method: "delete",
1720
1733
  ...variables,
1721
1734
  signal
1722
1735
  });
1723
1736
  const getDevices = (variables, signal) => fetch$1({
1724
- url: "/{realm}/account/sessions/devices",
1737
+ url: "/account/sessions/devices",
1725
1738
  method: "get",
1726
1739
  ...variables,
1727
1740
  signal
1728
1741
  });
1729
1742
  const deleteSession = (variables, signal) => fetch$1({
1730
- url: "/{realm}/account/sessions/{sessionId}",
1743
+ url: "/account/sessions/{sessionId}",
1731
1744
  method: "delete",
1732
1745
  ...variables,
1733
1746
  signal
1734
1747
  });
1735
1748
  const getLinkedAccounts = (variables, signal) => fetch$1({
1736
- url: "/{realm}/account/linked-accounts",
1749
+ url: "/account/linked-accounts",
1737
1750
  method: "get",
1738
1751
  ...variables,
1739
1752
  signal
1740
1753
  });
1741
- 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 });
1742
1755
  const deleteLinkedProvider = (variables, signal) => fetch$1({
1743
- url: "/{realm}/account/linked-accounts/{providerId}",
1756
+ url: "/account/linked-accounts/{providerId}",
1744
1757
  method: "delete",
1745
1758
  ...variables,
1746
1759
  signal
1747
1760
  });
1748
1761
  const getGroups = (variables, signal) => fetch$1({
1749
- url: "/{realm}/account/groups",
1762
+ url: "/account/groups",
1750
1763
  method: "get",
1751
1764
  ...variables,
1752
1765
  signal
1753
1766
  });
1754
1767
  const getOrganizations = (variables, signal) => fetch$1({
1755
- url: "/{realm}/account/organizations",
1768
+ url: "/account/organizations",
1756
1769
  method: "get",
1757
1770
  ...variables,
1758
1771
  signal
1759
1772
  });
1760
1773
 
1761
1774
  const operationsByPath = {
1762
- "GET /{realm}/account/": getAccount,
1763
- "POST /{realm}/account/": updateAccount,
1764
- "GET /{realm}/account/applications": getApplications,
1765
- "GET /{realm}/account/applications/{clientId}/consent": getConsent,
1766
- "POST /{realm}/account/applications/{clientId}/consent": createConsent,
1767
- "PUT /{realm}/account/applications/{clientId}/consent": updateConsent,
1768
- "DELETE /{realm}/account/applications/{clientId}/consent": deleteConsent,
1769
- "GET /{realm}/account/credentials": getCredentials,
1770
- "DELETE /{realm}/account/credentials/{credentialId}": deleteCredential,
1771
- "PUT /{realm}/account/credentials/{credentialId}/label": updateCredentialLabel,
1772
- "GET /{realm}/account/sessions": getSessions,
1773
- "DELETE /{realm}/account/sessions": deleteCurrentSession,
1774
- "GET /{realm}/account/sessions/devices": getDevices,
1775
- "DELETE /{realm}/account/sessions/{sessionId}": deleteSession,
1776
- "GET /{realm}/account/linked-accounts": getLinkedAccounts,
1777
- "GET /{realm}/account/linked-accounts/{providerId}": buildLinkingUri,
1778
- "DELETE /{realm}/account/linked-accounts/{providerId}": deleteLinkedProvider,
1779
- "GET /{realm}/account/groups": getGroups,
1780
- "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
1781
1794
  };
1782
1795
 
1783
1796
  const extra = {