@nhost/nhost-js 4.4.0 → 4.5.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.
@@ -1401,6 +1401,397 @@ export interface VerifyTokenRequest {
1401
1401
  */
1402
1402
  token?: string;
1403
1403
  }
1404
+ /**
1405
+ *
1406
+ @property error (`string`) - OAuth2 error code
1407
+ @property error_description? (`string`) - Human-readable error description*/
1408
+ export interface OAuth2ErrorResponse {
1409
+ /**
1410
+ * OAuth2 error code
1411
+ */
1412
+ error: string;
1413
+ /**
1414
+ * Human-readable error description
1415
+ */
1416
+ error_description?: string;
1417
+ }
1418
+ /**
1419
+ *
1420
+ @property issuer (`string`) -
1421
+ @property authorization_endpoint (`string`) -
1422
+ @property token_endpoint (`string`) -
1423
+ @property userinfo_endpoint? (`string`) -
1424
+ @property jwks_uri (`string`) -
1425
+ @property revocation_endpoint? (`string`) -
1426
+ @property introspection_endpoint? (`string`) -
1427
+ @property scopes_supported? (`string[]`) -
1428
+ @property response_types_supported (`string[]`) -
1429
+ @property grant_types_supported? (`string[]`) -
1430
+ @property subject_types_supported? (`string[]`) -
1431
+ @property id_token_signing_alg_values_supported? (`string[]`) -
1432
+ @property token_endpoint_auth_methods_supported? (`string[]`) -
1433
+ @property code_challenge_methods_supported? (`string[]`) -
1434
+ @property claims_supported? (`string[]`) -
1435
+ @property request_parameter_supported? (`boolean`) -
1436
+ @property authorization_response_iss_parameter_supported? (`boolean`) -
1437
+ @property client_id_metadata_document_supported? (`boolean`) - */
1438
+ export interface OAuth2DiscoveryResponse {
1439
+ /**
1440
+ *
1441
+ */
1442
+ issuer: string;
1443
+ /**
1444
+ *
1445
+ */
1446
+ authorization_endpoint: string;
1447
+ /**
1448
+ *
1449
+ */
1450
+ token_endpoint: string;
1451
+ /**
1452
+ *
1453
+ */
1454
+ userinfo_endpoint?: string;
1455
+ /**
1456
+ *
1457
+ */
1458
+ jwks_uri: string;
1459
+ /**
1460
+ *
1461
+ */
1462
+ revocation_endpoint?: string;
1463
+ /**
1464
+ *
1465
+ */
1466
+ introspection_endpoint?: string;
1467
+ /**
1468
+ *
1469
+ */
1470
+ scopes_supported?: string[];
1471
+ /**
1472
+ *
1473
+ */
1474
+ response_types_supported: string[];
1475
+ /**
1476
+ *
1477
+ */
1478
+ grant_types_supported?: string[];
1479
+ /**
1480
+ *
1481
+ */
1482
+ subject_types_supported?: string[];
1483
+ /**
1484
+ *
1485
+ */
1486
+ id_token_signing_alg_values_supported?: string[];
1487
+ /**
1488
+ *
1489
+ */
1490
+ token_endpoint_auth_methods_supported?: string[];
1491
+ /**
1492
+ *
1493
+ */
1494
+ code_challenge_methods_supported?: string[];
1495
+ /**
1496
+ *
1497
+ */
1498
+ claims_supported?: string[];
1499
+ /**
1500
+ *
1501
+ */
1502
+ request_parameter_supported?: boolean;
1503
+ /**
1504
+ *
1505
+ */
1506
+ authorization_response_iss_parameter_supported?: boolean;
1507
+ /**
1508
+ *
1509
+ */
1510
+ client_id_metadata_document_supported?: boolean;
1511
+ }
1512
+ /**
1513
+ *
1514
+ */
1515
+ export type OAuth2TokenRequestGrant_type = 'authorization_code' | 'refresh_token';
1516
+ /**
1517
+ *
1518
+ @property grant_type (`OAuth2TokenRequestGrant_type`) -
1519
+ @property code? (`string`) -
1520
+ @property redirect_uri? (`string`) -
1521
+ @property client_id? (`string`) -
1522
+ @property client_secret? (`string`) -
1523
+ @property code_verifier? (`string`) -
1524
+ @property refresh_token? (`string`) -
1525
+ @property resource? (`string`) - */
1526
+ export interface OAuth2TokenRequest {
1527
+ /**
1528
+ *
1529
+ */
1530
+ grant_type: OAuth2TokenRequestGrant_type;
1531
+ /**
1532
+ *
1533
+ */
1534
+ code?: string;
1535
+ /**
1536
+ *
1537
+ */
1538
+ redirect_uri?: string;
1539
+ /**
1540
+ *
1541
+ */
1542
+ client_id?: string;
1543
+ /**
1544
+ *
1545
+ */
1546
+ client_secret?: string;
1547
+ /**
1548
+ *
1549
+ */
1550
+ code_verifier?: string;
1551
+ /**
1552
+ *
1553
+ */
1554
+ refresh_token?: string;
1555
+ /**
1556
+ *
1557
+ */
1558
+ resource?: string;
1559
+ }
1560
+ /**
1561
+ *
1562
+ @property access_token (`string`) -
1563
+ @property token_type (`string`) -
1564
+ @property expires_in (`number`) -
1565
+ @property refresh_token? (`string`) -
1566
+ @property id_token? (`string`) -
1567
+ @property scope? (`string`) - */
1568
+ export interface OAuth2TokenResponse {
1569
+ /**
1570
+ *
1571
+ */
1572
+ access_token: string;
1573
+ /**
1574
+ *
1575
+ */
1576
+ token_type: string;
1577
+ /**
1578
+ *
1579
+ */
1580
+ expires_in: number;
1581
+ /**
1582
+ *
1583
+ */
1584
+ refresh_token?: string;
1585
+ /**
1586
+ *
1587
+ */
1588
+ id_token?: string;
1589
+ /**
1590
+ *
1591
+ */
1592
+ scope?: string;
1593
+ }
1594
+ /**
1595
+ *
1596
+ @property sub (`string`) -
1597
+ @property name? (`string`) -
1598
+ @property email? (`string`) -
1599
+ @property email_verified? (`boolean`) -
1600
+ @property picture? (`string`) -
1601
+ @property locale? (`string`) -
1602
+ @property phone_number? (`string`) -
1603
+ @property phone_number_verified? (`boolean`) - */
1604
+ export interface OAuth2UserinfoResponse {
1605
+ /**
1606
+ *
1607
+ */
1608
+ sub: string;
1609
+ /**
1610
+ *
1611
+ */
1612
+ name?: string;
1613
+ /**
1614
+ *
1615
+ */
1616
+ email?: string;
1617
+ /**
1618
+ *
1619
+ */
1620
+ email_verified?: boolean;
1621
+ /**
1622
+ *
1623
+ */
1624
+ picture?: string;
1625
+ /**
1626
+ *
1627
+ */
1628
+ locale?: string;
1629
+ /**
1630
+ *
1631
+ */
1632
+ phone_number?: string;
1633
+ /**
1634
+ *
1635
+ */
1636
+ phone_number_verified?: boolean;
1637
+ }
1638
+ /**
1639
+ *
1640
+ @property keys (`JWK[]`) - */
1641
+ export interface OAuth2JWKSResponse {
1642
+ /**
1643
+ *
1644
+ */
1645
+ keys: JWK[];
1646
+ }
1647
+ /**
1648
+ *
1649
+ */
1650
+ export type OAuth2RevokeRequestToken_type_hint = 'access_token' | 'refresh_token';
1651
+ /**
1652
+ *
1653
+ @property token (`string`) -
1654
+ @property token_type_hint? (`OAuth2RevokeRequestToken_type_hint`) -
1655
+ @property client_id? (`string`) -
1656
+ @property client_secret? (`string`) - */
1657
+ export interface OAuth2RevokeRequest {
1658
+ /**
1659
+ *
1660
+ */
1661
+ token: string;
1662
+ /**
1663
+ *
1664
+ */
1665
+ token_type_hint?: OAuth2RevokeRequestToken_type_hint;
1666
+ /**
1667
+ *
1668
+ */
1669
+ client_id?: string;
1670
+ /**
1671
+ *
1672
+ */
1673
+ client_secret?: string;
1674
+ }
1675
+ /**
1676
+ *
1677
+ */
1678
+ export type OAuth2IntrospectRequestToken_type_hint = 'access_token' | 'refresh_token';
1679
+ /**
1680
+ *
1681
+ @property token (`string`) -
1682
+ @property token_type_hint? (`OAuth2IntrospectRequestToken_type_hint`) -
1683
+ @property client_id? (`string`) -
1684
+ @property client_secret? (`string`) - */
1685
+ export interface OAuth2IntrospectRequest {
1686
+ /**
1687
+ *
1688
+ */
1689
+ token: string;
1690
+ /**
1691
+ *
1692
+ */
1693
+ token_type_hint?: OAuth2IntrospectRequestToken_type_hint;
1694
+ /**
1695
+ *
1696
+ */
1697
+ client_id?: string;
1698
+ /**
1699
+ *
1700
+ */
1701
+ client_secret?: string;
1702
+ }
1703
+ /**
1704
+ *
1705
+ @property active (`boolean`) -
1706
+ @property scope? (`string`) -
1707
+ @property client_id? (`string`) -
1708
+ @property sub? (`string`) -
1709
+ @property exp? (`number`) -
1710
+ @property iat? (`number`) -
1711
+ @property iss? (`string`) -
1712
+ @property token_type? (`string`) - */
1713
+ export interface OAuth2IntrospectResponse {
1714
+ /**
1715
+ *
1716
+ */
1717
+ active: boolean;
1718
+ /**
1719
+ *
1720
+ */
1721
+ scope?: string;
1722
+ /**
1723
+ *
1724
+ */
1725
+ client_id?: string;
1726
+ /**
1727
+ *
1728
+ */
1729
+ sub?: string;
1730
+ /**
1731
+ *
1732
+ */
1733
+ exp?: number;
1734
+ /**
1735
+ *
1736
+ */
1737
+ iat?: number;
1738
+ /**
1739
+ *
1740
+ */
1741
+ iss?: string;
1742
+ /**
1743
+ *
1744
+ */
1745
+ token_type?: string;
1746
+ }
1747
+ /**
1748
+ *
1749
+ @property requestId (`string`) -
1750
+ * Format - uuid
1751
+ @property clientId (`string`) -
1752
+ @property scopes (`string[]`) -
1753
+ @property redirectUri (`string`) - */
1754
+ export interface OAuth2LoginResponse {
1755
+ /**
1756
+ *
1757
+ * Format - uuid
1758
+ */
1759
+ requestId: string;
1760
+ /**
1761
+ *
1762
+ */
1763
+ clientId: string;
1764
+ /**
1765
+ *
1766
+ */
1767
+ scopes: string[];
1768
+ /**
1769
+ *
1770
+ */
1771
+ redirectUri: string;
1772
+ }
1773
+ /**
1774
+ *
1775
+ @property requestId (`string`) -
1776
+ * Format - uuid*/
1777
+ export interface OAuth2LoginRequest {
1778
+ /**
1779
+ *
1780
+ * Format - uuid
1781
+ */
1782
+ requestId: string;
1783
+ }
1784
+ /**
1785
+ *
1786
+ @property redirectUri (`string`) -
1787
+ * Format - uri*/
1788
+ export interface OAuth2LoginCompleteResponse {
1789
+ /**
1790
+ *
1791
+ * Format - uri
1792
+ */
1793
+ redirectUri: string;
1794
+ }
1404
1795
  /**
1405
1796
  * Target URL for the redirect
1406
1797
  */
