@webiny/cognito 6.4.5-beta.0 → 6.6.0-alpha.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/Cognito.d.ts +0 -51
- package/Cognito.js +4 -78
- package/Cognito.js.map +1 -1
- package/admin/Cognito.d.ts +3 -1
- package/admin/Extension.js +21 -0
- package/admin/Extension.js.map +1 -1
- 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/permissions/feature.d.ts +1 -1
- 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/presentation/Cognito/CognitoLoginScreen.js +0 -9
- package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -1
- package/admin/presentation/Cognito/CognitoPresenter.d.ts +1 -25
- package/admin/presentation/Cognito/CognitoPresenter.js +10 -122
- package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -1
- package/admin/presentation/Cognito/abstractions.d.ts +1 -20
- package/admin/presentation/Cognito/abstractions.js.map +1 -1
- package/admin/presentation/Cognito/components/Divider.d.ts +1 -19
- package/admin/presentation/Cognito/components/Divider.js +2 -3
- package/admin/presentation/Cognito/components/Divider.js.map +1 -1
- package/admin/presentation/Cognito/components/FederatedLogin.d.ts +5 -22
- package/admin/presentation/Cognito/components/FederatedLogin.js +6 -19
- package/admin/presentation/Cognito/components/FederatedLogin.js.map +1 -1
- package/admin/presentation/Cognito/components/FooterSignIn.d.ts +3 -20
- package/admin/presentation/Cognito/components/FooterSignIn.js +2 -3
- package/admin/presentation/Cognito/components/FooterSignIn.js.map +1 -1
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.d.ts +1 -19
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js +2 -3
- package/admin/presentation/Cognito/components/PasswordResetCodeSent.js.map +1 -1
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.d.ts +1 -19
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js +2 -3
- package/admin/presentation/Cognito/components/RequestPasswordResetCode.js.map +1 -1
- package/admin/presentation/Cognito/components/RequireNewPassword.d.ts +1 -19
- package/admin/presentation/Cognito/components/RequireNewPassword.js +2 -3
- package/admin/presentation/Cognito/components/RequireNewPassword.js.map +1 -1
- package/admin/presentation/Cognito/components/SetNewPassword.d.ts +1 -19
- package/admin/presentation/Cognito/components/SetNewPassword.js +2 -3
- package/admin/presentation/Cognito/components/SetNewPassword.js.map +1 -1
- package/admin/presentation/Cognito/components/SignIn.d.ts +3 -19
- package/admin/presentation/Cognito/components/SignIn.js +7 -14
- package/admin/presentation/Cognito/components/SignIn.js.map +1 -1
- package/admin/presentation/Cognito/components/View.d.ts +1 -1
- 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 +16 -22
- 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 -78
- package/admin/ui/views/Users/hooks/useUserForm.js.map +1 -1
- package/api/features/CognitoIdp/CognitoIdentityProvider.js +11 -15
- 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/graphql/user.gql.d.ts +2 -2
- package/api/graphql/user.gql.js +2 -2
- package/api/graphql/user.gql.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +18 -23
- package/admin/DefaultCognitoSignInConfig.d.ts +0 -23
- package/admin/DefaultCognitoSignInConfig.js +0 -51
- package/admin/DefaultCognitoSignInConfig.js.map +0 -1
- package/admin/SignInExtension.d.ts +0 -2
- package/admin/SignInExtension.js +0 -9
- package/admin/SignInExtension.js.map +0 -1
- package/admin/index.d.ts +0 -2
- package/admin/index.js +0 -2
- package/admin/presentation/Cognito/CognitoSignInConfig.d.ts +0 -31
- package/admin/presentation/Cognito/CognitoSignInConfig.js +0 -5
- package/admin/presentation/Cognito/CognitoSignInConfig.js.map +0 -1
- package/admin/presentation/Cognito/components/ConfirmTotpCode.d.ts +0 -26
- package/admin/presentation/Cognito/components/ConfirmTotpCode.js +0 -45
- package/admin/presentation/Cognito/components/ConfirmTotpCode.js.map +0 -1
- package/admin/presentation/Cognito/components/SetupTotp.d.ts +0 -25
- package/admin/presentation/Cognito/components/SetupTotp.js +0 -60
- package/admin/presentation/Cognito/components/SetupTotp.js.map +0 -1
- package/admin/presentation/Cognito/components/index.d.ts +0 -292
- package/admin/presentation/Cognito/components/index.js +0 -29
- package/admin/presentation/Cognito/components/index.js.map +0 -1
- package/admin/presentation/Cognito/signInFeature.d.ts +0 -1
- package/admin/presentation/Cognito/signInFeature.js +0 -11
- package/admin/presentation/Cognito/signInFeature.js.map +0 -1
- 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/api/index.d.ts +0 -1
- package/api/index.js +0 -1
- package/infra/CognitoFederationPulumi.d.ts +0 -8
- package/infra/CognitoFederationPulumi.js +0 -17
- package/infra/CognitoFederationPulumi.js.map +0 -1
package/Cognito.d.ts
CHANGED
|
@@ -1,55 +1,4 @@
|
|
|
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
|
-
google: "google";
|
|
14
|
-
facebook: "facebook";
|
|
15
|
-
amazon: "amazon";
|
|
16
|
-
apple: "apple";
|
|
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>;
|
|
26
2
|
export declare const Cognito: import("@webiny/project/defineExtension/defineExtension").ExtensionComponent<z.ZodObject<{
|
|
27
3
|
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
|
-
google: "google";
|
|
41
|
-
facebook: "facebook";
|
|
42
|
-
amazon: "amazon";
|
|
43
|
-
apple: "apple";
|
|
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>;
|
|
54
4
|
}, z.core.$strip>>;
|
|
55
|
-
export {};
|
package/Cognito.js
CHANGED
|
@@ -1,33 +1,7 @@
|
|
|
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";
|
|
5
4
|
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
|
-
});
|
|
31
5
|
const Cognito = defineExtension({
|
|
32
6
|
type: "Project/Cognito",
|
|
33
7
|
tags: {
|
|
@@ -35,67 +9,19 @@ const Cognito = defineExtension({
|
|
|
35
9
|
},
|
|
36
10
|
description: "Enable and configure Cognito authentication.",
|
|
37
11
|
paramsSchema: z.object({
|
|
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)
|
|
12
|
+
apiConfig: z.string().describe("Path to API configuration.").optional()
|
|
45
13
|
}),
|
|
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, {
|
|
14
|
+
render: (props)=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Infra.EnvVar, {
|
|
50
15
|
varName: "REACT_APP_IDP_TYPE",
|
|
51
16
|
value: "cognito"
|
|
52
|
-
}),
|
|
53
|
-
varName: "COGNITO_MFA",
|
|
54
|
-
value: "true"
|
|
55
|
-
}) : null, /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
17
|
+
}), /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
56
18
|
src: import.meta.dirname + "/api/CognitoApiFeature.js",
|
|
57
19
|
exportName: "CognitoApiFeature"
|
|
58
20
|
}), props.apiConfig ? /*#__PURE__*/ react.createElement(Api.Extension, {
|
|
59
21
|
src: props.apiConfig
|
|
60
22
|
}) : null, /*#__PURE__*/ react.createElement(Admin.Extension, {
|
|
61
23
|
src: import.meta.dirname + "/admin/Extension.js"
|
|
62
|
-
})
|
|
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
|
-
}
|
|
24
|
+
}))
|
|
99
25
|
});
|
|
100
26
|
export { Cognito };
|
|
101
27
|
|
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 {
|
|
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","z","props","Infra","Api","Admin"],"mappings":";;;;AAKO,MAAMA,UAAUC,gBAAgB;IACnC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,WAAWA,EAAE,MAAM,GAAG,QAAQ,CAAC,8BAA8B,QAAQ;IACzE;IACA,QAAQC,CAAAA,QACG,WAAP,GACI,wDACI,oBAACC,MAAM,MAAM;YAAC,SAAS;YAAsB,OAAO;0BAEpD,oBAACC,IAAI,SAAS;YACV,KAAK,YAAY,OAAO,GAAG;YAC3B,YAAY;YAEfF,MAAM,SAAS,GAAG,WAAH,GAAG,oBAACE,IAAI,SAAS;YAAC,KAAKF,MAAM,SAAS;aAAO,oBAE7D,oBAACG,MAAM,SAAS;YAAC,KAAK,YAAY,OAAO,GAAG;;AAI5D"}
|
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 {};
|
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 <
|
|
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,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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/account/updateCurrentUser/UpdateCurrentUserGateway.js","sources":["../../../../../src/admin/features/account/updateCurrentUser/UpdateCurrentUserGateway.ts"],"sourcesContent":["import { UpdateCurrentUserGateway as GatewayAbstraction } from \"./abstractions/index.js\";\nimport { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient\";\n\nconst UPDATE_CURRENT_USER = /* GraphQL */ `\n mutation UpdateCurrentUser($data: AdminUsersCurrentUserInput!) {\n adminUsers {\n updateCurrentUser(data: $data) {\n data {\n id\n email\n firstName\n lastName\n avatar\n external\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\ntype UpdateCurrentUserResponse = {\n adminUsers: {\n updateCurrentUser:\n | { data: GatewayAbstraction.Result; error: null }\n | { data: null; error: { code: string; message: string; data: any } };\n };\n};\n\nclass UpdateCurrentUserGatewayImpl implements GatewayAbstraction.Interface {\n constructor(private readonly client: MainGraphQLClient.Interface) {}\n\n async execute(params: GatewayAbstraction.Params): Promise<GatewayAbstraction.Result> {\n const response = await this.client.execute<UpdateCurrentUserResponse>({\n query: UPDATE_CURRENT_USER,\n variables: { data: params }\n });\n\n const { data, error } = response.adminUsers.updateCurrentUser;\n\n if (!data) {\n throw new Error(error?.message || \"Could not update current user.\");\n }\n\n return data;\n }\n}\n\nexport const UpdateCurrentUserGateway = GatewayAbstraction.createImplementation({\n implementation: UpdateCurrentUserGatewayImpl,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["UPDATE_CURRENT_USER","UpdateCurrentUserGatewayImpl","client","params","response","data","error","Error","UpdateCurrentUserGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAGA,MAAMA,sBAAoC,CAAC;;;;;;;;;;;;;;;;;;;;AAoB3C,CAAC;AAUD,MAAMC;IACF,YAA6BC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAEnE,MAAM,QAAQC,MAAiC,EAAsC;QACjF,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA4B;YAClE,OAAOJ;YACP,WAAW;gBAAE,MAAMG;YAAO;QAC9B;QAEA,MAAM,EAAEE,IAAI,EAAEC,KAAK,EAAE,GAAGF,SAAS,UAAU,CAAC,iBAAiB;QAE7D,IAAI,CAACC,MACD,MAAM,IAAIE,MAAMD,OAAO,WAAW;QAGtC,OAAOD;IACX;AACJ;AAEO,MAAMG,oDAA2BC,yBAAAA,oBAAuC,CAAC;IAC5E,gBAAgBR;IAChB,cAAc;QAACS;KAAkB;AACrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UpdateCurrentUserUseCase as UseCaseAbstraction, UpdateCurrentUserGateway } from "./abstractions/index.js";
|
|
2
|
+
declare class UpdateCurrentUserUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
3
|
+
private readonly gateway;
|
|
4
|
+
constructor(gateway: UpdateCurrentUserGateway.Interface);
|
|
5
|
+
execute(params: UseCaseAbstraction.Params): Promise<UseCaseAbstraction.Result>;
|
|
6
|
+
}
|
|
7
|
+
export declare const UpdateCurrentUserUseCase: typeof UpdateCurrentUserUseCaseImpl & {
|
|
8
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/UpdateCurrentUserUseCase.js").IUpdateCurrentUserUseCase>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UpdateCurrentUserGateway, UpdateCurrentUserUseCase } from "./abstractions/index.js";
|
|
2
|
+
class UpdateCurrentUserUseCaseImpl {
|
|
3
|
+
constructor(gateway){
|
|
4
|
+
this.gateway = gateway;
|
|
5
|
+
}
|
|
6
|
+
async execute(params) {
|
|
7
|
+
const result = await this.gateway.execute(params);
|
|
8
|
+
return result;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const UpdateCurrentUserUseCase_UpdateCurrentUserUseCase = UpdateCurrentUserUseCase.createImplementation({
|
|
12
|
+
implementation: UpdateCurrentUserUseCaseImpl,
|
|
13
|
+
dependencies: [
|
|
14
|
+
UpdateCurrentUserGateway
|
|
15
|
+
]
|
|
16
|
+
});
|
|
17
|
+
export { UpdateCurrentUserUseCase_UpdateCurrentUserUseCase as UpdateCurrentUserUseCase };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=UpdateCurrentUserUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/account/updateCurrentUser/UpdateCurrentUserUseCase.js","sources":["../../../../../src/admin/features/account/updateCurrentUser/UpdateCurrentUserUseCase.ts"],"sourcesContent":["import {\n UpdateCurrentUserUseCase as UseCaseAbstraction,\n UpdateCurrentUserGateway\n} from \"./abstractions/index.js\";\n\nclass UpdateCurrentUserUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private readonly gateway: UpdateCurrentUserGateway.Interface) {}\n\n async execute(params: UseCaseAbstraction.Params): Promise<UseCaseAbstraction.Result> {\n const result = await this.gateway.execute(params);\n return result;\n }\n}\n\nexport const UpdateCurrentUserUseCase = UseCaseAbstraction.createImplementation({\n implementation: UpdateCurrentUserUseCaseImpl,\n dependencies: [UpdateCurrentUserGateway]\n});\n"],"names":["UpdateCurrentUserUseCaseImpl","gateway","params","result","UpdateCurrentUserUseCase","UseCaseAbstraction","UpdateCurrentUserGateway"],"mappings":";AAKA,MAAMA;IACF,YAA6BC,OAA2C,CAAE;aAA7CA,OAAO,GAAPA;IAA8C;IAE3E,MAAM,QAAQC,MAAiC,EAAsC;QACjF,MAAMC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAACD;QAC1C,OAAOC;IACX;AACJ;AAEO,MAAMC,oDAA2BC,yBAAAA,oBAAuC,CAAC;IAC5E,gBAAgBL;IAChB,cAAc;QAACM;KAAyB;AAC5C"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface IUpdateCurrentUserGatewayParams {
|
|
2
|
+
firstName?: string;
|
|
3
|
+
lastName?: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
password?: string;
|
|
6
|
+
avatar?: {
|
|
7
|
+
src?: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface IUpdateCurrentUserGatewayResult {
|
|
11
|
+
id: string;
|
|
12
|
+
email: string;
|
|
13
|
+
firstName: string;
|
|
14
|
+
lastName: string;
|
|
15
|
+
avatar: any;
|
|
16
|
+
external: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IUpdateCurrentUserGateway {
|
|
19
|
+
execute(params: IUpdateCurrentUserGatewayParams): Promise<IUpdateCurrentUserGatewayResult>;
|
|
20
|
+
}
|
|
21
|
+
export declare const UpdateCurrentUserGateway: import("@webiny/di").Abstraction<IUpdateCurrentUserGateway>;
|
|
22
|
+
export declare namespace UpdateCurrentUserGateway {
|
|
23
|
+
type Interface = IUpdateCurrentUserGateway;
|
|
24
|
+
type Params = IUpdateCurrentUserGatewayParams;
|
|
25
|
+
type Result = IUpdateCurrentUserGatewayResult;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.js","sources":["../../../../../../src/admin/features/account/updateCurrentUser/abstractions/UpdateCurrentUserGateway.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface IUpdateCurrentUserGatewayParams {\n firstName?: string;\n lastName?: string;\n email?: string;\n password?: string;\n avatar?: { src?: string };\n}\n\nexport interface IUpdateCurrentUserGatewayResult {\n id: string;\n email: string;\n firstName: string;\n lastName: string;\n avatar: any;\n external: boolean;\n}\n\nexport interface IUpdateCurrentUserGateway {\n execute(params: IUpdateCurrentUserGatewayParams): Promise<IUpdateCurrentUserGatewayResult>;\n}\n\nexport const UpdateCurrentUserGateway = createAbstraction<IUpdateCurrentUserGateway>(\n \"Cognito/UpdateCurrentUserGateway\"\n);\n\nexport namespace UpdateCurrentUserGateway {\n export type Interface = IUpdateCurrentUserGateway;\n export type Params = IUpdateCurrentUserGatewayParams;\n export type Result = IUpdateCurrentUserGatewayResult;\n}\n"],"names":["UpdateCurrentUserGateway","createAbstraction"],"mappings":";AAuBO,MAAMA,2BAA2BC,kBACpC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IUpdateCurrentUserGatewayParams } from "./UpdateCurrentUserGateway.js";
|
|
2
|
+
import type { IUpdateCurrentUserGatewayResult } from "./UpdateCurrentUserGateway.js";
|
|
3
|
+
export type IUpdateCurrentUserUseCaseParams = IUpdateCurrentUserGatewayParams;
|
|
4
|
+
export type IUpdateCurrentUserUseCaseResult = IUpdateCurrentUserGatewayResult;
|
|
5
|
+
export interface IUpdateCurrentUserUseCase {
|
|
6
|
+
execute(params: IUpdateCurrentUserUseCaseParams): Promise<IUpdateCurrentUserUseCaseResult>;
|
|
7
|
+
}
|
|
8
|
+
export declare const UpdateCurrentUserUseCase: import("@webiny/di").Abstraction<IUpdateCurrentUserUseCase>;
|
|
9
|
+
export declare namespace UpdateCurrentUserUseCase {
|
|
10
|
+
type Interface = IUpdateCurrentUserUseCase;
|
|
11
|
+
type Params = IUpdateCurrentUserUseCaseParams;
|
|
12
|
+
type Result = IUpdateCurrentUserUseCaseResult;
|
|
13
|
+
}
|