keycloak-api 0.2.2 → 0.2.4

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.4 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.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 0ffd14e: Add new query parameters 'direction', 'resourceType', and 'audience' to several endpoint definitions
8
+
9
+ ## 0.2.3
10
+
11
+ ### Patch Changes
12
+
13
+ - e9199f6: Remove realm from account pathParams
14
+
3
15
  ## 0.2.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  function notEmpty(value) {
4
- return value !== null && value !== undefined;
4
+ return value !== null && value !== void 0;
5
5
  }
6
6
  function compactObject(obj) {
7
7
  return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
@@ -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
  }
@@ -1131,12 +1134,7 @@ const getAdminRealmsRealmOrganizationsOrgIdMembersMemberIdOrganizations = (varia
1131
1134
  signal
1132
1135
  });
1133
1136
  const postAdminRealmsRealmPartialExport = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/partial-export", method: "post", ...variables, signal });
1134
- const postAdminRealmsRealmPartialImport = (variables, signal) => fetch$1({
1135
- url: "/admin/realms/{realm}/partialImport",
1136
- method: "post",
1137
- ...variables,
1138
- signal
1139
- });
1137
+ const postAdminRealmsRealmPartialImport = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/partialImport", method: "post", ...variables, signal });
1140
1138
  const postAdminRealmsRealmPushRevocation = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/push-revocation", method: "post", ...variables, signal });
1141
1139
  const getAdminRealmsRealmRoles = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/roles", method: "get", ...variables, signal });
1142
1140
  const postAdminRealmsRealmRoles = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/roles", method: "post", ...variables, signal });
@@ -1659,125 +1657,135 @@ const extra$1 = {
1659
1657
  };
1660
1658
 
1661
1659
  const getAccount = (variables, signal) => fetch$1({
1662
- url: "/{realm}/account/",
1660
+ url: "/account/",
1663
1661
  method: "get",
1664
1662
  ...variables,
1665
1663
  signal
1666
1664
  });
1667
1665
  const updateAccount = (variables, signal) => fetch$1({
1668
- url: "/{realm}/account/",
1666
+ url: "/account/",
1669
1667
  method: "post",
1670
1668
  ...variables,
1671
1669
  signal
1672
1670
  });
1673
- const getApplications = (variables, signal) => fetch$1({ url: "/{realm}/account/applications", method: "get", ...variables, signal });
1671
+ const getApplications = (variables, signal) => fetch$1({
1672
+ url: "/account/applications",
1673
+ method: "get",
1674
+ ...variables,
1675
+ signal
1676
+ });
1674
1677
  const getConsent = (variables, signal) => fetch$1({
1675
- url: "/{realm}/account/applications/{clientId}/consent",
1678
+ url: "/account/applications/{clientId}/consent",
1676
1679
  method: "get",
1677
1680
  ...variables,
1678
1681
  signal
1679
1682
  });
1680
1683
  const createConsent = (variables, signal) => fetch$1({
1681
- url: "/{realm}/account/applications/{clientId}/consent",
1684
+ url: "/account/applications/{clientId}/consent",
1682
1685
  method: "post",
1683
1686
  ...variables,
1684
1687
  signal
1685
1688
  });
1686
1689
  const updateConsent = (variables, signal) => fetch$1({
1687
- url: "/{realm}/account/applications/{clientId}/consent",
1690
+ url: "/account/applications/{clientId}/consent",
1688
1691
  method: "put",
1689
1692
  ...variables,
1690
1693
  signal
1691
1694
  });
1692
1695
  const deleteConsent = (variables, signal) => fetch$1({
1693
- url: "/{realm}/account/applications/{clientId}/consent",
1696
+ url: "/account/applications/{clientId}/consent",
1694
1697
  method: "delete",
1695
1698
  ...variables,
1696
1699
  signal
1697
1700
  });
1698
- const getCredentials = (variables, signal) => fetch$1({ url: "/{realm}/account/credentials", method: "get", ...variables, signal });
1701
+ const getCredentials = (variables, signal) => fetch$1({
1702
+ url: "/account/credentials",
1703
+ method: "get",
1704
+ ...variables,
1705
+ signal
1706
+ });
1699
1707
  const deleteCredential = (variables, signal) => fetch$1({
1700
- url: "/{realm}/account/credentials/{credentialId}",
1708
+ url: "/account/credentials/{credentialId}",
1701
1709
  method: "delete",
1702
1710
  ...variables,
1703
1711
  signal
1704
1712
  });