@@ -1428,6 +1819,64 @@ export interface GetVersionResponse200 {
1428
1819
  */
1429
1820
  version: string;
1430
1821
  }
1822
+ /**
1823
+ *
1824
+ */
1825
+ export type GetCode_challenge_method = 'S256';
1826
+ /**
1827
+ *
1828
+ @property client_id (`string`) -
1829
+ @property redirect_uri (`string`) -
1830
+ @property response_type (`string`) -
1831
+ @property scope? (`string`) -
1832
+ @property state? (`string`) -
1833
+ @property nonce? (`string`) -
1834
+ @property code_challenge? (`string`) -
1835
+ @property code_challenge_method? (`string`) - Only S256 is supported. The plain method is not allowed.
1836
+ @property resource? (`string`) -
1837
+ @property prompt? (`string`) - */
1838
+ export interface Oauth2AuthorizePostBody {
1839
+ /**
1840
+ *
1841
+ */
1842
+ client_id: string;
1843
+ /**
1844
+ *
1845
+ */
1846
+ redirect_uri: string;
1847
+ /**
1848
+ *
1849
+ */
1850
+ response_type: string;
1851
+ /**
1852
+ *
1853
+ */
1854
+ scope?: string;
1855
+ /**
1856
+ *
1857
+ */
1858
+ state?: string;
1859
+ /**
1860
+ *
1861
+ */
1862
+ nonce?: string;
1863
+ /**
1864
+ *
1865
+ */
1866
+ code_challenge?: string;
1867
+ /**
1868
+ * Only S256 is supported. The plain method is not allowed.
1869
+ */
1870
+ code_challenge_method?: string;
1871
+ /**
1872
+ *
1873
+ */
1874
+ resource?: string;
1875
+ /**
1876
+ *
1877
+ */
1878
+ prompt?: string;
1879
+ }
1431
1880
  /**
1432
1881
  * Parameters for the signInProvider method.
1433
1882
  @property allowedRoles? (string[]) - Array of allowed roles for the user
@@ -1526,6 +1975,91 @@ export interface VerifyTicketParams {
1526
1975
  */
