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.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +54 -46
- package/dist/index.d.cts +122 -194
- package/dist/index.d.mts +122 -194
- package/dist/index.d.ts +122 -194
- package/dist/index.mjs +54 -46
- package/package.json +1 -1
- package/specs/account.yaml +13 -112
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function notEmpty(value) {
|
|
2
|
-
return value !== null && value !==
|
|
2
|
+
return value !== null && value !== void 0;
|
|
3
3
|
}
|
|
4
4
|
function compactObject(obj) {
|
|
5
5
|
return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
|
|
@@ -85,18 +85,21 @@ class KeycloakAdminApi {
|
|
|
85
85
|
}
|
|
86
86
|
class KeycloakAccountApi {
|
|
87
87
|
#baseUrl;
|
|
88
|
+
#realm;
|
|
88
89
|
#token;
|
|
89
90
|
#fetch;
|
|
90
91
|
constructor(options) {
|
|
91
92
|
this.#baseUrl = options.baseUrl;
|
|
93
|
+
this.#realm = options.realm;
|
|
92
94
|
this.#token = options.token;
|
|
93
95
|
this.#fetch = options.fetch || fetch;
|
|
94
96
|
if (!this.#fetch) throw new Error("Fetch is required");
|
|
95
97
|
}
|
|
96
98
|
async request(endpoint, params) {
|
|
99
|
+
const baseUrl = `${this.#baseUrl}/realms/${this.#realm}`;
|
|
97
100
|
const [method = "", url = ""] = endpoint.split(" ");
|
|
98
101
|
const extraParams = params || {};
|
|
99
|
-
const result = await fetch$1({ ...extraParams, method, url, baseUrl
|
|
102
|
+
const result = await fetch$1({ ...extraParams, method, url, baseUrl, token: this.#token, fetchImpl: this.#fetch });
|
|
100
103
|
return result;
|
|
101
104
|
}
|
|
102
105
|
}
|
|
@@ -1129,12 +1132,7 @@ const getAdminRealmsRealmOrganizationsOrgIdMembersMemberIdOrganizations = (varia
|
|
|
1129
1132
|
signal
|
|
1130
1133
|
});
|
|
1131
1134
|
const postAdminRealmsRealmPartialExport = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/partial-export", method: "post", ...variables, signal });
|
|
1132
|
-
const postAdminRealmsRealmPartialImport = (variables, signal) => fetch$1({
|
|
1133
|
-
url: "/admin/realms/{realm}/partialImport",
|
|
1134
|
-
method: "post",
|
|
1135
|
-
...variables,
|
|
1136
|
-
signal
|
|
1137
|
-
});
|
|
1135
|
+
const postAdminRealmsRealmPartialImport = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/partialImport", method: "post", ...variables, signal });
|
|
1138
1136
|
const postAdminRealmsRealmPushRevocation = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/push-revocation", method: "post", ...variables, signal });
|
|
1139
1137
|
const getAdminRealmsRealmRoles = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/roles", method: "get", ...variables, signal });
|
|
1140
1138
|
const postAdminRealmsRealmRoles = (variables, signal) => fetch$1({ url: "/admin/realms/{realm}/roles", method: "post", ...variables, signal });
|
|
@@ -1657,125 +1655,135 @@ const extra$1 = {
|
|
|
1657
1655
|
};
|
|
1658
1656
|
|
|
1659
1657
|
const getAccount = (variables, signal) => fetch$1({
|
|
1660
|
-
url: "/
|
|
1658
|
+
url: "/account/",
|
|
1661
1659
|
method: "get",
|
|
1662
1660
|
...variables,
|
|
1663
1661
|
signal
|
|
1664
1662
|
});
|
|
1665
1663
|
const updateAccount = (variables, signal) => fetch$1({
|
|
1666
|
-
url: "/
|
|
1664
|
+
url: "/account/",
|
|
1667
1665
|
method: "post",
|
|
1668
1666
|
...variables,
|
|
1669
1667
|
signal
|
|
1670
1668
|
});
|
|
1671
|
-
const getApplications = (variables, signal) => fetch$1({
|
|
1669
|
+
const getApplications = (variables, signal) => fetch$1({
|
|
1670
|
+
url: "/account/applications",
|
|
1671
|
+
method: "get",
|
|
1672
|
+
...variables,
|
|
1673
|
+
signal
|
|
1674
|
+
});
|
|
1672
1675
|
const getConsent = (variables, signal) => fetch$1({
|
|
1673
|
-
url: "/
|
|
1676
|
+
url: "/account/applications/{clientId}/consent",
|
|
1674
1677
|
method: "get",
|
|
1675
1678
|
...variables,
|
|
1676
1679
|
signal
|
|
1677
1680
|
});
|
|
1678
1681
|
const createConsent = (variables, signal) => fetch$1({
|
|
1679
|
-
url: "/
|
|
1682
|
+
url: "/account/applications/{clientId}/consent",
|
|
1680
1683
|
method: "post",
|
|
1681
1684
|
...variables,
|
|
1682
1685
|
signal
|
|
1683
1686
|
});
|
|
1684
1687
|
const updateConsent = (variables, signal) => fetch$1({
|
|
1685
|
-
url: "/
|
|
1688
|
+
url: "/account/applications/{clientId}/consent",
|
|
1686
1689
|
method: "put",
|
|
1687
1690
|
...variables,
|
|
1688
1691
|
signal
|
|
1689
1692
|
});
|
|
1690
1693
|
const deleteConsent = (variables, signal) => fetch$1({
|
|
1691
|
-
url: "/
|
|
1694
|
+
url: "/account/applications/{clientId}/consent",
|
|
1692
1695
|
method: "delete",
|
|
1693
1696
|
...variables,
|
|
1694
1697
|
signal
|
|
1695
1698
|
});
|
|
1696
|
-
const getCredentials = (variables, signal) => fetch$1({
|
|
1699
|
+
const getCredentials = (variables, signal) => fetch$1({
|
|
1700
|
+
url: "/account/credentials",
|
|
1701
|
+
method: "get",
|
|
1702
|
+
...variables,
|
|
1703
|
+
signal
|
|
1704
|
+
});
|
|
1697
1705
|
const deleteCredential = (variables, signal) => fetch$1({
|
|
1698
|
-
url: "/
|
|
1706
|
+
url: "/account/credentials/{credentialId}",
|
|
1699
1707
|
method: "delete",
|
|
1700
1708
|
...variables,
|
|
1701
1709
|
signal
|
|
1702
1710
|
});
|
|
1703
1711
|
const updateCredentialLabel = (variables, signal) => fetch$1({
|
|
1704
|
-
url: "/
|
|
1712
|
+
url: "/account/credentials/{credentialId}/label",
|
|
1705
1713
|
method: "put",
|
|
1706
1714
|
...variables,
|
|
1707
1715
|
signal
|
|
1708
1716
|
});
|
|
1709
1717
|
const getSessions = (variables, signal) => fetch$1({
|
|
1710
|
-
url: "/
|
|
1718
|
+
url: "/account/sessions",
|
|
1711
1719
|
method: "get",
|
|
1712
1720
|
...variables,
|
|
1713
1721
|
signal
|
|
1714
1722
|
});
|
|
1715
1723
|
const deleteCurrentSession = (variables, signal) => fetch$1({
|
|
1716
|
-
url: "/
|
|
1724
|
+
url: "/account/sessions",
|
|
1717
1725
|
method: "delete",
|
|
1718
1726
|
...variables,
|
|
1719
1727
|
signal
|
|
1720
1728
|
});
|
|
1721
1729
|
const getDevices = (variables, signal) => fetch$1({
|
|
1722
|
-
url: "/
|
|
1730
|
+
url: "/account/sessions/devices",
|
|
1723
1731
|
method: "get",
|
|
1724
1732
|
...variables,
|
|
1725
1733
|
signal
|
|
1726
1734
|
});
|
|
1727
1735
|
const deleteSession = (variables, signal) => fetch$1({
|
|
1728
|
-
url: "/
|
|
1736
|
+
url: "/account/sessions/{sessionId}",
|
|
1729
1737
|
method: "delete",
|
|
1730
1738
|
...variables,
|
|
1731
1739
|
signal
|
|
1732
1740
|
});
|
|
1733
1741
|
const getLinkedAccounts = (variables, signal) => fetch$1({
|
|
1734
|
-
url: "/
|
|
1742
|
+
url: "/account/linked-accounts",
|
|
1735
1743
|
method: "get",
|
|
1736
1744
|
...variables,
|
|
1737
1745
|
signal
|
|
1738
1746
|
});
|
|
1739
|
-
const buildLinkingUri = (variables, signal) => fetch$1({ url: "/
|
|
1747
|
+
const buildLinkingUri = (variables, signal) => fetch$1({ url: "/account/linked-accounts/{providerId}", method: "get", ...variables, signal });
|
|
1740
1748
|
const deleteLinkedProvider = (variables, signal) => fetch$1({
|
|
1741
|
-
url: "/
|
|
1749
|
+
url: "/account/linked-accounts/{providerId}",
|
|
1742
1750
|
method: "delete",
|
|
1743
1751
|
...variables,
|
|
1744
1752
|
signal
|
|
1745
1753
|
});
|
|
1746
1754
|
const getGroups = (variables, signal) => fetch$1({
|
|
1747
|
-
url: "/
|
|
1755
|
+
url: "/account/groups",
|
|
1748
1756
|
method: "get",
|
|
1749
1757
|
...variables,
|
|
1750
1758
|
signal
|
|
1751
1759
|
});
|
|
1752
1760
|
const getOrganizations = (variables, signal) => fetch$1({
|
|
1753
|
-
url: "/
|
|
1761
|
+
url: "/account/organizations",
|
|
1754
1762
|
method: "get",
|
|
1755
1763
|
...variables,
|
|
1756
1764
|
signal
|
|
1757
1765
|
});
|
|
1758
1766
|
|
|
1759
1767
|
const operationsByPath = {
|
|
1760
|
-
"GET /
|
|
1761
|
-
"POST /
|
|
1762
|
-
"GET /
|
|
1763
|
-
"GET /
|
|
1764
|
-
"POST /
|
|
1765
|
-
"PUT /
|
|
1766
|
-
"DELETE /
|
|
1767
|
-
"GET /
|
|
1768
|
-
"DELETE /
|
|
1769
|
-
"PUT /
|
|
1770
|
-
"GET /
|
|
1771
|
-
"DELETE /
|
|
1772
|
-
"GET /
|
|
1773
|
-
"DELETE /
|
|
1774
|
-
"GET /
|
|
1775
|
-
"GET /
|
|
1776
|
-
"DELETE /
|
|
1777
|
-
"GET /
|
|
1778
|
-
"GET /
|
|
1768
|
+
"GET /account/": getAccount,
|
|
1769
|
+
"POST /account/": updateAccount,
|
|
1770
|
+
"GET /account/applications": getApplications,
|
|
1771
|
+
"GET /account/applications/{clientId}/consent": getConsent,
|
|
1772
|
+
"POST /account/applications/{clientId}/consent": createConsent,
|
|
1773
|
+
"PUT /account/applications/{clientId}/consent": updateConsent,
|
|
1774
|
+
"DELETE /account/applications/{clientId}/consent": deleteConsent,
|
|
1775
|
+
"GET /account/credentials": getCredentials,
|
|
1776
|
+
"DELETE /account/credentials/{credentialId}": deleteCredential,
|
|
1777
|
+
"PUT /account/credentials/{credentialId}/label": updateCredentialLabel,
|
|
1778
|
+
"GET /account/sessions": getSessions,
|
|
1779
|
+
"DELETE /account/sessions": deleteCurrentSession,
|
|
1780
|
+
"GET /account/sessions/devices": getDevices,
|
|
1781
|
+
"DELETE /account/sessions/{sessionId}": deleteSession,
|
|
1782
|
+
"GET /account/linked-accounts": getLinkedAccounts,
|
|
1783
|
+
"GET /account/linked-accounts/{providerId}": buildLinkingUri,
|
|
1784
|
+
"DELETE /account/linked-accounts/{providerId}": deleteLinkedProvider,
|
|
1785
|
+
"GET /account/groups": getGroups,
|
|
1786
|
+
"GET /account/organizations": getOrganizations
|
|
1779
1787
|
};
|
|
1780
1788
|
|
|
1781
1789
|
const extra = {
|
package/package.json
CHANGED
package/specs/account.yaml
CHANGED
|
@@ -259,15 +259,7 @@ components:
|
|
|
259
259
|
security:
|
|
260
260
|
- access_token: []
|
|
261
261
|
paths:
|
|
262
|
-
/
|
|
263
|
-
parameters:
|
|
264
|
-
- in: path
|
|
265
|
-
name: realm
|
|
266
|
-
description: realm name
|
|
267
|
-
required: true
|
|
268
|
-
schema:
|
|
269
|
-
type: string
|
|
270
|
-
style: simple
|
|
262
|
+
/account/:
|
|
271
263
|
get:
|
|
272
264
|
tags:
|
|
273
265
|
- Account
|
|
@@ -300,15 +292,7 @@ paths:
|
|
|
300
292
|
responses:
|
|
301
293
|
204:
|
|
302
294
|
description: success
|
|
303
|
-
/
|
|
304
|
-
parameters:
|
|
305
|
-
- in: path
|
|
306
|
-
name: realm
|
|
307
|
-
description: realm name
|
|
308
|
-
required: true
|
|
309
|
-
schema:
|
|
310
|
-
type: string
|
|
311
|
-
style: simple
|
|
295
|
+
/account/applications:
|
|
312
296
|
get:
|
|
313
297
|
parameters:
|
|
314
298
|
- name: name
|
|
@@ -328,15 +312,8 @@ paths:
|
|
|
328
312
|
type: array
|
|
329
313
|
items:
|
|
330
314
|
$ref: '#/components/schemas/ClientRepresentation'
|
|
331
|
-
/
|
|
315
|
+
/account/applications/{clientId}/consent:
|
|
332
316
|
parameters:
|
|
333
|
-
- in: path
|
|
334
|
-
name: realm
|
|
335
|
-
description: realm name
|
|
336
|
-
required: true
|
|
337
|
-
schema:
|
|
338
|
-
type: string
|
|
339
|
-
style: simple
|
|
340
317
|
- in: path
|
|
341
318
|
name: clientId
|
|
342
319
|
description: client id
|
|
@@ -388,15 +365,7 @@ paths:
|
|
|
388
365
|
responses:
|
|
389
366
|
204:
|
|
390
367
|
description: Deleted
|
|
391
|
-
/
|
|
392
|
-
parameters:
|
|
393
|
-
- in: path
|
|
394
|
-
name: realm
|
|
395
|
-
description: realm name
|
|
396
|
-
required: true
|
|
397
|
-
schema:
|
|
398
|
-
type: string
|
|
399
|
-
style: simple
|
|
368
|
+
/account/credentials:
|
|
400
369
|
get:
|
|
401
370
|
tags:
|
|
402
371
|
- Account
|
|
@@ -421,15 +390,8 @@ paths:
|
|
|
421
390
|
type: array
|
|
422
391
|
items:
|
|
423
392
|
$ref: '#/components/schemas/CredentialRepresentation'
|
|
424
|
-
/
|
|
393
|
+
/account/credentials/{credentialId}:
|
|
425
394
|
parameters:
|
|
426
|
-
- in: path
|
|
427
|
-
name: realm
|
|
428
|
-
description: realm name
|
|
429
|
-
required: true
|
|
430
|
-
schema:
|
|
431
|
-
type: string
|
|
432
|
-
style: simple
|
|
433
395
|
- in: path
|
|
434
396
|
name: credentialId
|
|
435
397
|
description: Credential ID
|
|
@@ -445,15 +407,8 @@ paths:
|
|
|
445
407
|
responses:
|
|
446
408
|
204:
|
|
447
409
|
description: success
|
|
448
|
-
/
|
|
410
|
+
/account/credentials/{credentialId}/label:
|
|
449
411
|
parameters:
|
|
450
|
-
- in: path
|
|
451
|
-
name: realm
|
|
452
|
-
description: realm name
|
|
453
|
-
required: true
|
|
454
|
-
schema:
|
|
455
|
-
type: string
|
|
456
|
-
style: simple
|
|
457
412
|
- in: path
|
|
458
413
|
name: credentialId
|
|
459
414
|
description: Credential ID
|
|
@@ -474,15 +429,7 @@ paths:
|
|
|
474
429
|
responses:
|
|
475
430
|
204:
|
|
476
431
|
description: No Content
|
|
477
|
-
/
|
|
478
|
-
parameters:
|
|
479
|
-
- in: path
|
|
480
|
-
name: realm
|
|
481
|
-
description: realm name
|
|
482
|
-
required: true
|
|
483
|
-
schema:
|
|
484
|
-
type: string
|
|
485
|
-
style: simple
|
|
432
|
+
/account/sessions:
|
|
486
433
|
get:
|
|
487
434
|
tags:
|
|
488
435
|
- Account
|
|
@@ -506,15 +453,7 @@ paths:
|
|
|
506
453
|
responses:
|
|
507
454
|
204:
|
|
508
455
|
description: success
|
|
509
|
-
/
|
|
510
|
-
parameters:
|
|
511
|
-
- in: path
|
|
512
|
-
name: realm
|
|
513
|
-
description: realm name
|
|
514
|
-
required: true
|
|
515
|
-
schema:
|
|
516
|
-
type: string
|
|
517
|
-
style: simple
|
|
456
|
+
/account/sessions/devices:
|
|
518
457
|
get:
|
|
519
458
|
tags:
|
|
520
459
|
- Account
|
|
@@ -530,15 +469,8 @@ paths:
|
|
|
530
469
|
type: array
|
|
531
470
|
items:
|
|
532
471
|
$ref: '#/components/schemas/DeviceRepresentation'
|
|
533
|
-
/
|
|
472
|
+
/account/sessions/{sessionId}:
|
|
534
473
|
parameters:
|
|
535
|
-
- in: path
|
|
536
|
-
name: realm
|
|
537
|
-
description: realm name
|
|
538
|
-
required: true
|
|
539
|
-
schema:
|
|
540
|
-
type: string
|
|
541
|
-
style: simple
|
|
542
474
|
- in: path
|
|
543
475
|
name: sessionId
|
|
544
476
|
description: Session ID
|
|
@@ -554,15 +486,7 @@ paths:
|
|
|
554
486
|
responses:
|
|
555
487
|
204:
|
|
556
488
|
description: success
|
|
557
|
-
/
|
|
558
|
-
parameters:
|
|
559
|
-
- in: path
|
|
560
|
-
name: realm
|
|
561
|
-
description: realm name
|
|
562
|
-
required: true
|
|
563
|
-
schema:
|
|
564
|
-
type: string
|
|
565
|
-
style: simple
|
|
489
|
+
/account/linked-accounts:
|
|
566
490
|
get:
|
|
567
491
|
tags:
|
|
568
492
|
- Account
|
|
@@ -578,15 +502,8 @@ paths:
|
|
|
578
502
|
type: array
|
|
579
503
|
items:
|
|
580
504
|
$ref: '#/components/schemas/LinkedAccountRepresentation'
|
|
581
|
-
/
|
|
505
|
+
/account/linked-accounts/{providerId}:
|
|
582
506
|
parameters:
|
|
583
|
-
- in: path
|
|
584
|
-
name: realm
|
|
585
|
-
description: realm name
|
|
586
|
-
required: true
|
|
587
|
-
schema:
|
|
588
|
-
type: string
|
|
589
|
-
style: simple
|
|
590
507
|
- in: path
|
|
591
508
|
name: providerId
|
|
592
509
|
description: Provider ID
|
|
@@ -622,15 +539,7 @@ paths:
|
|
|
622
539
|
responses:
|
|
623
540
|
204:
|
|
624
541
|
description: success
|
|
625
|
-
/
|
|
626
|
-
parameters:
|
|
627
|
-
- in: path
|
|
628
|
-
name: realm
|
|
629
|
-
description: realm name
|
|
630
|
-
required: true
|
|
631
|
-
schema:
|
|
632
|
-
type: string
|
|
633
|
-
style: simple
|
|
542
|
+
/account/groups:
|
|
634
543
|
get:
|
|
635
544
|
parameters:
|
|
636
545
|
- name: briefRepresentation
|
|
@@ -651,15 +560,7 @@ paths:
|
|
|
651
560
|
type: array
|
|
652
561
|
items:
|
|
653
562
|
$ref: '#/components/schemas/GroupRepresentation'
|
|
654
|
-
/
|
|
655
|
-
parameters:
|
|
656
|
-
- in: path
|
|
657
|
-
name: realm
|
|
658
|
-
description: realm name
|
|
659
|
-
required: true
|
|
660
|
-
schema:
|
|
661
|
-
type: string
|
|
662
|
-
style: simple
|
|
563
|
+
/account/organizations:
|
|
663
564
|
get:
|
|
664
565
|
tags:
|
|
665
566
|
- Account
|