1705
1713
  const updateCredentialLabel = (variables, signal) => fetch$1({
1706
- url: "/{realm}/account/credentials/{credentialId}/label",
1714
+ url: "/account/credentials/{credentialId}/label",
1707
1715
  method: "put",
1708
1716
  ...variables,
1709
1717
  signal
1710
1718
  });
1711
1719
  const getSessions = (variables, signal) => fetch$1({
1712
- url: "/{realm}/account/sessions",
1720
+ url: "/account/sessions",
1713
1721
  method: "get",
1714
1722
  ...variables,
1715
1723
  signal
1716
1724
  });
1717
1725
  const deleteCurrentSession = (variables, signal) => fetch$1({
1718
- url: "/{realm}/account/sessions",
1726
+ url: "/account/sessions",
1719
1727
  method: "delete",
1720
1728
  ...variables,
1721
1729
  signal
1722
1730
  });
1723
1731
  const getDevices = (variables, signal) => fetch$1({
1724
- url: "/{realm}/account/sessions/devices",
1732
+ url: "/account/sessions/devices",
1725
1733
  method: "get",
1726
1734
  ...variables,
1727
1735
  signal
1728
1736
  });
1729
1737
  const deleteSession = (variables, signal) => fetch$1({
1730
- url: "/{realm}/account/sessions/{sessionId}",
1738
+ url: "/account/sessions/{sessionId}",
1731
1739
  method: "delete",
1732
1740
  ...variables,
1733
1741
  signal
1734
1742
  });
1735
1743
  const getLinkedAccounts = (variables, signal) => fetch$1({
1736
- url: "/{realm}/account/linked-accounts",
1744
+ url: "/account/linked-accounts",
1737
1745
  method: "get",
1738
1746
  ...variables,
1739
1747
  signal
1740
1748
  });
1741
- const buildLinkingUri = (variables, signal) => fetch$1({ url: "/{realm}/account/linked-accounts/{providerId}", method: "get", ...variables, signal });
1749
+ const buildLinkingUri = (variables, signal) => fetch$1({ url: "/account/linked-accounts/{providerId}", method: "get", ...variables, signal });
1742
1750
  const deleteLinkedProvider = (variables, signal) => fetch$1({
1743
- url: "/{realm}/account/linked-accounts/{providerId}",
1751
+ url: "/account/linked-accounts/{providerId}",
1744
1752
  method: "delete",
1745
1753
  ...variables,
1746
1754
  signal
1747
1755
  });
1748
1756
  const getGroups = (variables, signal) => fetch$1({
1749
- url: "/{realm}/account/groups",
1757
+ url: "/account/groups",
1750
1758
  method: "get",
1751
1759
  ...variables,
1752
1760
  signal
1753
1761
  });
1754
1762
  const getOrganizations = (variables, signal) => fetch$1({
1755
- url: "/{realm}/account/organizations",
1763
+ url: "/account/organizations",
1756
1764
  method: "get",
1757
1765
  ...variables,
1758
1766
  signal
1759
1767
  });
1760
1768
 
1761
1769
  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
1770
+ "GET /account/": getAccount,
1771
+ "POST /account/": updateAccount,
1772
+ "GET /account/applications": getApplications,
1773
+ "GET /account/applications/{clientId}/consent": getConsent,
1774
+ "POST /account/applications/{clientId}/consent": createConsent,
1775
+ "PUT /account/applications/{clientId}/consent": updateConsent,
1776
+ "DELETE /account/applications/{clientId}/consent": deleteConsent,
1777
+ "GET /account/credentials": getCredentials,
1778
+ "DELETE /account/credentials/{credentialId}": deleteCredential,
1779
+ "PUT /account/credentials/{credentialId}/label": updateCredentialLabel,
1780
+ "GET /account/sessions": getSessions,
1781
+ "DELETE /account/sessions": deleteCurrentSession,
1782
+ "GET /account/sessions/devices": getDevices,
1783
+ "DELETE /account/sessions/{sessionId}": deleteSession,
1784
+ "GET /account/linked-accounts": getLinkedAccounts,
1785
+ "GET /account/linked-accounts/{providerId}": buildLinkingUri,
1786
+ "DELETE /account/linked-accounts/{providerId}": deleteLinkedProvider,
1787
+ "GET /account/groups": getGroups,
1788
+ "GET /account/organizations": getOrganizations
1781
1789
  };
1782
1790
 
1783
1791
  const extra = {