keycloak-api 0.0.0 → 0.2.0
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.
- package/.turbo/turbo-build.log +14 -24
- package/CHANGELOG.md +13 -0
- package/dist/index.cjs +21 -3
- package/dist/index.d.cts +904 -248
- package/dist/index.d.mts +904 -248
- package/dist/index.d.ts +904 -248
- package/dist/index.mjs +20 -3
- package/package.json +7 -12
- package/specs/account.yaml +677 -0
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function notEmpty(value) {
|
|
2
|
-
return value !== null && value !==
|
|
2
|
+
return value !== null && value !== undefined;
|
|
3
3
|
}
|
|
4
4
|
function compactObject(obj) {
|
|
5
5
|
return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
|
|
@@ -65,7 +65,24 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
|
65
65
|
return url.replace(/\{\w*\}/g, (key) => pathParams[key.slice(1, -1)] ?? "") + query;
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
class
|
|
68
|
+
class KeycloakAdminApi {
|
|
69
|
+
#baseUrl;
|
|
70
|
+
#token;
|
|
71
|
+
#fetch;
|
|
72
|
+
constructor(options) {
|
|
73
|
+
this.#baseUrl = options.baseUrl;
|
|
74
|
+
this.#token = options.token;
|
|
75
|
+
this.#fetch = options.fetch || fetch;
|
|
76
|
+
if (!this.#fetch) throw new Error("Fetch is required");
|
|
77
|
+
}
|
|
78
|
+
async request(endpoint, params) {
|
|
79
|
+
const [method = "", url = ""] = endpoint.split(" ");
|
|
80
|
+
const extraParams = params || {};
|
|
81
|
+
const result = await fetch$1({ ...extraParams, method, url, baseUrl: this.#baseUrl, token: this.#token, fetchImpl: this.#fetch });
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
class KeycloakAccountApi {
|
|
69
86
|
#baseUrl;
|
|
70
87
|
#token;
|
|
71
88
|
#fetch;
|
|
@@ -83,4 +100,4 @@ class KeycloakApi {
|
|
|
83
100
|
}
|
|
84
101
|
}
|
|
85
102
|
|
|
86
|
-
export {
|
|
103
|
+
export { KeycloakAccountApi, KeycloakAdminApi };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keycloak-api",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "keycloak API client
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "keycloak auto-generated type-safe API client",
|
|
5
5
|
"author": "SferaDev",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"bugs": {
|
|
@@ -24,18 +24,13 @@
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"tsc": "tsc --noEmit",
|
|
29
|
-
"build": "unbuild",
|
|
30
|
-
"prepack": "unbuild",
|
|
31
|
-
"generate": "openapi-codegen admin"
|
|
32
|
-
},
|
|
33
27
|
"repository": {
|
|
34
28
|
"type": "git",
|
|
35
29
|
"url": "git+https://github.com/SferaDev/openapi-clients.git"
|
|
36
30
|
},
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
31
|
+
"scripts": {
|
|
32
|
+
"tsc": "tsc --noEmit",
|
|
33
|
+
"build": "unbuild",
|
|
34
|
+
"generate": "openapi-codegen admin && openapi-codegen account"
|
|
40
35
|
}
|
|
41
|
-
}
|
|
36
|
+
}
|