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.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +53 -39
- package/dist/index.d.cts +54 -169
- package/dist/index.d.mts +54 -169
- package/dist/index.d.ts +54 -169
- package/dist/index.mjs +53 -39
- package/package.json +1 -1
- package/specs/account.yaml +13 -112
package/dist/index.mjs
CHANGED
|
@@ -21,6 +21,7 @@ async function fetch$1({
|
|
|
21
21
|
const requestHeaders = compactObject({
|
|
22
22
|
"Content-Type": "application/json",
|
|
23
23
|
Authorization: token ? `Bearer ${token}` : void 0,
|
|
24
|
+
Accept: "application/json",
|
|
24
25
|
...headers
|
|
25
26
|
});
|
|
26
27
|
if (requestHeaders["Content-Type"]?.toLowerCase().includes("multipart/form-data")) {
|
|
@@ -84,18 +85,21 @@ class KeycloakAdminApi {
|
|
|
84
85
|
}
|
|
85
86
|
class KeycloakAccountApi {
|
|
86
87
|
#baseUrl;
|
|
88
|
+
#realm;
|
|
87
89
|
#token;
|
|
88
90
|
#fetch;
|
|
89
91
|
constructor(options) {
|
|
90
92
|
this.#baseUrl = options.baseUrl;
|
|
93
|
+
this.#realm = options.realm;
|
|
91
94
|
this.#token = options.token;
|
|
92
95
|
this.#fetch = options.fetch || fetch;
|
|
93
96
|
if (!this.#fetch) throw new Error("Fetch is required");
|
|
94
97
|
}
|
|
95
98
|
async request(endpoint, params) {
|
|
99
|
+
const baseUrl = `${this.#baseUrl}/realms/${this.#realm}`;
|
|
96
100
|
const [method = "", url = ""] = endpoint.split(" ");
|
|
97
101
|
const extraParams = params || {};
|
|
98
|
-
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 });
|
|
99
103
|
return result;
|
|
100
104
|
}
|
|
101
105
|
}
|
|
@@ -1656,125 +1660,135 @@ const extra$1 = {
|
|
|
1656
1660
|
};
|
|
1657
1661
|
|
|
1658
1662
|
const getAccount = (variables, signal) => fetch$1({
|
|
1659
|
-
url: "/
|
|
1663
|
+
url: "/account/",
|
|
1660
1664
|
method: "get",
|
|
1661
1665
|
...variables,
|
|
1662
1666
|
signal
|
|
1663
1667
|
});
|
|
1664
1668
|
const updateAccount = (variables, signal) => fetch$1({
|
|
1665
|
-
url: "/
|
|
1669
|
+
url: "/account/",
|
|
1666
1670
|
method: "post",
|
|
1667
1671
|
...variables,
|
|
1668
1672
|
signal
|
|
1669
1673
|
});
|
|
1670
|
-
const getApplications = (variables, signal) => fetch$1({
|
|
1674
|
+
const getApplications = (variables, signal) => fetch$1({
|
|
1675
|
+
url: "/account/applications",
|
|
1676
|
+
method: "get",
|
|
1677
|
+
...variables,
|
|
1678
|
+
signal
|
|
1679
|
+
});
|
|
1671
1680
|
const getConsent = (variables, signal) => fetch$1({
|
|
1672
|
-
url: "/
|
|
1681
|
+
url: "/account/applications/{clientId}/consent",
|
|
1673
1682
|
method: "get",
|
|
1674
1683
|
...variables,
|
|
1675
1684
|
signal
|
|
1676
1685
|
});
|
|
1677
1686
|
const createConsent = (variables, signal) => fetch$1({
|
|
1678
|
-
url: "/
|
|
1687
|
+
url: "/account/applications/{clientId}/consent",
|
|
1679
1688
|
method: "post",
|
|
1680
1689
|
...variables,
|
|
1681
1690
|
signal
|
|
1682
1691
|
});
|
|
1683
1692
|
const updateConsent = (variables, signal) => fetch$1({
|
|
1684
|
-
url: "/
|
|
1693
|
+
url: "/account/applications/{clientId}/consent",
|
|
1685
1694
|
method: "put",
|
|
1686
1695
|
...variables,
|
|
1687
1696
|
signal
|
|
1688
1697
|
});
|
|
1689
1698
|
const deleteConsent = (variables, signal) => fetch$1({
|
|
1690
|
-
url: "/
|
|
1699
|
+
url: "/account/applications/{clientId}/consent",
|
|
1691
1700
|
method: "delete",
|
|
1692
1701
|
...variables,
|
|
1693
1702
|
signal
|
|
1694
1703
|
});
|
|
1695
|
-
const getCredentials = (variables, signal) => fetch$1({
|
|
1704
|
+
const getCredentials = (variables, signal) => fetch$1({
|
|
1705
|
+
url: "/account/credentials",
|
|
1706
|
+
method: "get",
|
|
1707
|
+
...variables,
|
|
1708
|
+
signal
|
|
1709
|
+
});
|
|
1696
1710
|
const deleteCredential = (variables, signal) => fetch$1({
|
|
1697
|
-
url: "/
|
|
1711
|
+
url: "/account/credentials/{credentialId}",
|
|
1698
1712
|
method: "delete",
|
|
1699
1713
|
...variables,
|
|
1700
1714
|
signal
|
|
1701
1715
|
});
|
|
1702
1716
|
const updateCredentialLabel = (variables, signal) => fetch$1({
|
|
1703
|
-
url: "/
|
|
1717
|
+
url: "/account/credentials/{credentialId}/label",
|
|
1704
1718
|
method: "put",
|
|
1705
1719
|
...variables,
|
|
1706
1720
|
signal
|
|
1707
1721
|
});
|
|
1708
1722
|
const getSessions = (variables, signal) => fetch$1({
|
|
1709
|
-
url: "/
|
|
1723
|
+
url: "/account/sessions",
|
|
1710
1724
|
method: "get",
|
|
1711
1725
|
...variables,
|
|
1712
1726
|
signal
|
|
1713
1727
|
});
|
|
1714
1728
|
const deleteCurrentSession = (variables, signal) => fetch$1({
|
|
1715
|
-
url: "/
|
|
1729
|
+
url: "/account/sessions",
|
|
1716
1730
|
method: "delete",
|
|
1717
1731
|
...variables,
|
|
1718
1732
|
signal
|
|
1719
1733
|
});
|
|
1720
1734
|
const getDevices = (variables, signal) => fetch$1({
|
|
1721
|
-
url: "/
|
|
1735
|
+
url: "/account/sessions/devices",
|
|
1722
1736
|
method: "get",
|
|
1723
1737
|
...variables,
|
|
1724
1738
|
signal
|
|
1725
1739
|
});
|
|
1726
1740
|
const deleteSession = (variables, signal) => fetch$1({
|
|
1727
|
-
url: "/
|
|
1741
|
+
url: "/account/sessions/{sessionId}",
|
|
1728
1742
|
method: "delete",
|
|
1729
1743
|
...variables,
|
|
1730
1744
|
signal
|
|
1731
1745
|
});
|
|
1732
1746
|
const getLinkedAccounts = (variables, signal) => fetch$1({
|
|
1733
|
-
url: "/
|
|
1747
|
+
url: "/account/linked-accounts",
|
|
1734
1748
|
method: "get",
|
|
1735
1749
|
...variables,
|
|
1736
1750
|
signal
|
|
1737
1751
|
});
|
|
1738
|
-
const buildLinkingUri = (variables, signal) => fetch$1({ url: "/
|
|
1752
|
+
const buildLinkingUri = (variables, signal) => fetch$1({ url: "/account/linked-accounts/{providerId}", method: "get", ...variables, signal });
|
|
1739
1753
|
const deleteLinkedProvider = (variables, signal) => fetch$1({
|
|
1740
|
-
url: "/
|
|
1754
|
+
url: "/account/linked-accounts/{providerId}",
|
|
1741
1755
|
method: "delete",
|
|
1742
1756
|
...variables,
|
|
1743
1757
|
signal
|
|
1744
1758
|
});
|
|
1745
1759
|
const getGroups = (variables, signal) => fetch$1({
|
|
1746
|
-
url: "/
|
|
1760
|
+
url: "/account/groups",
|
|
1747
1761
|
method: "get",
|
|
1748
1762
|
...variables,
|
|
1749
1763
|
signal
|
|
1750
1764
|
});
|
|
1751
1765
|
const getOrganizations = (variables, signal) => fetch$1({
|
|
1752
|
-
url: "/
|
|
1766
|
+
url: "/account/organizations",
|
|
1753
1767
|
method: "get",
|
|
1754
1768
|
...variables,
|
|
1755
1769
|
signal
|
|
1756
1770
|
});
|
|
1757
1771
|
|
|
1758
1772
|
const operationsByPath = {
|
|
1759
|
-
"GET /
|
|
1760
|
-
"POST /
|
|
1761
|
-
"GET /
|
|
1762
|
-
"GET /
|
|
1763
|
-
"POST /
|
|
1764
|
-
"PUT /
|
|
1765
|
-
"DELETE /
|
|
1766
|
-
"GET /
|
|
1767
|
-
"DELETE /
|
|
1768
|
-
"PUT /
|
|
1769
|
-
"GET /
|
|
1770
|
-
"DELETE /
|
|
1771
|
-
"GET /
|
|
1772
|
-
"DELETE /
|
|
1773
|
-
"GET /
|
|
1774
|
-
"GET /
|
|
1775
|
-
"DELETE /
|
|
1776
|
-
"GET /
|
|
1777
|
-
"GET /
|
|
1773
|
+
"GET /account/": getAccount,
|
|
1774
|
+
"POST /account/": updateAccount,
|
|
1775
|
+
"GET /account/applications": getApplications,
|
|
1776
|
+
"GET /account/applications/{clientId}/consent": getConsent,
|
|
1777
|
+
"POST /account/applications/{clientId}/consent": createConsent,
|
|
1778
|
+
"PUT /account/applications/{clientId}/consent": updateConsent,
|
|
1779
|
+
"DELETE /account/applications/{clientId}/consent": deleteConsent,
|
|
1780
|
+
"GET /account/credentials": getCredentials,
|
|
1781
|
+
"DELETE /account/credentials/{credentialId}": deleteCredential,
|
|
1782
|
+
"PUT /account/credentials/{credentialId}/label": updateCredentialLabel,
|
|
1783
|
+
"GET /account/sessions": getSessions,
|
|
1784
|
+
"DELETE /account/sessions": deleteCurrentSession,
|
|
1785
|
+
"GET /account/sessions/devices": getDevices,
|
|
1786
|
+
"DELETE /account/sessions/{sessionId}": deleteSession,
|
|
1787
|
+
"GET /account/linked-accounts": getLinkedAccounts,
|
|
1788
|
+
"GET /account/linked-accounts/{providerId}": buildLinkingUri,
|
|
1789
|
+
"DELETE /account/linked-accounts/{providerId}": deleteLinkedProvider,
|
|
1790
|
+
"GET /account/groups": getGroups,
|
|
1791
|
+
"GET /account/organizations": getOrganizations
|
|
1778
1792
|
};
|
|
1779
1793
|
|
|
1780
1794
|
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
|