UNPKG

2.99 kBJavaScriptView Raw
1"use strict";
2// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3// SPDX-License-Identifier: Apache-2.0
4Object.defineProperty(exports, "__esModule", { value: true });
5var CognitoHostedUIIdentityProvider;
6(function (CognitoHostedUIIdentityProvider) {
7 CognitoHostedUIIdentityProvider["Cognito"] = "COGNITO";
8 CognitoHostedUIIdentityProvider["Google"] = "Google";
9 CognitoHostedUIIdentityProvider["Facebook"] = "Facebook";
10 CognitoHostedUIIdentityProvider["Amazon"] = "LoginWithAmazon";
11 CognitoHostedUIIdentityProvider["Apple"] = "SignInWithApple";
12})(CognitoHostedUIIdentityProvider = exports.CognitoHostedUIIdentityProvider || (exports.CognitoHostedUIIdentityProvider = {}));
13function isFederatedSignInOptions(obj) {
14 var keys = ['provider'];
15 return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });
16}
17exports.isFederatedSignInOptions = isFederatedSignInOptions;
18function isFederatedSignInOptionsCustom(obj) {
19 var keys = ['customProvider'];
20 return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });
21}
22exports.isFederatedSignInOptionsCustom = isFederatedSignInOptionsCustom;
23function hasCustomState(obj) {
24 var keys = ['customState'];
25 return obj && !!keys.find(function (k) { return obj.hasOwnProperty(k); });
26}
27exports.hasCustomState = hasCustomState;
28function isCognitoHostedOpts(oauth) {
29 return oauth.redirectSignIn !== undefined;
30}
31exports.isCognitoHostedOpts = isCognitoHostedOpts;
32var AuthErrorTypes;
33(function (AuthErrorTypes) {
34 AuthErrorTypes["NoConfig"] = "noConfig";
35 AuthErrorTypes["MissingAuthConfig"] = "missingAuthConfig";
36 AuthErrorTypes["EmptyUsername"] = "emptyUsername";
37 AuthErrorTypes["InvalidUsername"] = "invalidUsername";
38 AuthErrorTypes["EmptyPassword"] = "emptyPassword";
39 AuthErrorTypes["EmptyCode"] = "emptyCode";
40 AuthErrorTypes["SignUpError"] = "signUpError";
41 AuthErrorTypes["NoMFA"] = "noMFA";
42 AuthErrorTypes["InvalidMFA"] = "invalidMFA";
43 AuthErrorTypes["EmptyChallengeResponse"] = "emptyChallengeResponse";
44 AuthErrorTypes["NoUserSession"] = "noUserSession";
45 AuthErrorTypes["Default"] = "default";
46 AuthErrorTypes["DeviceConfig"] = "deviceConfig";
47 AuthErrorTypes["NetworkError"] = "networkError";
48 AuthErrorTypes["AutoSignInError"] = "autoSignInError";
49})(AuthErrorTypes = exports.AuthErrorTypes || (exports.AuthErrorTypes = {}));
50function isUsernamePasswordOpts(obj) {
51 return !!obj.username;
52}
53exports.isUsernamePasswordOpts = isUsernamePasswordOpts;
54var GRAPHQL_AUTH_MODE;
55(function (GRAPHQL_AUTH_MODE) {
56 GRAPHQL_AUTH_MODE["API_KEY"] = "API_KEY";
57 GRAPHQL_AUTH_MODE["AWS_IAM"] = "AWS_IAM";
58 GRAPHQL_AUTH_MODE["OPENID_CONNECT"] = "OPENID_CONNECT";
59 GRAPHQL_AUTH_MODE["AMAZON_COGNITO_USER_POOLS"] = "AMAZON_COGNITO_USER_POOLS";
60 GRAPHQL_AUTH_MODE["AWS_LAMBDA"] = "AWS_LAMBDA";
61})(GRAPHQL_AUTH_MODE = exports.GRAPHQL_AUTH_MODE || (exports.GRAPHQL_AUTH_MODE = {}));
62//# sourceMappingURL=Auth.js.map
\No newline at end of file