@webiny/cognito 0.0.0-unstable.7be00a75a9 → 0.0.0-unstable.9f53ea597d
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/Cognito.d.ts +51 -0
- package/Cognito.js +78 -4
- package/Cognito.js.map +1 -1
- package/admin/Cognito.d.ts +3 -1
- package/admin/DefaultCognitoSignInConfig.d.ts +23 -0
- package/admin/DefaultCognitoSignInConfig.js +51 -0
- package/admin/DefaultCognitoSignInConfig.js.map +1 -0
- package/admin/Extension.js +21 -0
- package/admin/Extension.js.map +1 -1
- package/admin/SignInExtension.d.ts +2 -0
- package/admin/SignInExtension.js +9 -0
- package/admin/SignInExtension.js.map +1 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserGateway.d.ts +11 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserGateway.js +44 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserGateway.js.map +1 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserUseCase.d.ts +10 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserUseCase.js +19 -0
- package/admin/features/account/getCurrentUser/GetCurrentUserUseCase.js.map +1 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserGateway.d.ts +16 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserGateway.js +5 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserGateway.js.map +1 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserUseCase.d.ts +10 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserUseCase.js +5 -0
- package/admin/features/account/getCurrentUser/abstractions/GetCurrentUserUseCase.js.map +1 -0
- package/admin/features/account/getCurrentUser/abstractions/index.d.ts +6 -0
- package/admin/features/account/getCurrentUser/abstractions/index.js +2 -0
- package/admin/features/account/getCurrentUser/feature.d.ts +3 -0
- package/admin/features/account/getCurrentUser/feature.js +19 -0
- package/admin/features/account/getCurrentUser/feature.js.map +1 -0
- package/admin/features/account/getCurrentUser/index.d.ts +1 -0
- package/admin/features/account/getCurrentUser/index.js +1 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserGateway.d.ts +11 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserGateway.js +48 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserGateway.js.map +1 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserUseCase.d.ts +10 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserUseCase.js +19 -0
- package/admin/features/account/updateCurrentUser/UpdateCurrentUserUseCase.js.map +1 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.d.ts +26 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.js +5 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.js.map +1 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserUseCase.d.ts +13 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserUseCase.js +5 -0
- package/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserUseCase.js.map +1 -0
- package/admin/features/account/updateCurrentUser/abstractions/index.d.ts +8 -0
- package/admin/features/account/updateCurrentUser/abstractions/index.js +2 -0
- package/admin/features/account/updateCurrentUser/feature.d.ts +3 -0
- package/admin/features/account/updateCurrentUser/feature.js +19 -0
- package/admin/features/account/updateCurrentUser/feature.js.map +1 -0
- package/admin/features/account/updateCurrentUser/index.d.ts +1 -0
- package/admin/features/account/updateCurrentUser/index.js +1 -0
- package/admin/features/users/createUser/CreateUserGateway.d.ts +11 -0
- package/admin/features/users/createUser/CreateUserGateway.js +49 -0
- package/admin/features/users/createUser/CreateUserGateway.js.map +1 -0
- package/admin/features/users/createUser/CreateUserUseCase.d.ts +10 -0
- package/admin/features/users/createUser/CreateUserUseCase.js +18 -0
- package/admin/features/users/createUser/CreateUserUseCase.js.map +1 -0
- package/admin/features/users/createUser/abstractions/CreateUserGateway.d.ts +21 -0
- package/admin/features/users/createUser/abstractions/CreateUserGateway.js +5 -0
- package/admin/features/users/createUser/abstractions/CreateUserGateway.js.map +1 -0
- package/admin/features/users/createUser/abstractions/CreateUserUseCase.d.ts +14 -0
- package/admin/features/users/createUser/abstractions/CreateUserUseCase.js +5 -0
- package/admin/features/users/createUser/abstractions/CreateUserUseCase.js.map +1 -0
- package/admin/features/users/createUser/abstractions/index.d.ts +2 -0
- package/admin/features/users/createUser/abstractions/index.js +2 -0
- package/admin/features/users/createUser/feature.d.ts +3 -0
- package/admin/features/users/createUser/feature.js +19 -0
- package/admin/features/users/createUser/feature.js.map +1 -0
- package/admin/features/users/createUser/index.d.ts +2 -0
- package/admin/features/users/createUser/index.js +2 -0
- package/admin/features/users/deleteUser/DeleteUserGateway.d.ts +11 -0
- package/admin/features/users/deleteUser/DeleteUserGateway.js +40 -0
- package/admin/features/users/deleteUser/DeleteUserGateway.js.map +1 -0
- package/admin/features/users/deleteUser/DeleteUserUseCase.d.ts +10 -0
- package/admin/features/users/deleteUser/DeleteUserUseCase.js +18 -0
- package/admin/features/users/deleteUser/DeleteUserUseCase.js.map +1 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserGateway.d.ts +11 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserGateway.js +5 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserGateway.js.map +1 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserUseCase.d.ts +11 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserUseCase.js +5 -0
- package/admin/features/users/deleteUser/abstractions/DeleteUserUseCase.js.map +1 -0
- package/admin/features/users/deleteUser/abstractions/index.d.ts +2 -0
- package/admin/features/users/deleteUser/abstractions/index.js +2 -0
- package/admin/features/users/deleteUser/feature.d.ts +3 -0
- package/admin/features/users/deleteUser/feature.js +19 -0
- package/admin/features/users/deleteUser/feature.js.map +1 -0
- package/admin/features/users/deleteUser/index.d.ts +2 -0
- package/admin/features/users/deleteUser/index.js +2 -0
- package/admin/features/users/getUser/GetUserGateway.d.ts +11 -0
- package/admin/features/users/getUser/GetUserGateway.js +57 -0
- package/admin/features/users/getUser/GetUserGateway.js.map +1 -0
- package/admin/features/users/getUser/GetUserUseCase.d.ts +10 -0
- package/admin/features/users/getUser/GetUserUseCase.js +18 -0
- package/admin/features/users/getUser/GetUserUseCase.js.map +1 -0
- package/admin/features/users/getUser/abstractions/GetUserGateway.d.ts +32 -0
- package/admin/features/users/getUser/abstractions/GetUserGateway.js +5 -0
- package/admin/features/users/getUser/abstractions/GetUserGateway.js.map +1 -0
- package/admin/features/users/getUser/abstractions/GetUserUseCase.d.ts +14 -0
- package/admin/features/users/getUser/abstractions/GetUserUseCase.js +5 -0
- package/admin/features/users/getUser/abstractions/GetUserUseCase.js.map +1 -0
- package/admin/features/users/getUser/abstractions/index.d.ts +2 -0
- package/admin/features/users/getUser/abstractions/index.js +2 -0
- package/admin/features/users/getUser/feature.d.ts +3 -0
- package/admin/features/users/getUser/feature.js +19 -0
- package/admin/features/users/getUser/feature.js.map +1 -0
- package/admin/features/users/getUser/index.d.ts +2 -0
- package/admin/features/users/getUser/index.js +2 -0
- package/admin/features/users/listUsers/ListUsersGateway.d.ts +11 -0
- package/admin/features/users/listUsers/ListUsersGateway.js +39 -0
- package/admin/features/users/listUsers/ListUsersGateway.js.map +1 -0
- package/admin/features/users/listUsers/ListUsersUseCase.d.ts +10 -0
- package/admin/features/users/listUsers/ListUsersUseCase.js +18 -0
- package/admin/features/users/listUsers/ListUsersUseCase.js.map +1 -0
- package/admin/features/users/listUsers/abstractions/ListUsersGateway.d.ts +17 -0
- package/admin/features/users/listUsers/abstractions/ListUsersGateway.js +5 -0
- package/admin/features/users/listUsers/abstractions/ListUsersGateway.js.map +1 -0
- package/admin/features/users/listUsers/abstractions/ListUsersUseCase.d.ts +10 -0
- package/admin/features/users/listUsers/abstractions/ListUsersUseCase.js +5 -0
- package/admin/features/users/listUsers/abstractions/ListUsersUseCase.js.map +1 -0
- package/admin/features/users/listUsers/abstractions/index.d.ts +2 -0
- package/admin/features/users/listUsers/abstractions/index.js +2 -0
- package/admin/features/users/listUsers/feature.d.ts +3 -0
- package/admin/features/users/listUsers/feature.js +19 -0
- package/admin/features/users/listUsers/feature.js.map +1 -0
- package/admin/features/users/listUsers/index.d.ts +2 -0
- package/admin/features/users/listUsers/index.js +2 -0
- package/admin/features/users/updateUser/UpdateUserGateway.d.ts +11 -0
- package/admin/features/users/updateUser/UpdateUserGateway.js +59 -0
- package/admin/features/users/updateUser/UpdateUserGateway.js.map +1 -0
- package/admin/features/users/updateUser/UpdateUserUseCase.d.ts +10 -0
- package/admin/features/users/updateUser/UpdateUserUseCase.js +18 -0
- package/admin/features/users/updateUser/UpdateUserUseCase.js.map +1 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserGateway.d.ts +33 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserGateway.js +5 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserGateway.js.map +1 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserUseCase.d.ts +15 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserUseCase.js +5 -0
- package/admin/features/users/updateUser/abstractions/UpdateUserUseCase.js.map +1 -0
- package/admin/features/users/updateUser/abstractions/index.d.ts +2 -0
- package/admin/features/users/updateUser/abstractions/index.js +2 -0
- package/admin/features/users/updateUser/feature.d.ts +3 -0
- package/admin/features/users/updateUser/feature.js +19 -0
- package/admin/features/users/updateUser/feature.js.map +1 -0
- package/admin/features/users/updateUser/index.d.ts +2 -0
- package/admin/features/users/updateUser/index.js +2 -0
- package/admin/index.d.ts +2 -0
- package/admin/index.js +2 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.js +9 -0
- package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -1
- package/admin/presentation/Cognito/CognitoPresenter.d.ts +25 -1
- package/admin/presentation/Cognito/CognitoPresenter.js +122 -10
- package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -1
- package/admin/presentation/Cognito/CognitoSignInConfig.d.ts +31 -0
- package/admin/presentation/Cognito/CognitoSignInConfig.js +5 -0
- package/admin/presentation/Cognito/CognitoSignInConfig.js.map +1 -0
- package/admin/presentation/Cognito/abstractions.d.ts +20 -1
- package/admin/presentation/Cognito/abstractions.js.map +1 -1
- package/admin/presentation/Cognito/components/ConfirmTotpCode.d.ts +26 -0
- package/admin/presentation/Cognito/components/ConfirmTotpCode.js +45 -0
- package/admin/presentation/Cognito/components/ConfirmTotpCode.js.map +1 -0
- package/admin/presentation/Cognito/components/Divider.d.ts +19 -1
- package/admin/presentation/Cognito/components/Divider.js +3 -2
- package/admin/presentation/Cognito/components/Divider.js.map +1 -1
- package/admin/presentation/Cognito/components/FederatedLogin.d.ts +22 -5
- package/admin/presentation/Cognito/components/FederatedLogin.js +19 -6
- package/admin/presentation/Cognito/components/FederatedLogin.js.map +1 -1
- package/admin/presentation/Cognito/components/FooterSignIn.d.ts +20 -3
- package/admin/presentation/Cognito/components/FooterSignIn.js +3 -2
- package/admin/presentation/Cognito/components/FooterSignIn.js.map +1 -1
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.d.ts +19 -1
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js +3 -2
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js.map +1 -1
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.d.ts +19 -1
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js +3 -2
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js.map +1 -1
- package/admin/presentation/Cognito/components/RequireNewPassword.d.ts +19 -1
- package/admin/presentation/Cognito/components/RequireNewPassword.js +3 -2
- package/admin/presentation/Cognito/components/RequireNewPassword.js.map +1 -1
- package/admin/presentation/Cognito/components/SetNewPassword.d.ts +19 -1
- package/admin/presentation/Cognito/components/SetNewPassword.js +3 -2
- package/admin/presentation/Cognito/components/SetNewPassword.js.map +1 -1
- package/admin/presentation/Cognito/components/SetupTotp.d.ts +25 -0
- package/admin/presentation/Cognito/components/SetupTotp.js +60 -0
- package/admin/presentation/Cognito/components/SetupTotp.js.map +1 -0
- package/admin/presentation/Cognito/components/SignIn.d.ts +19 -3
- package/admin/presentation/Cognito/components/SignIn.js +14 -7
- package/admin/presentation/Cognito/components/SignIn.js.map +1 -1
- package/admin/presentation/Cognito/components/View.d.ts +1 -1
- package/admin/presentation/Cognito/components/index.d.ts +292 -0
- package/admin/presentation/Cognito/components/index.js +29 -0
- package/admin/presentation/Cognito/components/index.js.map +1 -0
- package/admin/presentation/Cognito/signInFeature.d.ts +1 -0
- package/admin/presentation/Cognito/signInFeature.js +11 -0
- package/admin/presentation/Cognito/signInFeature.js.map +1 -0
- package/admin/ui/views/Account/Account.js +42 -34
- package/admin/ui/views/Account/Account.js.map +1 -1
- package/admin/ui/views/Users/UsersDataList.js +44 -26
- package/admin/ui/views/Users/UsersDataList.js.map +1 -1
- package/admin/ui/views/Users/UsersForm.js +22 -16
- package/admin/ui/views/Users/UsersForm.js.map +1 -1
- package/admin/ui/views/Users/hooks/useUserForm.d.ts +2 -2
- package/admin/ui/views/Users/hooks/useUserForm.js +60 -76
- package/admin/ui/views/Users/hooks/useUserForm.js.map +1 -1
- package/api/features/CognitoIdp/CognitoIdentityProvider.js +15 -11
- package/api/features/CognitoIdp/CognitoIdentityProvider.js.map +1 -1
- package/api/features/CognitoIdp/abstractions.d.ts +1 -1
- package/api/features/CognitoIdp/abstractions.js.map +1 -1
- package/api/index.d.ts +1 -0
- package/api/index.js +1 -0
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/infra/CognitoFederationPulumi.d.ts +8 -0
- package/infra/CognitoFederationPulumi.js +17 -0
- package/infra/CognitoFederationPulumi.js.map +1 -0
- package/package.json +26 -25
- package/admin/ui/views/Account/graphql.d.ts +0 -2
- package/admin/ui/views/Account/graphql.js +0 -41
- package/admin/ui/views/Account/graphql.js.map +0 -1
- package/admin/ui/views/Users/graphql.d.ts +0 -5
- package/admin/ui/views/Users/graphql.js +0 -98
- package/admin/ui/views/Users/graphql.js.map +0 -1
package/Cognito.d.ts
CHANGED
|
@@ -1,4 +1,55 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
declare const federationSchema: z.ZodObject<{
|
|
3
|
+
domain: z.ZodString;
|
|
4
|
+
callbackUrls: z.ZodArray<z.ZodString>;
|
|
5
|
+
logoutUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
6
|
+
responseType: z.ZodDefault<z.ZodEnum<{
|
|
7
|
+
code: "code";
|
|
8
|
+
token: "token";
|
|
9
|
+
}>>;
|
|
10
|
+
allowCredentialsLogin: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
identityProviders: z.ZodArray<z.ZodObject<{
|
|
12
|
+
type: z.ZodEnum<{
|
|
13
|
+
amazon: "amazon";
|
|
14
|
+
apple: "apple";
|
|
15
|
+
facebook: "facebook";
|
|
16
|
+
google: "google";
|
|
17
|
+
oidc: "oidc";
|
|
18
|
+
}>;
|
|
19
|
+
name: z.ZodOptional<z.ZodString>;
|
|
20
|
+
label: z.ZodString;
|
|
21
|
+
providerDetails: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
22
|
+
idpIdentifiers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
attributeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
2
26
|
export declare const Cognito: import("@webiny/project/defineExtension/defineExtension").ExtensionComponent<z.ZodObject<{
|
|
3
27
|
apiConfig: z.ZodOptional<z.ZodString>;
|
|
28
|
+
adminConfig: z.ZodOptional<z.ZodString>;
|
|
29
|
+
federation: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
30
|
+
domain: z.ZodString;
|
|
31
|
+
callbackUrls: z.ZodArray<z.ZodString>;
|
|
32
|
+
logoutUrls: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
responseType: z.ZodDefault<z.ZodEnum<{
|
|
34
|
+
code: "code";
|
|
35
|
+
token: "token";
|
|
36
|
+
}>>;
|
|
37
|
+
allowCredentialsLogin: z.ZodDefault<z.ZodBoolean>;
|
|
38
|
+
identityProviders: z.ZodArray<z.ZodObject<{
|
|
39
|
+
type: z.ZodEnum<{
|
|
40
|
+
amazon: "amazon";
|
|
41
|
+
apple: "apple";
|
|
42
|
+
facebook: "facebook";
|
|
43
|
+
google: "google";
|
|
44
|
+
oidc: "oidc";
|
|
45
|
+
}>;
|
|
46
|
+
name: z.ZodOptional<z.ZodString>;
|
|
47
|
+
label: z.ZodString;
|
|
48
|
+
providerDetails: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
49
|
+
idpIdentifiers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
attributeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
51
|
+
}, z.core.$strip>>;
|
|
52
|
+
}, z.core.$strip>, z.ZodCustom<() => Promise<z.infer<typeof federationSchema>>, () => Promise<z.infer<typeof federationSchema>>>]>>;
|
|
53
|
+
mfa: z.ZodDefault<z.ZodBoolean>;
|
|
4
54
|
}, z.core.$strip>>;
|
|
55
|
+
export {};
|
package/Cognito.js
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
3
3
|
import { Admin, Api, Infra } from "@webiny/project-aws";
|
|
4
|
+
import { Await } from "@webiny/react-properties";
|
|
4
5
|
import { z } from "zod";
|
|
6
|
+
const identityProviderSchema = z.object({
|
|
7
|
+
type: z["enum"]([
|
|
8
|
+
"google",
|
|
9
|
+
"facebook",
|
|
10
|
+
"amazon",
|
|
11
|
+
"apple",
|
|
12
|
+
"oidc"
|
|
13
|
+
]),
|
|
14
|
+
name: z.string().optional(),
|
|
15
|
+
label: z.string(),
|
|
16
|
+
providerDetails: z.record(z.string(), z.any()),
|
|
17
|
+
idpIdentifiers: z.array(z.string()).optional(),
|
|
18
|
+
attributeMapping: z.record(z.string(), z.string()).optional()
|
|
19
|
+
});
|
|
20
|
+
const federationSchema = z.object({
|
|
21
|
+
domain: z.string().describe("Cognito User Pool domain prefix."),
|
|
22
|
+
callbackUrls: z.array(z.string()).describe("OAuth callback URLs."),
|
|
23
|
+
logoutUrls: z.array(z.string()).optional(),
|
|
24
|
+
responseType: z["enum"]([
|
|
25
|
+
"code",
|
|
26
|
+
"token"
|
|
27
|
+
]).default("code"),
|
|
28
|
+
allowCredentialsLogin: z.boolean().default(true),
|
|
29
|
+
identityProviders: z.array(identityProviderSchema)
|
|
30
|
+
});
|
|
5
31
|
const Cognito = defineExtension({
|
|
6
32
|
type: "Project/Cognito",
|
|
7
33
|
tags: {
|
|
@@ -9,19 +35,67 @@ const Cognito = defineExtension({
|
|
|
9
35
|
},
|
|
10
36
|
description: "Enable and configure Cognito authentication.",
|
|
11
37
|
paramsSchema: z.object({
|
|
12
|
-
apiConfig: z.string().describe("Path to API configuration.").optional()
|
|
38
|
+
apiConfig: z.string().describe("Path to API configuration.").optional(),
|
|
39
|
+
adminConfig: z.string().describe("Path to Admin configuration.").optional(),
|
|
40
|
+
federation: z.union([
|
|
41
|
+
federationSchema,
|
|
42
|
+
z.custom((val)=>"function" == typeof val)
|
|
43
|
+
]).optional(),
|
|
44
|
+
mfa: z.boolean().describe("Enable TOTP MFA for all users.").default(false)
|
|
13
45
|
}),
|
|
14
|
-
render: (props)
|
|
46
|
+
render: (props)=>{
|
|
47
|
+
const federationProp = props.federation;
|
|
48
|
+
const federationFn = federationProp ? "function" == typeof federationProp ? federationProp : ()=>Promise.resolve(federationProp) : null;
|
|
49
|
+
return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Infra.EnvVar, {
|
|
15
50
|
varName: "REACT_APP_IDP_TYPE",
|
|
16
51
|
value: "cognito"
|
|
17
|
-
}), /*#__PURE__*/ react.createElement(
|
|
52
|
+
}), props.mfa ? /*#__PURE__*/ react.createElement(Infra.EnvVar, {
|
|
53
|
+
varName: "COGNITO_MFA",
|
|
54
|
+
value: "true"
|
|
55
|
+
}) : null, /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
18
56
|
src: import.meta.dirname + "/api/CognitoApiFeature.js",
|
|
19
57
|
exportName: "CognitoApiFeature"
|
|
20
58
|
}), props.apiConfig ? /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
21
59
|
src: props.apiConfig
|
|
22
60
|
}) : null, /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
23
61
|
src: import.meta.dirname + "/admin/Extension.js"
|
|
24
|
-
})
|
|
62
|
+
}), props.adminConfig ? /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
63
|
+
src: props.adminConfig
|
|
64
|
+
}) : null, federationFn ? /*#__PURE__*/ react.createElement(Await, {
|
|
65
|
+
fn: federationFn
|
|
66
|
+
}, (federation)=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
67
|
+
src: import.meta.dirname + "/admin/SignInExtension.js",
|
|
68
|
+
exportName: "SignInExtension"
|
|
69
|
+
}), /*#__PURE__*/ react.createElement(Infra.EnvVar, {
|
|
70
|
+
varName: "COGNITO_FEDERATION_INFRA_CONFIG",
|
|
71
|
+
value: JSON.stringify({
|
|
72
|
+
domain: federation.domain,
|
|
73
|
+
callbackUrls: federation.callbackUrls,
|
|
74
|
+
logoutUrls: federation.logoutUrls,
|
|
75
|
+
identityProviders: federation.identityProviders.map((idp)=>({
|
|
76
|
+
type: idp.type,
|
|
77
|
+
name: idp.name,
|
|
78
|
+
providerDetails: idp.providerDetails,
|
|
79
|
+
idpIdentifiers: idp.idpIdentifiers,
|
|
80
|
+
attributeMapping: idp.attributeMapping
|
|
81
|
+
}))
|
|
82
|
+
})
|
|
83
|
+
}), /*#__PURE__*/ react.createElement(Infra.Core.Pulumi, {
|
|
84
|
+
src: import.meta.dirname + "/infra/CognitoFederationPulumi.js"
|
|
85
|
+
}), /*#__PURE__*/ react.createElement(Admin.BuildParam, {
|
|
86
|
+
paramName: "cognitoFederation",
|
|
87
|
+
value: {
|
|
88
|
+
callbackUrls: federation.callbackUrls,
|
|
89
|
+
logoutUrls: federation.logoutUrls || federation.callbackUrls,
|
|
90
|
+
responseType: federation.responseType,
|
|
91
|
+
allowCredentialsLogin: federation.allowCredentialsLogin,
|
|
92
|
+
providers: federation.identityProviders.map((idp)=>({
|
|
93
|
+
name: idp.name || idp.type,
|
|
94
|
+
label: idp.label
|
|
95
|
+
}))
|
|
96
|
+
}
|
|
97
|
+
}))) : null);
|
|
98
|
+
}
|
|
25
99
|
});
|
|
26
100
|
export { Cognito };
|
|
27
101
|
|
package/Cognito.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cognito.js","sources":["../src/Cognito.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { Api, Admin, Infra } from \"@webiny/project-aws\";\nimport { z } from \"zod\";\n\nexport const Cognito = defineExtension({\n type: \"Project/Cognito\",\n tags: { runtimeContext: \"project\" },\n description: \"Enable and configure Cognito authentication.\",\n paramsSchema: z.object({\n apiConfig: z.string().describe(\"Path to API configuration.\").optional()\n }),\n render: props => {\n return (\n <>\n <Infra.EnvVar varName={\"REACT_APP_IDP_TYPE\"} value={\"cognito\"} />\n {/* Api extensions */}\n <Api.Extension\n src={import.meta.dirname + \"/api/CognitoApiFeature.js\"}\n exportName={\"CognitoApiFeature\"}\n />\n {props.apiConfig ? <Api.Extension src={props.apiConfig} /> : null}\n {/* Admin extensions */}\n <Admin.Extension src={import.meta.dirname + \"/admin/Extension.js\"} />\n </>\n );\n }\n});\n"],"names":["Cognito","defineExtension","
|
|
1
|
+
{"version":3,"file":"Cognito.js","sources":["../src/Cognito.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { Api, Admin, Infra } from \"@webiny/project-aws\";\nimport { Await } from \"@webiny/react-properties\";\nimport { z } from \"zod\";\n\nconst identityProviderSchema = z.object({\n type: z.enum([\"google\", \"facebook\", \"amazon\", \"apple\", \"oidc\"]),\n name: z.string().optional(),\n label: z.string(),\n providerDetails: z.record(z.string(), z.any()),\n idpIdentifiers: z.array(z.string()).optional(),\n attributeMapping: z.record(z.string(), z.string()).optional()\n});\n\nconst federationSchema = z.object({\n domain: z.string().describe(\"Cognito User Pool domain prefix.\"),\n callbackUrls: z.array(z.string()).describe(\"OAuth callback URLs.\"),\n logoutUrls: z.array(z.string()).optional(),\n responseType: z.enum([\"code\", \"token\"]).default(\"code\"),\n allowCredentialsLogin: z.boolean().default(true),\n identityProviders: z.array(identityProviderSchema)\n});\n\nexport const Cognito = defineExtension({\n type: \"Project/Cognito\",\n tags: { runtimeContext: \"project\" },\n description: \"Enable and configure Cognito authentication.\",\n paramsSchema: z.object({\n apiConfig: z.string().describe(\"Path to API configuration.\").optional(),\n adminConfig: z.string().describe(\"Path to Admin configuration.\").optional(),\n federation: z\n .union([\n federationSchema,\n z.custom<() => Promise<z.infer<typeof federationSchema>>>(\n val => typeof val === \"function\"\n )\n ])\n .optional(),\n mfa: z.boolean().describe(\"Enable TOTP MFA for all users.\").default(false)\n }),\n render: props => {\n const federationProp = props.federation;\n const federationFn = federationProp\n ? typeof federationProp === \"function\"\n ? federationProp\n : () => Promise.resolve(federationProp)\n : null;\n\n return (\n <>\n <Infra.EnvVar varName={\"REACT_APP_IDP_TYPE\"} value={\"cognito\"} />\n {props.mfa ? <Infra.EnvVar varName={\"COGNITO_MFA\"} value={\"true\"} /> : null}\n\n {/* Api extensions */}\n <Api.Extension\n src={import.meta.dirname + \"/api/CognitoApiFeature.js\"}\n exportName={\"CognitoApiFeature\"}\n />\n {props.apiConfig ? <Api.Extension src={props.apiConfig} /> : null}\n\n {/* Admin extensions */}\n <Admin.Extension src={import.meta.dirname + \"/admin/Extension.js\"} />\n {props.adminConfig ? <Admin.Extension src={props.adminConfig} /> : null}\n\n {/* Federation infra + admin config */}\n {federationFn ? (\n <Await fn={federationFn}>\n {federation => (\n <>\n <Admin.Extension\n src={import.meta.dirname + \"/admin/SignInExtension.js\"}\n exportName={\"SignInExtension\"}\n />\n <Infra.EnvVar\n varName={\"COGNITO_FEDERATION_INFRA_CONFIG\"}\n value={JSON.stringify({\n domain: federation.domain,\n callbackUrls: federation.callbackUrls,\n logoutUrls: federation.logoutUrls,\n identityProviders: federation.identityProviders.map(\n idp => ({\n type: idp.type,\n name: idp.name,\n providerDetails: idp.providerDetails,\n idpIdentifiers: idp.idpIdentifiers,\n attributeMapping: idp.attributeMapping\n })\n )\n })}\n />\n <Infra.Core.Pulumi\n src={import.meta.dirname + \"/infra/CognitoFederationPulumi.js\"}\n />\n <Admin.BuildParam\n paramName={\"cognitoFederation\"}\n value={{\n callbackUrls: federation.callbackUrls,\n logoutUrls:\n federation.logoutUrls || federation.callbackUrls,\n responseType: federation.responseType,\n allowCredentialsLogin: federation.allowCredentialsLogin,\n providers: federation.identityProviders.map(idp => ({\n name: idp.name || idp.type,\n label: idp.label\n }))\n }}\n />\n </>\n )}\n </Await>\n ) : null}\n </>\n );\n }\n});\n"],"names":["identityProviderSchema","z","federationSchema","Cognito","defineExtension","val","props","federationProp","federationFn","Promise","Infra","Api","Admin","Await","federation","JSON","idp"],"mappings":"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"}
|
package/admin/Cognito.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ import { type CognitoLoginProps } from "./CognitoLogin.js";
|
|
|
3
3
|
export interface CognitoAdminProps {
|
|
4
4
|
login: CognitoLoginProps;
|
|
5
5
|
}
|
|
6
|
-
|
|
6
|
+
declare const CognitoIdP: (props: CognitoAdminProps) => React.JSX.Element;
|
|
7
|
+
export declare const CognitoAdmin: React.MemoExoticComponent<typeof CognitoIdP>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BuildParams } from "@webiny/app-admin/features/buildParams/index.js";
|
|
2
|
+
import { type ICognitoSignInConfig } from "./presentation/Cognito/CognitoSignInConfig.js";
|
|
3
|
+
declare class DefaultCognitoSignInConfigImpl implements ICognitoSignInConfig {
|
|
4
|
+
private buildParams;
|
|
5
|
+
constructor(buildParams: BuildParams.Interface);
|
|
6
|
+
getConfig(): Promise<{
|
|
7
|
+
oauth: {
|
|
8
|
+
scopes: string[];
|
|
9
|
+
redirectSignIn: string[];
|
|
10
|
+
redirectSignOut: string[];
|
|
11
|
+
responseType: "code" | "token";
|
|
12
|
+
};
|
|
13
|
+
allowCredentialsLogin: boolean;
|
|
14
|
+
providers: {
|
|
15
|
+
name: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}[];
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare const DefaultCognitoSignInConfig: typeof DefaultCognitoSignInConfigImpl & {
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<ICognitoSignInConfig>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BuildParams } from "@webiny/app-admin/features/buildParams/index.js";
|
|
2
|
+
import { CognitoSignInConfig } from "./presentation/Cognito/CognitoSignInConfig.js";
|
|
3
|
+
class DefaultCognitoSignInConfigImpl {
|
|
4
|
+
constructor(buildParams){
|
|
5
|
+
this.buildParams = buildParams;
|
|
6
|
+
}
|
|
7
|
+
async getConfig() {
|
|
8
|
+
const config = this.buildParams.get("cognitoFederation");
|
|
9
|
+
if (!config) return {
|
|
10
|
+
oauth: {
|
|
11
|
+
scopes: [
|
|
12
|
+
"profile",
|
|
13
|
+
"email",
|
|
14
|
+
"openid"
|
|
15
|
+
],
|
|
16
|
+
redirectSignIn: [
|
|
17
|
+
window.location.origin
|
|
18
|
+
],
|
|
19
|
+
redirectSignOut: [
|
|
20
|
+
window.location.origin
|
|
21
|
+
],
|
|
22
|
+
responseType: "code"
|
|
23
|
+
},
|
|
24
|
+
allowCredentialsLogin: true,
|
|
25
|
+
providers: []
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
oauth: {
|
|
29
|
+
scopes: [
|
|
30
|
+
"profile",
|
|
31
|
+
"email",
|
|
32
|
+
"openid"
|
|
33
|
+
],
|
|
34
|
+
redirectSignIn: config.callbackUrls,
|
|
35
|
+
redirectSignOut: config.logoutUrls,
|
|
36
|
+
responseType: config.responseType
|
|
37
|
+
},
|
|
38
|
+
allowCredentialsLogin: config.allowCredentialsLogin,
|
|
39
|
+
providers: config.providers
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const DefaultCognitoSignInConfig = CognitoSignInConfig.createImplementation({
|
|
44
|
+
implementation: DefaultCognitoSignInConfigImpl,
|
|
45
|
+
dependencies: [
|
|
46
|
+
BuildParams
|
|
47
|
+
]
|
|
48
|
+
});
|
|
49
|
+
export { DefaultCognitoSignInConfig };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=DefaultCognitoSignInConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/DefaultCognitoSignInConfig.js","sources":["../../src/admin/DefaultCognitoSignInConfig.ts"],"sourcesContent":["import { BuildParams } from \"@webiny/app-admin/features/buildParams/index.js\";\nimport {\n CognitoSignInConfig,\n type ICognitoSignInConfig\n} from \"./presentation/Cognito/CognitoSignInConfig.js\";\n\ninterface FederationBuildParam {\n callbackUrls: string[];\n logoutUrls: string[];\n responseType: \"code\" | \"token\";\n allowCredentialsLogin: boolean;\n providers: { name: string; label: string }[];\n}\n\nclass DefaultCognitoSignInConfigImpl implements ICognitoSignInConfig {\n constructor(private buildParams: BuildParams.Interface) {}\n\n async getConfig() {\n const config = this.buildParams.get<FederationBuildParam>(\"cognitoFederation\");\n\n if (!config) {\n return {\n oauth: {\n scopes: [\"profile\", \"email\", \"openid\"],\n redirectSignIn: [window.location.origin],\n redirectSignOut: [window.location.origin],\n responseType: \"code\" as const\n },\n allowCredentialsLogin: true,\n providers: []\n };\n }\n\n return {\n oauth: {\n scopes: [\"profile\", \"email\", \"openid\"],\n redirectSignIn: config.callbackUrls,\n redirectSignOut: config.logoutUrls,\n responseType: config.responseType\n },\n allowCredentialsLogin: config.allowCredentialsLogin,\n providers: config.providers\n };\n }\n}\n\nexport const DefaultCognitoSignInConfig = CognitoSignInConfig.createImplementation({\n implementation: DefaultCognitoSignInConfigImpl,\n dependencies: [BuildParams]\n});\n"],"names":["DefaultCognitoSignInConfigImpl","buildParams","config","window","DefaultCognitoSignInConfig","CognitoSignInConfig","BuildParams"],"mappings":";;AAcA,MAAMA;IACF,YAAoBC,WAAkC,CAAE;aAApCA,WAAW,GAAXA;IAAqC;IAEzD,MAAM,YAAY;QACd,MAAMC,SAAS,IAAI,CAAC,WAAW,CAAC,GAAG,CAAuB;QAE1D,IAAI,CAACA,QACD,OAAO;YACH,OAAO;gBACH,QAAQ;oBAAC;oBAAW;oBAAS;iBAAS;gBACtC,gBAAgB;oBAACC,OAAO,QAAQ,CAAC,MAAM;iBAAC;gBACxC,iBAAiB;oBAACA,OAAO,QAAQ,CAAC,MAAM;iBAAC;gBACzC,cAAc;YAClB;YACA,uBAAuB;YACvB,WAAW,EAAE;QACjB;QAGJ,OAAO;YACH,OAAO;gBACH,QAAQ;oBAAC;oBAAW;oBAAS;iBAAS;gBACtC,gBAAgBD,OAAO,YAAY;gBACnC,iBAAiBA,OAAO,UAAU;gBAClC,cAAcA,OAAO,YAAY;YACrC;YACA,uBAAuBA,OAAO,qBAAqB;YACnD,WAAWA,OAAO,SAAS;QAC/B;IACJ;AACJ;AAEO,MAAME,6BAA6BC,oBAAoB,oBAAoB,CAAC;IAC/E,gBAAgBL;IAChB,cAAc;QAACM;KAAY;AAC/B"}
|
package/admin/Extension.js
CHANGED
|
@@ -3,6 +3,13 @@ import { RegisterFeature } from "@webiny/app-admin";
|
|
|
3
3
|
import { CognitoFeature } from "./presentation/Cognito/feature.js";
|
|
4
4
|
import { CognitoAdmin } from "./Cognito.js";
|
|
5
5
|
import { CognitoPermissionsFeature } from "./features/permissions/feature.js";
|
|
6
|
+
import { GetCurrentUserFeature } from "./features/account/getCurrentUser/index.js";
|
|
7
|
+
import { UpdateCurrentUserFeature } from "./features/account/updateCurrentUser/index.js";
|
|
8
|
+
import { ListUsersFeature } from "./features/users/listUsers/index.js";
|
|
9
|
+
import { GetUserFeature } from "./features/users/getUser/index.js";
|
|
10
|
+
import { CreateUserFeature } from "./features/users/createUser/index.js";
|
|
11
|
+
import { UpdateUserFeature } from "./features/users/updateUser/index.js";
|
|
12
|
+
import { DeleteUserFeature } from "./features/users/deleteUser/index.js";
|
|
6
13
|
const Extension = ()=>{
|
|
7
14
|
const region = process.env.REACT_APP_USER_POOL_REGION || "";
|
|
8
15
|
const userPoolId = process.env.REACT_APP_USER_POOL_ID || "";
|
|
@@ -11,6 +18,20 @@ const Extension = ()=>{
|
|
|
11
18
|
feature: CognitoFeature
|
|
12
19
|
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
13
20
|
feature: CognitoPermissionsFeature
|
|
21
|
+
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
22
|
+
feature: GetCurrentUserFeature
|
|
23
|
+
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
24
|
+
feature: UpdateCurrentUserFeature
|
|
25
|
+
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
26
|
+
feature: ListUsersFeature
|
|
27
|
+
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
28
|
+
feature: GetUserFeature
|
|
29
|
+
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
30
|
+
feature: CreateUserFeature
|
|
31
|
+
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
32
|
+
feature: UpdateUserFeature
|
|
33
|
+
}), /*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
34
|
+
feature: DeleteUserFeature
|
|
14
35
|
}), /*#__PURE__*/ react.createElement(CognitoAdmin, {
|
|
15
36
|
login: {
|
|
16
37
|
region,
|
package/admin/Extension.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { CognitoFeature } from \"./presentation/Cognito/feature.js\";\nimport { CognitoAdmin } from \"./Cognito.js\";\nimport { CognitoPermissionsFeature } from \"./features/permissions/feature.js\";\n\nexport const Extension = () => {\n const region = process.env.REACT_APP_USER_POOL_REGION || \"\";\n const userPoolId = process.env.REACT_APP_USER_POOL_ID || \"\";\n const clientId = process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID || \"\";\n\n return (\n <>\n <RegisterFeature feature={CognitoFeature} />\n <RegisterFeature feature={CognitoPermissionsFeature} />\n <CognitoAdmin\n login={{\n region,\n userPoolId,\n clientId\n }}\n />\n </>\n );\n};\n"],"names":["Extension","region","process","userPoolId","clientId","RegisterFeature","CognitoFeature","CognitoPermissionsFeature","CognitoAdmin"],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin/Extension.js","sources":["../../src/admin/Extension.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { CognitoFeature } from \"./presentation/Cognito/feature.js\";\nimport { CognitoAdmin } from \"./Cognito.js\";\nimport { CognitoPermissionsFeature } from \"./features/permissions/feature.js\";\nimport { GetCurrentUserFeature } from \"./features/account/getCurrentUser/index.js\";\nimport { UpdateCurrentUserFeature } from \"./features/account/updateCurrentUser/index.js\";\nimport { ListUsersFeature } from \"./features/users/listUsers/index.js\";\nimport { GetUserFeature } from \"./features/users/getUser/index.js\";\nimport { CreateUserFeature } from \"./features/users/createUser/index.js\";\nimport { UpdateUserFeature } from \"./features/users/updateUser/index.js\";\nimport { DeleteUserFeature } from \"./features/users/deleteUser/index.js\";\n\nexport const Extension = () => {\n const region = process.env.REACT_APP_USER_POOL_REGION || \"\";\n const userPoolId = process.env.REACT_APP_USER_POOL_ID || \"\";\n const clientId = process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID || \"\";\n\n return (\n <>\n <RegisterFeature feature={CognitoFeature} />\n <RegisterFeature feature={CognitoPermissionsFeature} />\n <RegisterFeature feature={GetCurrentUserFeature} />\n <RegisterFeature feature={UpdateCurrentUserFeature} />\n <RegisterFeature feature={ListUsersFeature} />\n <RegisterFeature feature={GetUserFeature} />\n <RegisterFeature feature={CreateUserFeature} />\n <RegisterFeature feature={UpdateUserFeature} />\n <RegisterFeature feature={DeleteUserFeature} />\n <CognitoAdmin\n login={{\n region,\n userPoolId,\n clientId\n }}\n />\n </>\n );\n};\n"],"names":["Extension","region","process","userPoolId","clientId","RegisterFeature","CognitoFeature","CognitoPermissionsFeature","GetCurrentUserFeature","UpdateCurrentUserFeature","ListUsersFeature","GetUserFeature","CreateUserFeature","UpdateUserFeature","DeleteUserFeature","CognitoAdmin"],"mappings":";;;;;;;;;;;;AAaO,MAAMA,YAAY;IACrB,MAAMC,SAASC,QAAQ,GAAG,CAAC,0BAA0B,IAAI;IACzD,MAAMC,aAAaD,QAAQ,GAAG,CAAC,sBAAsB,IAAI;IACzD,MAAME,WAAWF,QAAQ,GAAG,CAAC,iCAAiC,IAAI;IAElE,OAAO,WAAP,GACI,wDACI,oBAACG,iBAAeA;QAAC,SAASC;sBAC1B,oBAACD,iBAAeA;QAAC,SAASE;sBAC1B,oBAACF,iBAAeA;QAAC,SAASG;sBAC1B,oBAACH,iBAAeA;QAAC,SAASI;sBAC1B,oBAACJ,iBAAeA;QAAC,SAASK;sBAC1B,oBAACL,iBAAeA;QAAC,SAASM;sBAC1B,oBAACN,iBAAeA;QAAC,SAASO;sBAC1B,oBAACP,iBAAeA;QAAC,SAASQ;sBAC1B,oBAACR,iBAAeA;QAAC,SAASS;sBAC1B,oBAACC,cAAYA;QACT,OAAO;YACHd;YACAE;YACAC;QACJ;;AAIhB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { RegisterFeature } from "@webiny/app-admin";
|
|
3
|
+
import { CognitoSignInFeature } from "./presentation/Cognito/signInFeature.js";
|
|
4
|
+
const SignInExtension = ()=>/*#__PURE__*/ react.createElement(RegisterFeature, {
|
|
5
|
+
feature: CognitoSignInFeature
|
|
6
|
+
});
|
|
7
|
+
export { SignInExtension };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=SignInExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/SignInExtension.js","sources":["../../src/admin/SignInExtension.tsx"],"sourcesContent":["import React from \"react\";\nimport { RegisterFeature } from \"@webiny/app-admin\";\nimport { CognitoSignInFeature } from \"./presentation/Cognito/signInFeature.js\";\n\nexport const SignInExtension = () => {\n return <RegisterFeature feature={CognitoSignInFeature} />;\n};\n"],"names":["SignInExtension","RegisterFeature","CognitoSignInFeature"],"mappings":";;;AAIO,MAAMA,kBAAkB,IACpB,WAAP,GAAO,oBAACC,iBAAeA;QAAC,SAASC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { GetCurrentUserGateway as GatewayAbstraction } from "./abstractions/index.js";
|
|
2
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient";
|
|
3
|
+
declare class GetCurrentUserGatewayImpl implements GatewayAbstraction.Interface {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: MainGraphQLClient.Interface);
|
|
6
|
+
execute(): Promise<GatewayAbstraction.Result>;
|
|
7
|
+
}
|
|
8
|
+
export declare const GetCurrentUserGateway: typeof GetCurrentUserGatewayImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/GetCurrentUserGateway.js").IGetCurrentUserGateway>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { GetCurrentUserGateway } from "./abstractions/index.js";
|
|
2
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient";
|
|
3
|
+
const GET_CURRENT_USER = `
|
|
4
|
+
query GetCurrentUser {
|
|
5
|
+
adminUsers {
|
|
6
|
+
user: getCurrentUser {
|
|
7
|
+
data {
|
|
8
|
+
id
|
|
9
|
+
email
|
|
10
|
+
firstName
|
|
11
|
+
lastName
|
|
12
|
+
avatar
|
|
13
|
+
external
|
|
14
|
+
}
|
|
15
|
+
error {
|
|
16
|
+
code
|
|
17
|
+
message
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
class GetCurrentUserGatewayImpl {
|
|
24
|
+
constructor(client){
|
|
25
|
+
this.client = client;
|
|
26
|
+
}
|
|
27
|
+
async execute() {
|
|
28
|
+
const response = await this.client.execute({
|
|
29
|
+
query: GET_CURRENT_USER
|
|
30
|
+
});
|
|
31
|
+
const { data, error } = response.adminUsers.user;
|
|
32
|
+
if (!data) throw new Error(error?.message || "Could not fetch current user.");
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const GetCurrentUserGateway_GetCurrentUserGateway = GetCurrentUserGateway.createImplementation({
|
|
37
|
+
implementation: GetCurrentUserGatewayImpl,
|
|
38
|
+
dependencies: [
|
|
39
|
+
MainGraphQLClient
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
export { GetCurrentUserGateway_GetCurrentUserGateway as GetCurrentUserGateway };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=GetCurrentUserGateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/account/getCurrentUser/GetCurrentUserGateway.js","sources":["../../../../../src/admin/features/account/getCurrentUser/GetCurrentUserGateway.ts"],"sourcesContent":["import { GetCurrentUserGateway as GatewayAbstraction } from \"./abstractions/index.js\";\nimport { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient\";\n\nconst GET_CURRENT_USER = /* GraphQL */ `\n query GetCurrentUser {\n adminUsers {\n user: getCurrentUser {\n data {\n id\n email\n firstName\n lastName\n avatar\n external\n }\n error {\n code\n message\n }\n }\n }\n }\n`;\n\ntype GetCurrentUserResponse = {\n adminUsers: {\n user:\n | { data: GatewayAbstraction.Result; error: null }\n | { data: null; error: { code: string; message: string } };\n };\n};\n\nclass GetCurrentUserGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private readonly client: MainGraphQLClient.Interface) {}\n\n async execute(): Promise<GatewayAbstraction.Result> {\n const response = await this.client.execute<GetCurrentUserResponse>({\n query: GET_CURRENT_USER\n });\n\n const { data, error } = response.adminUsers.user;\n\n if (!data) {\n throw new Error(error?.message || \"Could not fetch current user.\");\n }\n\n return data;\n }\n}\n\nexport const GetCurrentUserGateway = GatewayAbstraction.createImplementation({\n implementation: GetCurrentUserGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["GET_CURRENT_USER","GetCurrentUserGatewayImpl","client","response","data","error","Error","GetCurrentUserGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAGA,MAAMA,mBAAiC,CAAC;;;;;;;;;;;;;;;;;;;AAmBxC,CAAC;AAUD,MAAMC;IACF,YAA6BC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAEnE,MAAM,UAA8C;QAChD,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAyB;YAC/D,OAAOH;QACX;QAEA,MAAM,EAAEI,IAAI,EAAEC,KAAK,EAAE,GAAGF,SAAS,UAAU,CAAC,IAAI;QAEhD,IAAI,CAACC,MACD,MAAM,IAAIE,MAAMD,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAMG,8CAAwBC,sBAAAA,oBAAuC,CAAC;IACzE,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GetCurrentUserUseCase as UseCaseAbstraction, GetCurrentUserGateway } from "./abstractions/index.js";
|
|
2
|
+
declare class GetCurrentUserUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
3
|
+
private readonly gateway;
|
|
4
|
+
constructor(gateway: GetCurrentUserGateway.Interface);
|
|
5
|
+
execute(): Promise<UseCaseAbstraction.Result>;
|
|
6
|
+
}
|
|
7
|
+
export declare const GetCurrentUserUseCase: typeof GetCurrentUserUseCaseImpl & {
|
|
8
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/GetCurrentUserUseCase.js").IGetCurrentUserUseCase>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GetCurrentUserGateway, GetCurrentUserUseCase } from "./abstractions/index.js";
|
|
2
|
+
class GetCurrentUserUseCaseImpl {
|
|
3
|
+
constructor(gateway){
|
|
4
|
+
this.gateway = gateway;
|
|
5
|
+
}
|
|
6
|
+
async execute() {
|
|
7
|
+
const result = await this.gateway.execute();
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const GetCurrentUserUseCase_GetCurrentUserUseCase = GetCurrentUserUseCase.createImplementation({
|
|
12
|
+
implementation: GetCurrentUserUseCaseImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
GetCurrentUserGateway
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export { GetCurrentUserUseCase_GetCurrentUserUseCase as GetCurrentUserUseCase };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=GetCurrentUserUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/account/getCurrentUser/GetCurrentUserUseCase.js","sources":["../../../../../src/admin/features/account/getCurrentUser/GetCurrentUserUseCase.ts"],"sourcesContent":["import {\n GetCurrentUserUseCase as UseCaseAbstraction,\n GetCurrentUserGateway\n} from \"./abstractions/index.js\";\n\nclass GetCurrentUserUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private readonly gateway: GetCurrentUserGateway.Interface) {}\n\n async execute(): Promise<UseCaseAbstraction.Result> {\n const result = await this.gateway.execute();\n return result;\n }\n}\n\nexport const GetCurrentUserUseCase = UseCaseAbstraction.createImplementation({\n implementation: GetCurrentUserUseCaseImpl,\n dependencies: [GetCurrentUserGateway]\n});\n"],"names":["GetCurrentUserUseCaseImpl","gateway","result","GetCurrentUserUseCase","UseCaseAbstraction","GetCurrentUserGateway"],"mappings":";AAKA,MAAMA;IACF,YAA6BC,OAAwC,CAAE;aAA1CA,OAAO,GAAPA;IAA2C;IAExE,MAAM,UAA8C;QAChD,MAAMC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO;QACzC,OAAOA;IACX;AACJ;AAEO,MAAMC,8CAAwBC,sBAAAA,oBAAuC,CAAC;IACzE,gBAAgBJ;IAChB,cAAc;QAACK;KAAsB;AACzC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface IGetCurrentUserGatewayResult {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
avatar: any;
|
|
7
|
+
external: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface IGetCurrentUserGateway {
|
|
10
|
+
execute(): Promise<IGetCurrentUserGatewayResult>;
|
|
11
|
+
}
|
|
12
|
+
export declare const GetCurrentUserGateway: import("@webiny/di").Abstraction<IGetCurrentUserGateway>;
|
|
13
|
+
export declare namespace GetCurrentUserGateway {
|
|
14
|
+
type Interface = IGetCurrentUserGateway;
|
|
15
|
+
type Result = IGetCurrentUserGatewayResult;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/account/getCurrentUser/abstractions/GetCurrentUserGateway.js","sources":["../../../../../../src/admin/features/account/getCurrentUser/abstractions/GetCurrentUserGateway.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface IGetCurrentUserGatewayResult {\n id: string;\n email: string;\n firstName: string;\n lastName: string;\n avatar: any;\n external: boolean;\n}\n\nexport interface IGetCurrentUserGateway {\n execute(): Promise<IGetCurrentUserGatewayResult>;\n}\n\nexport const GetCurrentUserGateway = createAbstraction<IGetCurrentUserGateway>(\n \"Cognito/GetCurrentUserGateway\"\n);\n\nexport namespace GetCurrentUserGateway {\n export type Interface = IGetCurrentUserGateway;\n export type Result = IGetCurrentUserGatewayResult;\n}\n"],"names":["GetCurrentUserGateway","createAbstraction"],"mappings":";AAeO,MAAMA,wBAAwBC,kBACjC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IGetCurrentUserGatewayResult } from "./GetCurrentUserGateway.js";
|
|
2
|
+
export type IGetCurrentUserUseCaseResult = IGetCurrentUserGatewayResult;
|
|
3
|
+
export interface IGetCurrentUserUseCase {
|
|
4
|
+
execute(): Promise<IGetCurrentUserUseCaseResult>;
|
|
5
|
+
}
|
|
6
|
+
export declare const GetCurrentUserUseCase: import("@webiny/di").Abstraction<IGetCurrentUserUseCase>;
|
|
7
|
+
export declare namespace GetCurrentUserUseCase {
|
|
8
|
+
type Interface = IGetCurrentUserUseCase;
|
|
9
|
+
type Result = IGetCurrentUserUseCaseResult;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/account/getCurrentUser/abstractions/GetCurrentUserUseCase.js","sources":["../../../../../../src/admin/features/account/getCurrentUser/abstractions/GetCurrentUserUseCase.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { IGetCurrentUserGatewayResult } from \"./GetCurrentUserGateway.js\";\n\nexport type IGetCurrentUserUseCaseResult = IGetCurrentUserGatewayResult;\n\nexport interface IGetCurrentUserUseCase {\n execute(): Promise<IGetCurrentUserUseCaseResult>;\n}\n\nexport const GetCurrentUserUseCase = createAbstraction<IGetCurrentUserUseCase>(\n \"Cognito/GetCurrentUserUseCase\"\n);\n\nexport namespace GetCurrentUserUseCase {\n export type Interface = IGetCurrentUserUseCase;\n export type Result = IGetCurrentUserUseCaseResult;\n}\n"],"names":["GetCurrentUserUseCase","createAbstraction"],"mappings":";AASO,MAAMA,wBAAwBC,kBACjC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { GetCurrentUserGateway } from "./GetCurrentUserGateway.js";
|
|
2
|
+
export type { IGetCurrentUserGateway } from "./GetCurrentUserGateway.js";
|
|
3
|
+
export type { IGetCurrentUserGatewayResult } from "./GetCurrentUserGateway.js";
|
|
4
|
+
export { GetCurrentUserUseCase } from "./GetCurrentUserUseCase.js";
|
|
5
|
+
export type { IGetCurrentUserUseCase } from "./GetCurrentUserUseCase.js";
|
|
6
|
+
export type { IGetCurrentUserUseCaseResult } from "./GetCurrentUserUseCase.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { GetCurrentUserUseCase } from "./abstractions/index.js";
|
|
3
|
+
import { GetCurrentUserUseCase as external_GetCurrentUserUseCase_js_GetCurrentUserUseCase } from "./GetCurrentUserUseCase.js";
|
|
4
|
+
import { GetCurrentUserGateway } from "./GetCurrentUserGateway.js";
|
|
5
|
+
const GetCurrentUserFeature = createFeature({
|
|
6
|
+
name: "Cognito/GetCurrentUser",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(external_GetCurrentUserUseCase_js_GetCurrentUserUseCase);
|
|
9
|
+
container.register(GetCurrentUserGateway).inSingletonScope();
|
|
10
|
+
},
|
|
11
|
+
resolve (container) {
|
|
12
|
+
return {
|
|
13
|
+
useCase: container.resolve(GetCurrentUserUseCase)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { GetCurrentUserFeature };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/account/getCurrentUser/feature.js","sources":["../../../../../src/admin/features/account/getCurrentUser/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { GetCurrentUserUseCase as UseCaseAbstraction } from \"./abstractions/index.js\";\nimport { GetCurrentUserUseCase } from \"./GetCurrentUserUseCase.js\";\nimport { GetCurrentUserGateway } from \"./GetCurrentUserGateway.js\";\n\nexport const GetCurrentUserFeature = createFeature({\n name: \"Cognito/GetCurrentUser\",\n register(container) {\n container.register(GetCurrentUserUseCase);\n container.register(GetCurrentUserGateway).inSingletonScope();\n },\n resolve(container) {\n return {\n useCase: container.resolve(UseCaseAbstraction)\n };\n }\n});\n"],"names":["GetCurrentUserFeature","createFeature","container","GetCurrentUserUseCase","GetCurrentUserGateway","UseCaseAbstraction"],"mappings":";;;;AAKO,MAAMA,wBAAwBC,cAAc;IAC/C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,uBAAuB,gBAAgB;IAC9D;IACA,SAAQF,SAAS;QACb,OAAO;YACH,SAASA,UAAU,OAAO,CAACG;QAC/B;IACJ;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GetCurrentUserFeature } from "./feature.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { GetCurrentUserFeature } from "./feature.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UpdateCurrentUserGateway as GatewayAbstraction } from "./abstractions/index.js";
|
|
2
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient";
|
|
3
|
+
declare class UpdateCurrentUserGatewayImpl implements GatewayAbstraction.Interface {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: MainGraphQLClient.Interface);
|
|
6
|
+
execute(params: GatewayAbstraction.Params): Promise<GatewayAbstraction.Result>;
|
|
7
|
+
}
|
|
8
|
+
export declare const UpdateCurrentUserGateway: typeof UpdateCurrentUserGatewayImpl & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/UpdateCurrentUserGateway.js").IUpdateCurrentUserGateway>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { UpdateCurrentUserGateway } from "./abstractions/index.js";
|
|
2
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient";
|
|
3
|
+
const UPDATE_CURRENT_USER = `
|
|
4
|
+
mutation UpdateCurrentUser($data: AdminUsersCurrentUserInput!) {
|
|
5
|
+
adminUsers {
|
|
6
|
+
updateCurrentUser(data: $data) {
|
|
7
|
+
data {
|
|
8
|
+
id
|
|
9
|
+
email
|
|
10
|
+
firstName
|
|
11
|
+
lastName
|
|
12
|
+
avatar
|
|
13
|
+
external
|
|
14
|
+
}
|
|
15
|
+
error {
|
|
16
|
+
code
|
|
17
|
+
message
|
|
18
|
+
data
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
class UpdateCurrentUserGatewayImpl {
|
|
25
|
+
constructor(client){
|
|
26
|
+
this.client = client;
|
|
27
|
+
}
|
|
28
|
+
async execute(params) {
|
|
29
|
+
const response = await this.client.execute({
|
|
30
|
+
query: UPDATE_CURRENT_USER,
|
|
31
|
+
variables: {
|
|
32
|
+
data: params
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const { data, error } = response.adminUsers.updateCurrentUser;
|
|
36
|
+
if (!data) throw new Error(error?.message || "Could not update current user.");
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const UpdateCurrentUserGateway_UpdateCurrentUserGateway = UpdateCurrentUserGateway.createImplementation({
|
|
41
|
+
implementation: UpdateCurrentUserGatewayImpl,
|
|
42
|
+
dependencies: [
|
|
43
|
+
MainGraphQLClient
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
export { UpdateCurrentUserGateway_UpdateCurrentUserGateway as UpdateCurrentUserGateway };
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=UpdateCurrentUserGateway.js.map
|