@sudoplatform/sudo-user 15.1.3 → 16.0.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/cjs/client/amplifyClient.js +226 -0
- package/cjs/client/amplifyClient.js.map +1 -0
- package/cjs/client/apiClient.js +50 -59
- package/cjs/client/apiClient.js.map +1 -1
- package/cjs/client/graphqlClient.js +10 -0
- package/cjs/client/graphqlClient.js.map +1 -0
- package/cjs/client/transformer/ErrorTransformer.js +1 -2
- package/cjs/client/transformer/ErrorTransformer.js.map +1 -1
- package/cjs/core/sdk-config.js +2 -2
- package/cjs/core/sdk-config.js.map +1 -1
- package/cjs/index.js +3 -1
- package/cjs/index.js.map +1 -1
- package/cjs/sdk.js +3 -0
- package/cjs/sdk.js.map +1 -1
- package/cjs/utils/parse-token.js +1 -2
- package/cjs/utils/parse-token.js.map +1 -1
- package/cjs/utils/resolvable-promise.js +1 -2
- package/cjs/utils/resolvable-promise.js.map +1 -1
- package/cjs/utils/sign-options-builder.js +1 -2
- package/cjs/utils/sign-options-builder.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/highlight.css +56 -0
- package/docs/assets/main.js +5 -5
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +254 -231
- package/docs/classes/AlreadyRegisteredError.html +33 -12
- package/docs/classes/DefaultSudoUserClient.html +75 -75
- package/docs/classes/IdentityServiceConfigNotFoundError.html +33 -12
- package/docs/classes/LocalAuthenticationProvider.html +12 -12
- package/docs/classes/TESTAuthenticationProvider.html +13 -13
- package/docs/classes/internal.AmplifyClient.html +21 -0
- package/docs/enums/GraphQLClientAuthMode.html +4 -0
- package/docs/functions/internal.getIdentityServiceConfig.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +6 -24
- package/docs/interfaces/AuthenticationProvider.html +5 -5
- package/docs/interfaces/AuthenticationTokens.html +10 -10
- package/docs/interfaces/GraphQLClient.html +20 -0
- package/docs/interfaces/GraphQLClientOptions.html +13 -0
- package/docs/interfaces/SudoUserClient.html +66 -66
- package/docs/interfaces/internal.SudoUserOptions.html +9 -9
- package/docs/modules/internal.html +1 -1
- package/docs/modules.html +1 -1
- package/docs/types/IAMCredentials.html +4 -0
- package/docs/types/TokenProvider.html +1 -0
- package/docs/types/internal.Config.html +1 -1
- package/docs/types/internal.FederatedSignInConfig.html +1 -1
- package/docs/types/internal.IdentityServiceConfig.html +1 -1
- package/docs/variables/internal.Config.html +1 -0
- package/docs/variables/internal.FederatedSignInConfigCodec.html +1 -1
- package/docs/variables/internal.IdentityServiceConfigCodec.html +1 -1
- package/lib/client/amplifyClient.js +222 -0
- package/lib/client/amplifyClient.js.map +1 -0
- package/lib/client/apiClient.js +50 -59
- package/lib/client/apiClient.js.map +1 -1
- package/lib/client/graphqlClient.js +7 -0
- package/lib/client/graphqlClient.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/sdk.js +1 -0
- package/lib/sdk.js.map +1 -1
- package/package.json +58 -40
- package/types/client/amplifyClient.d.ts +60 -0
- package/types/client/graphqlClient.d.ts +84 -0
- package/types/gen/graphql-types.d.ts +4 -12
- package/types/index.d.ts +1 -0
- package/types/sdk.d.ts +1 -0
- package/docs/variables/internal.Config-1.html +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>FederatedSignInConfig | @sudoplatform/sudo-user</title><meta name="description" content="Documentation for @sudoplatform/sudo-user"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@sudoplatform/sudo-user</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/internal.html">internal</a></li><li><a href="" aria-current="page">FederatedSignInConfig</a></li></ul><h1>Type Alias FederatedSignInConfig</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">FederatedSignInConfig</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">t.TypeOf</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-keyword">typeof</span> <a href="../variables/internal.FederatedSignInConfigCodec.html" class="tsd-signature-type tsd-kind-variable">FederatedSignInConfigCodec</a><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/sudoplatform/sudo-user-js/blob/67e996eef59579bb2ae4c0446f960da0a26a3d47/src/core/sdk-config.ts#L67">src/core/sdk-config.ts:67</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@sudoplatform/sudo-user</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>IdentityServiceConfig | @sudoplatform/sudo-user</title><meta name="description" content="Documentation for @sudoplatform/sudo-user"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@sudoplatform/sudo-user</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/internal.html">internal</a></li><li><a href="" aria-current="page">IdentityServiceConfig</a></li></ul><h1>Type Alias IdentityServiceConfig</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">IdentityServiceConfig</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">t.TypeOf</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-keyword">typeof</span> <a href="../variables/internal.IdentityServiceConfigCodec.html" class="tsd-signature-type tsd-kind-variable">IdentityServiceConfigCodec</a><span class="tsd-signature-symbol">></span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/sudoplatform/sudo-user-js/blob/67e996eef59579bb2ae4c0446f960da0a26a3d47/src/core/sdk-config.ts#L66">src/core/sdk-config.ts:66</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@sudoplatform/sudo-user</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>Config | @sudoplatform/sudo-user</title><meta name="description" content="Documentation for @sudoplatform/sudo-user"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@sudoplatform/sudo-user</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/internal.html">internal</a></li><li><a href="" aria-current="page">Config</a></li></ul><h1>Variable Config<code class="tsd-tag">Const</code></h1></div><div class="tsd-signature"><span class="tsd-kind-variable">Config</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">IntersectionC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">[</span><br/> <span class="tsd-signature-type">TypeC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">identityService</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">IntersectionC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">[</span><br/> <span class="tsd-signature-type">TypeC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">apiUrl</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">bucket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">clientId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">identityPoolId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">poolId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">region</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">registrationMethods</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ArrayC</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">transientBucket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-type">PartialC</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">refreshTokenLifetime</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NumberC</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-type">PartialC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">federatedSignIn</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">IntersectionC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">[</span><br/> <span class="tsd-signature-type">TypeC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">appClientId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signInRedirectUri</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signOutRedirectUri</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">webDomain</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-type">PartialC</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">identityProvider</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">refreshTokenLifetime</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NumberC</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/sudoplatform/sudo-user-js/blob/67e996eef59579bb2ae4c0446f960da0a26a3d47/src/core/sdk-config.ts#L54">src/core/sdk-config.ts:54</a></li><li>Defined in <a href="https://github.com/sudoplatform/sudo-user-js/blob/67e996eef59579bb2ae4c0446f960da0a26a3d47/src/core/sdk-config.ts#L65">src/core/sdk-config.ts:65</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@sudoplatform/sudo-user</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>FederatedSignInConfigCodec | @sudoplatform/sudo-user</title><meta name="description" content="Documentation for @sudoplatform/sudo-user"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@sudoplatform/sudo-user</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/internal.html">internal</a></li><li><a href="" aria-current="page">FederatedSignInConfigCodec</a></li></ul><h1>Variable FederatedSignInConfigCodec<code class="tsd-tag">Const</code></h1></div><div class="tsd-signature"><span class="tsd-kind-variable">FederatedSignInConfigCodec</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">IntersectionC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">[</span><br/> <span class="tsd-signature-type">TypeC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">appClientId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signInRedirectUri</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">signOutRedirectUri</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">webDomain</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-type">PartialC</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">identityProvider</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">refreshTokenLifetime</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NumberC</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/sudoplatform/sudo-user-js/blob/67e996eef59579bb2ae4c0446f960da0a26a3d47/src/core/sdk-config.ts#L35">src/core/sdk-config.ts:35</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@sudoplatform/sudo-user</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html class="default" lang="en" data-base="
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>IdentityServiceConfigCodec | @sudoplatform/sudo-user</title><meta name="description" content="Documentation for @sudoplatform/sudo-user"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">@sudoplatform/sudo-user</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/internal.html">internal</a></li><li><a href="" aria-current="page">IdentityServiceConfigCodec</a></li></ul><h1>Variable IdentityServiceConfigCodec<code class="tsd-tag">Const</code></h1></div><div class="tsd-signature"><span class="tsd-kind-variable">IdentityServiceConfigCodec</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">IntersectionC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">[</span><br/> <span class="tsd-signature-type">TypeC</span><span class="tsd-signature-symbol"><</span><br/> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">apiUrl</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">bucket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">clientId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">identityPoolId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">poolId</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">region</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">registrationMethods</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">ArrayC</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">transientBucket</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">StringC</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-type">PartialC</span><span class="tsd-signature-symbol"><</span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">refreshTokenLifetime</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">NumberC</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-signature-symbol">]</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">></span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/sudoplatform/sudo-user-js/blob/67e996eef59579bb2ae4c0446f960da0a26a3d47/src/core/sdk-config.ts#L12">src/core/sdk-config.ts:12</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@sudoplatform/sudo-user</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { AmplifyClassV6, } from '@aws-amplify/core';
|
|
2
|
+
// Ideally we would import from 'aws-amplify' but that prevents us from a
|
|
3
|
+
// multi-client solution because it uses a singleton amplify instance.
|
|
4
|
+
import { generateClient } from '@aws-amplify/api-graphql/internals';
|
|
5
|
+
import { GraphQLClientAuthMode, } from './graphqlClient';
|
|
6
|
+
var GraphQLAuthMode;
|
|
7
|
+
(function (GraphQLAuthMode) {
|
|
8
|
+
GraphQLAuthMode["OpenIDConnect"] = "oidc";
|
|
9
|
+
GraphQLAuthMode["IAM"] = "iam";
|
|
10
|
+
GraphQLAuthMode["ApiKey"] = "apiKey";
|
|
11
|
+
})(GraphQLAuthMode || (GraphQLAuthMode = {}));
|
|
12
|
+
/**
|
|
13
|
+
* We provide a default IAMCredentialsProvider which accesses
|
|
14
|
+
* the required environment variables for the IAM auth mode, if the values are not provided
|
|
15
|
+
*/
|
|
16
|
+
class IAMCredentialsProvider {
|
|
17
|
+
constructor(credentials) {
|
|
18
|
+
this.credentials = undefined;
|
|
19
|
+
if (credentials) {
|
|
20
|
+
this.credentials = { credentials, identityId: '' };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
clearCredentialsAndIdentityId() { }
|
|
24
|
+
getCredentialsAndIdentityId(
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
|
+
_) {
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
if (!this.credentials) {
|
|
29
|
+
const accessKeyId = process.env.AWS_ACCESS_KEY_ID;
|
|
30
|
+
const secretAccessKey = process.env.AWS_SECRET_ACCESS_KEY;
|
|
31
|
+
if (!accessKeyId || !secretAccessKey) {
|
|
32
|
+
throw new Error('AWS IAM credentials are not set');
|
|
33
|
+
}
|
|
34
|
+
this.credentials = {
|
|
35
|
+
credentials: {
|
|
36
|
+
accessKeyId: accessKeyId,
|
|
37
|
+
secretAccessKey: secretAccessKey,
|
|
38
|
+
sessionToken: process.env.AWS_SESSION_TOKEN,
|
|
39
|
+
},
|
|
40
|
+
identityId: '', // Amplify expects this but it's empty for IAM
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
return resolve(this.credentials);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Convenience wrapper for GraphQL API using Amplify SDK.
|
|
49
|
+
*/
|
|
50
|
+
export class AmplifyClient {
|
|
51
|
+
constructor(options) {
|
|
52
|
+
this.options = options;
|
|
53
|
+
this.amplify = new AmplifyClassV6();
|
|
54
|
+
this.configure(options);
|
|
55
|
+
// @ts-expect-error complex typings not manageable by tsc
|
|
56
|
+
this.client = generateClient({
|
|
57
|
+
amplify: this.amplify,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
configure(options) {
|
|
61
|
+
const authModeToUse = options.authMode ?? GraphQLClientAuthMode.OpenIDConnect;
|
|
62
|
+
switch (authModeToUse) {
|
|
63
|
+
case GraphQLClientAuthMode.OpenIDConnect:
|
|
64
|
+
if (!options.tokenProvider) {
|
|
65
|
+
throw new Error('tokenProvider must be provided when using OPENID_CONNECT authentication mode');
|
|
66
|
+
}
|
|
67
|
+
// In order to use a Cognito user pool issued ID token for
|
|
68
|
+
// authentication, we have to pretend that we are using
|
|
69
|
+
// a custom Lambda authentication provider. Otherwise,
|
|
70
|
+
// Amplify SDK attempts to sign into Cognito user pool
|
|
71
|
+
// or perform FSSO to OIDC provider. We have tried to use
|
|
72
|
+
// a generic GraphQL endpoint with OIDC authentication type
|
|
73
|
+
// but that breaks subscriptions as AppSync's subscription
|
|
74
|
+
// implementation is proprietary.
|
|
75
|
+
this.amplify.configure({
|
|
76
|
+
API: {
|
|
77
|
+
GraphQL: {
|
|
78
|
+
region: options.region,
|
|
79
|
+
endpoint: options.graphqlUrl,
|
|
80
|
+
defaultAuthMode: 'lambda',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
break;
|
|
85
|
+
case GraphQLClientAuthMode.ApiKey:
|
|
86
|
+
if (!options.apiKey) {
|
|
87
|
+
throw new Error('apiKey must be provided when using API_KEY authentication mode');
|
|
88
|
+
}
|
|
89
|
+
this.amplify.configure({
|
|
90
|
+
API: {
|
|
91
|
+
GraphQL: {
|
|
92
|
+
region: options.region,
|
|
93
|
+
endpoint: options.graphqlUrl,
|
|
94
|
+
defaultAuthMode: this.transformAuthMode(authModeToUse),
|
|
95
|
+
apiKey: options.apiKey,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
break;
|
|
100
|
+
case GraphQLClientAuthMode.IAM:
|
|
101
|
+
this.amplify.configure({
|
|
102
|
+
API: {
|
|
103
|
+
GraphQL: {
|
|
104
|
+
region: options.region,
|
|
105
|
+
endpoint: options.graphqlUrl,
|
|
106
|
+
defaultAuthMode: this.transformAuthMode(authModeToUse),
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
}, {
|
|
110
|
+
Auth: {
|
|
111
|
+
credentialsProvider: new IAMCredentialsProvider(options.credentials),
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Performs GraphQL query operation.
|
|
119
|
+
*
|
|
120
|
+
* @param options query document, query variables and authentication
|
|
121
|
+
* token (optional). If authentication token is provided then the
|
|
122
|
+
* token provided via the constructor will be ignored.
|
|
123
|
+
* @returns query result.
|
|
124
|
+
*/
|
|
125
|
+
async query(options) {
|
|
126
|
+
const authOptions = await this.resolveAuthOptions(options.authToken);
|
|
127
|
+
try {
|
|
128
|
+
return (await this.client.graphql({
|
|
129
|
+
query: options.query,
|
|
130
|
+
variables: options.variables,
|
|
131
|
+
...authOptions,
|
|
132
|
+
}));
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
throw err.errors?.pop() ?? err;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Performs GraphQL mutation operation.
|
|
140
|
+
*
|
|
141
|
+
* @param options mutation document, mutation variables and authentication
|
|
142
|
+
* token (optional). If authentication token is provided then the
|
|
143
|
+
* token provided via the constructor will be ignored.
|
|
144
|
+
* @returns mutation result.
|
|
145
|
+
*/
|
|
146
|
+
async mutate(options) {
|
|
147
|
+
const authOptions = await this.resolveAuthOptions(options.authToken);
|
|
148
|
+
try {
|
|
149
|
+
return (await this.client.graphql({
|
|
150
|
+
query: options.mutation,
|
|
151
|
+
variables: options.variables,
|
|
152
|
+
...authOptions,
|
|
153
|
+
}));
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
throw err.errors?.pop() ?? err;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Performs GraphQL subscription operation.
|
|
161
|
+
*
|
|
162
|
+
* @param options subscription document, subscription variables and
|
|
163
|
+
* authentication token (optional). If authentication token is provided
|
|
164
|
+
* then the token provided via the constructor will be ignored.
|
|
165
|
+
* @returns observable for receiving subscription notifications.
|
|
166
|
+
*/
|
|
167
|
+
async subscribe(options) {
|
|
168
|
+
if (this.options.authMode === GraphQLClientAuthMode.IAM) {
|
|
169
|
+
throw new Error('Subscriptions are not supported with IAM authentication mode');
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
const authOptions = await this.resolveAuthOptions(options.authToken);
|
|
173
|
+
const result = this.client.graphql({
|
|
174
|
+
query: options.subscription,
|
|
175
|
+
variables: options.variables,
|
|
176
|
+
...authOptions,
|
|
177
|
+
});
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
throw err.errors?.pop() ?? err;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Resolves a TokenProvider into its actual token value.
|
|
186
|
+
* Handles both string tokens and async/sync function providers.
|
|
187
|
+
*/
|
|
188
|
+
async resolveToken(tokenProvider) {
|
|
189
|
+
if (typeof tokenProvider === 'string') {
|
|
190
|
+
return tokenProvider;
|
|
191
|
+
}
|
|
192
|
+
// tokenProvider is a function, call it and await the result
|
|
193
|
+
return tokenProvider();
|
|
194
|
+
}
|
|
195
|
+
transformAuthMode(input) {
|
|
196
|
+
switch (input) {
|
|
197
|
+
case GraphQLClientAuthMode.OpenIDConnect:
|
|
198
|
+
return GraphQLAuthMode.OpenIDConnect;
|
|
199
|
+
case GraphQLClientAuthMode.IAM:
|
|
200
|
+
return GraphQLAuthMode.IAM;
|
|
201
|
+
case GraphQLClientAuthMode.ApiKey:
|
|
202
|
+
return GraphQLAuthMode.ApiKey;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
async resolveAuthOptions(token) {
|
|
206
|
+
if (this.options.tokenProvider &&
|
|
207
|
+
(this.options.authMode ??
|
|
208
|
+
GraphQLClientAuthMode.OpenIDConnect ===
|
|
209
|
+
GraphQLClientAuthMode.OpenIDConnect)) {
|
|
210
|
+
return {
|
|
211
|
+
authToken: token ?? (await this.resolveToken(this.options.tokenProvider)),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
if (this.options.authMode == GraphQLClientAuthMode.ApiKey && token) {
|
|
215
|
+
return {
|
|
216
|
+
apiKey: token,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
return {};
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
//# sourceMappingURL=amplifyClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amplifyClient.js","sourceRoot":"","sources":["../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