1527
1976
  redirectTo: RedirectToQuery;
1528
1977
  }
1978
+ /**
1979
+ * Parameters for the oauth2Authorize method.
1980
+ @property client_id (string) - The OAuth2 client identifier (RFC 6749 Section 2.2).
1981
+
1982
+ @property redirect_uri (string) - The URI to redirect the user-agent to after authorization (RFC 6749 Section 3.1.2).
1983
+
1984
+ @property response_type (string) - The authorization response type. Only 'code' is supported (RFC 6749 Section 3.1.1).
1985
+
1986
+ @property scope? (string) - Space-delimited list of requested scopes (RFC 6749 Section 3.3).
1987
+
1988
+ @property state? (string) - Opaque value used to maintain state between the request and callback (RFC 6749 Section 4.1.1).
1989
+
1990
+ @property nonce? (string) - String value used to associate a client session with an ID token (OpenID Connect Core Section 3.1.2.1).
1991
+
1992
+ @property code_challenge? (string) - PKCE code challenge derived from the code verifier (RFC 7636 Section 4.2).
1993
+
1994
+ @property code_challenge_method? (GetCode_challenge_method) - Only S256 is supported. The plain method is not allowed.
1995
+
1996
+ @property resource? (string) - Resource indicator for the target service (RFC 8707).
1997
+
1998
+ @property prompt? (string) - Space-delimited list of prompts to present to the user (OpenID Connect Core Section 3.1.2.1).
1999
+ */
2000
+ export interface Oauth2AuthorizeParams {
2001
+ /**
2002
+ * The OAuth2 client identifier (RFC 6749 Section 2.2).
2003
+
2004
+ */
2005
+ client_id: string;
2006
+ /**
2007
+ * The URI to redirect the user-agent to after authorization (RFC 6749 Section 3.1.2).
2008
+
2009
+ */
2010
+ redirect_uri: string;
2011
+ /**
2012
+ * The authorization response type. Only 'code' is supported (RFC 6749 Section 3.1.1).
2013
+
2014
+ */
2015
+ response_type: string;
2016
+ /**
2017
+ * Space-delimited list of requested scopes (RFC 6749 Section 3.3).
2018
+
2019
+ */
2020
+ scope?: string;
2021
+ /**
2022
+ * Opaque value used to maintain state between the request and callback (RFC 6749 Section 4.1.1).
2023
+
2024
+ */
2025
+ state?: string;
2026
+ /**
2027
+ * String value used to associate a client session with an ID token (OpenID Connect Core Section 3.1.2.1).
2028
+
2029
+ */
2030
+ nonce?: string;
2031
+ /**
2032
+ * PKCE code challenge derived from the code verifier (RFC 7636 Section 4.2).
2033
+
2034
+ */
2035
+ code_challenge?: string;
2036
+ /**
2037
+ * Only S256 is supported. The plain method is not allowed.
2038
+
2039
+ */
2040
+ code_challenge_method?: GetCode_challenge_method;
2041
+ /**
2042
+ * Resource indicator for the target service (RFC 8707).
2043
+
2044
+ */
2045
+ resource?: string;
2046
+ /**
2047
+ * Space-delimited list of prompts to present to the user (OpenID Connect Core Section 3.1.2.1).
2048
+
2049
+ */
2050
+ prompt?: string;
2051
+ }
2052
+ /**
2053
+ * Parameters for the oauth2LoginGet method.
2054
+ @property request_id (string) - The pending authorization request identifier.
2055
+ */
2056
+ export interface Oauth2LoginGetParams {
2057
+ /**
2058
+ * The pending authorization request identifier.
2059
+
2060
+ */
2061
+ request_id: string;
2062
+ }
1529
2063
  export interface Client {
1530
2064
  baseURL: string;
1531
2065
  /** Add a middleware function to the fetch chain
@@ -1850,6 +2384,100 @@ export interface Client {
1850
2384
  - 200: GetVersionResponse200
1851
2385
  */
1852
2386
  getVersion(options?: RequestInit): Promise<FetchResponse<GetVersionResponse200>>;
2387
+ /**
2388
+ Summary: OpenID Connect Discovery
2389
+ Returns the OpenID Provider Metadata (RFC 8414)
2390
+
2391
+ This method may return different T based on the response code:
2392
+ - 200: OAuth2DiscoveryResponse
2393
+ */
2394
+ getOpenIDConfiguration(options?: RequestInit): Promise<FetchResponse<OAuth2DiscoveryResponse>>;
2395
+ /**
2396
+ Summary: OAuth2 Authorization Server Metadata
2397
+ Returns the Authorization Server Metadata (RFC 8414). Same content as OpenID Discovery.
2398
+
2399
+ This method may return different T based on the response code:
2400
+ - 200: OAuth2DiscoveryResponse
2401
+ */
2402
+ getOAuthAuthorizationServer(options?: RequestInit): Promise<FetchResponse<OAuth2DiscoveryResponse>>;
2403
+ /**
2404
+ Summary: OAuth2 Authorization Endpoint
2405
+ Initiates an OAuth2 authorization code flow. Validates the request and redirects to the login UI for user authentication and consent.
2406
+
2407
+ As this method is a redirect, it returns a URL string instead of a Promise
2408
+ */
2409
+ oauth2AuthorizeURL(params?: Oauth2AuthorizeParams, options?: RequestInit): string;
2410
+ /**
2411
+ Summary: OAuth2 Authorization Endpoint (POST)
2412
+ Initiates an OAuth2 authorization code flow via POST. Validates the request and redirects to the login UI for user authentication and consent.
2413
+
2414
+ As this method is a redirect, it returns a URL string instead of a Promise
2415
+ */
2416
+ oauth2AuthorizePostURL(body: Oauth2AuthorizePostBody, options?: RequestInit): string;
2417
+ /**
2418
+ Summary: OAuth2 Token Endpoint
2419
+ Exchange an authorization code for tokens, or refresh an existing token. Supports grant_type authorization_code and refresh_token.
2420
+
2421
+ This method may return different T based on the response code:
2422
+ - 200: OAuth2TokenResponse
2423
+ */
2424
+ oauth2Token(body: OAuth2TokenRequest, options?: RequestInit): Promise<FetchResponse<OAuth2TokenResponse>>;
2425
+ /**
2426
+ Summary: OpenID Connect UserInfo Endpoint (GET)
2427
+ Returns claims about the authenticated user based on the access token scopes.
2428
+
2429
+ This method may return different T based on the response code:
2430
+ - 200: OAuth2UserinfoResponse
2431
+ */
2432
+ oauth2UserinfoGet(options?: RequestInit): Promise<FetchResponse<OAuth2UserinfoResponse>>;
2433
+ /**
2434
+ Summary: OpenID Connect UserInfo Endpoint (POST)
2435
+ Returns claims about the authenticated user based on the access token scopes.
2436
+
2437
+ This method may return different T based on the response code:
2438
+ - 200: OAuth2UserinfoResponse
2439
+ */
2440
+ oauth2UserinfoPost(options?: RequestInit): Promise<FetchResponse<OAuth2UserinfoResponse>>;
2441
+ /**
2442
+ Summary: OAuth2 Provider JWKS Endpoint
2443
+ Returns the JSON Web Key Set containing public keys used for OAuth2/OIDC token signing.
2444
+
2445
+ This method may return different T based on the response code:
2446
+ - 200: OAuth2JWKSResponse
2447
+ */
2448
+ oauth2Jwks(options?: RequestInit): Promise<FetchResponse<OAuth2JWKSResponse>>;
2449
+ /**
2450
+ Summary: OAuth2 Token Revocation (RFC 7009)
2451
+ Revoke an access token or refresh token.
2452
+
2453
+ This method may return different T based on the response code:
2454
+ - 200: void
2455
+ */
2456
+ oauth2Revoke(body: OAuth2RevokeRequest, options?: RequestInit): Promise<FetchResponse<void>>;
2457
+ /**
2458
+ Summary: OAuth2 Token Introspection (RFC 7662)
2459
+ Introspect a token to determine its current state and metadata.
2460
+
2461
+ This method may return different T based on the response code:
2462
+ - 200: OAuth2IntrospectResponse
2463
+ */
2464
+ oauth2Introspect(body: OAuth2IntrospectRequest, options?: RequestInit): Promise<FetchResponse<OAuth2IntrospectResponse>>;
2465
+ /**
2466
+ Summary: Get authorization request details for consent screen
2467
+ Called by the consent UI to get details about the pending authorization request.
2468
+
2469
+ This method may return different T based on the response code:
2470
+ - 200: OAuth2LoginResponse
2471
+ */
2472
+ oauth2LoginGet(params?: Oauth2LoginGetParams, options?: RequestInit): Promise<FetchResponse<OAuth2LoginResponse>>;
2473
+ /**
2474
+ Summary: Complete login/consent for an authorization request
2475
+ Called by the consent UI after user authenticates and consents. Sets the user on the auth request and redirects back to the client with an authorization code.
2476
+
2477
+ This method may return different T based on the response code:
2478
+ - 200: OAuth2LoginCompleteResponse
2479
+ */
2480
+ oauth2LoginPost(body: OAuth2LoginRequest, options?: RequestInit): Promise<FetchResponse<OAuth2LoginCompleteResponse>>;
1853
2481
  }
1854
2482
  export declare const createAPIClient: (baseURL: string, chainFunctions?: ChainFunction[]) => Client;
1855
2483
  //# sourceMappingURL=client.d.ts.map