@webiny/cognito 6.4.11 → 6.6.0-alpha.1
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 +4 -4
- package/admin/Cognito.d.ts +3 -1
- package/admin/Cognito.js +8 -2
- package/admin/Cognito.js.map +1 -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.d.ts +2 -2
- package/admin/presentation/Cognito/components/View.d.ts +1 -1
- package/admin/presentation/Cognito/components/index.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 +1 -1
- package/admin/ui/views/Users/UsersForm.js.map +1 -1
- package/admin/ui/views/Users/UsersView.js +3 -3
- package/admin/ui/views/Users/UsersView.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/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/package.json +21 -24
- 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
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { GetUserUseCase } from "./abstractions/index.js";
|
|
3
|
+
import { GetUserUseCase as external_GetUserUseCase_js_GetUserUseCase } from "./GetUserUseCase.js";
|
|
4
|
+
import { GetUserGateway } from "./GetUserGateway.js";
|
|
5
|
+
const GetUserFeature = createFeature({
|
|
6
|
+
name: "Cognito/Users/GetUser",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(external_GetUserUseCase_js_GetUserUseCase);
|
|
9
|
+
container.register(GetUserGateway).inSingletonScope();
|
|
10
|
+
},
|
|
11
|
+
resolve (container) {
|
|
12
|
+
return {
|
|
13
|
+
useCase: container.resolve(GetUserUseCase)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { GetUserFeature };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/getUser/feature.js","sources":["../../../../../src/admin/features/users/getUser/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { GetUserUseCase as UseCaseAbstraction } from \"./abstractions/index.js\";\nimport { GetUserUseCase } from \"./GetUserUseCase.js\";\nimport { GetUserGateway } from \"./GetUserGateway.js\";\n\nexport const GetUserFeature = createFeature({\n name: \"Cognito/Users/GetUser\",\n register(container) {\n container.register(GetUserUseCase);\n container.register(GetUserGateway).inSingletonScope();\n },\n resolve(container) {\n return {\n useCase: container.resolve(UseCaseAbstraction)\n };\n }\n});\n"],"names":["GetUserFeature","createFeature","container","GetUserUseCase","GetUserGateway","UseCaseAbstraction"],"mappings":";;;;AAKO,MAAMA,iBAAiBC,cAAc;IACxC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,gBAAgB,gBAAgB;IACvD;IACA,SAAQF,SAAS;QACb,OAAO;YACH,SAASA,UAAU,OAAO,CAACG;QAC/B;IACJ;AACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
2
|
+
import { ListUsersGateway as GatewayAbstraction, type IListUsersGatewayResult } from "./abstractions/index.js";
|
|
3
|
+
declare class ListUsersGraphQLGateway implements GatewayAbstraction.Interface {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: MainGraphQLClient.Interface);
|
|
6
|
+
execute(): Promise<IListUsersGatewayResult[]>;
|
|
7
|
+
}
|
|
8
|
+
export declare const ListUsersGateway: typeof ListUsersGraphQLGateway & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/ListUsersGateway.js").IListUsersGateway>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
2
|
+
import { ListUsersGateway } from "./abstractions/index.js";
|
|
3
|
+
const LIST_USERS = `
|
|
4
|
+
query ListUsers {
|
|
5
|
+
adminUsers {
|
|
6
|
+
users: listUsers {
|
|
7
|
+
data {
|
|
8
|
+
id
|
|
9
|
+
email
|
|
10
|
+
firstName
|
|
11
|
+
lastName
|
|
12
|
+
avatar
|
|
13
|
+
createdOn
|
|
14
|
+
external
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
class ListUsersGraphQLGateway {
|
|
21
|
+
constructor(client){
|
|
22
|
+
this.client = client;
|
|
23
|
+
}
|
|
24
|
+
async execute() {
|
|
25
|
+
const response = await this.client.execute({
|
|
26
|
+
query: LIST_USERS
|
|
27
|
+
});
|
|
28
|
+
return response.adminUsers.users.data;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const ListUsersGateway_ListUsersGateway = ListUsersGateway.createImplementation({
|
|
32
|
+
implementation: ListUsersGraphQLGateway,
|
|
33
|
+
dependencies: [
|
|
34
|
+
MainGraphQLClient
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
export { ListUsersGateway_ListUsersGateway as ListUsersGateway };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=ListUsersGateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/listUsers/ListUsersGateway.js","sources":["../../../../../src/admin/features/users/listUsers/ListUsersGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport {\n ListUsersGateway as GatewayAbstraction,\n type IListUsersGatewayResult\n} from \"./abstractions/index.js\";\n\nconst LIST_USERS = /* GraphQL */ `\n query ListUsers {\n adminUsers {\n users: listUsers {\n data {\n id\n email\n firstName\n lastName\n avatar\n createdOn\n external\n }\n }\n }\n }\n`;\n\ntype ListUsersResponse = {\n adminUsers: {\n users: {\n data: IListUsersGatewayResult[];\n };\n };\n};\n\nclass ListUsersGraphQLGateway implements GatewayAbstraction.Interface {\n constructor(private readonly client: MainGraphQLClient.Interface) {}\n\n async execute(): Promise<IListUsersGatewayResult[]> {\n const response = await this.client.execute<ListUsersResponse>({\n query: LIST_USERS\n });\n\n return response.adminUsers.users.data;\n }\n}\n\nexport const ListUsersGateway = GatewayAbstraction.createImplementation({\n implementation: ListUsersGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["LIST_USERS","ListUsersGraphQLGateway","client","response","ListUsersGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAMA,MAAMA,aAA2B,CAAC;;;;;;;;;;;;;;;;AAgBlC,CAAC;AAUD,MAAMC;IACF,YAA6BC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAEnE,MAAM,UAA8C;QAChD,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAoB;YAC1D,OAAOH;QACX;QAEA,OAAOG,SAAS,UAAU,CAAC,KAAK,CAAC,IAAI;IACzC;AACJ;AAEO,MAAMC,oCAAmBC,iBAAAA,oBAAuC,CAAC;IACpE,gBAAgBJ;IAChB,cAAc;QAACK;KAAkB;AACrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ListUsersGateway, ListUsersUseCase as UseCaseAbstraction, type IListUsersUseCaseResult } from "./abstractions/index.js";
|
|
2
|
+
declare class ListUsersUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
3
|
+
private readonly gateway;
|
|
4
|
+
constructor(gateway: ListUsersGateway.Interface);
|
|
5
|
+
execute(): Promise<IListUsersUseCaseResult[]>;
|
|
6
|
+
}
|
|
7
|
+
export declare const ListUsersUseCase: typeof ListUsersUseCaseImpl & {
|
|
8
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/ListUsersUseCase.js").IListUsersUseCase>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ListUsersGateway, ListUsersUseCase } from "./abstractions/index.js";
|
|
2
|
+
class ListUsersUseCaseImpl {
|
|
3
|
+
constructor(gateway){
|
|
4
|
+
this.gateway = gateway;
|
|
5
|
+
}
|
|
6
|
+
async execute() {
|
|
7
|
+
return this.gateway.execute();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const ListUsersUseCase_ListUsersUseCase = ListUsersUseCase.createImplementation({
|
|
11
|
+
implementation: ListUsersUseCaseImpl,
|
|
12
|
+
dependencies: [
|
|
13
|
+
ListUsersGateway
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
export { ListUsersUseCase_ListUsersUseCase as ListUsersUseCase };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=ListUsersUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/listUsers/ListUsersUseCase.js","sources":["../../../../../src/admin/features/users/listUsers/ListUsersUseCase.ts"],"sourcesContent":["import {\n ListUsersGateway,\n ListUsersUseCase as UseCaseAbstraction,\n type IListUsersUseCaseResult\n} from \"./abstractions/index.js\";\n\nclass ListUsersUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private readonly gateway: ListUsersGateway.Interface) {}\n\n async execute(): Promise<IListUsersUseCaseResult[]> {\n return this.gateway.execute();\n }\n}\n\nexport const ListUsersUseCase = UseCaseAbstraction.createImplementation({\n implementation: ListUsersUseCaseImpl,\n dependencies: [ListUsersGateway]\n});\n"],"names":["ListUsersUseCaseImpl","gateway","ListUsersUseCase","UseCaseAbstraction","ListUsersGateway"],"mappings":";AAMA,MAAMA;IACF,YAA6BC,OAAmC,CAAE;aAArCA,OAAO,GAAPA;IAAsC;IAEnE,MAAM,UAA8C;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO;IAC/B;AACJ;AAEO,MAAMC,oCAAmBC,iBAAAA,oBAAuC,CAAC;IACpE,gBAAgBH;IAChB,cAAc;QAACI;KAAiB;AACpC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface IListUsersGatewayResult {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName: string;
|
|
6
|
+
avatar: any;
|
|
7
|
+
createdOn: string;
|
|
8
|
+
external: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface IListUsersGateway {
|
|
11
|
+
execute(): Promise<IListUsersGatewayResult[]>;
|
|
12
|
+
}
|
|
13
|
+
export declare const ListUsersGateway: import("@webiny/di").Abstraction<IListUsersGateway>;
|
|
14
|
+
export declare namespace ListUsersGateway {
|
|
15
|
+
type Interface = IListUsersGateway;
|
|
16
|
+
type Result = IListUsersGatewayResult;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/listUsers/abstractions/ListUsersGateway.js","sources":["../../../../../../src/admin/features/users/listUsers/abstractions/ListUsersGateway.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface IListUsersGatewayResult {\n id: string;\n email: string;\n firstName: string;\n lastName: string;\n avatar: any;\n createdOn: string;\n external: boolean;\n}\n\nexport interface IListUsersGateway {\n execute(): Promise<IListUsersGatewayResult[]>;\n}\n\nexport const ListUsersGateway = createAbstraction<IListUsersGateway>(\"ListUsersGateway\");\n\nexport namespace ListUsersGateway {\n export type Interface = IListUsersGateway;\n export type Result = IListUsersGatewayResult;\n}\n"],"names":["ListUsersGateway","createAbstraction"],"mappings":";AAgBO,MAAMA,mBAAmBC,kBAAqC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IListUsersGatewayResult } from "./ListUsersGateway.js";
|
|
2
|
+
export type IListUsersUseCaseResult = IListUsersGatewayResult;
|
|
3
|
+
export interface IListUsersUseCase {
|
|
4
|
+
execute(): Promise<IListUsersUseCaseResult[]>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ListUsersUseCase: import("@webiny/di").Abstraction<IListUsersUseCase>;
|
|
7
|
+
export declare namespace ListUsersUseCase {
|
|
8
|
+
type Interface = IListUsersUseCase;
|
|
9
|
+
type Result = IListUsersUseCaseResult;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/listUsers/abstractions/ListUsersUseCase.js","sources":["../../../../../../src/admin/features/users/listUsers/abstractions/ListUsersUseCase.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { IListUsersGatewayResult } from \"./ListUsersGateway.js\";\n\nexport type IListUsersUseCaseResult = IListUsersGatewayResult;\n\nexport interface IListUsersUseCase {\n execute(): Promise<IListUsersUseCaseResult[]>;\n}\n\nexport const ListUsersUseCase = createAbstraction<IListUsersUseCase>(\"ListUsersUseCase\");\n\nexport namespace ListUsersUseCase {\n export type Interface = IListUsersUseCase;\n export type Result = IListUsersUseCaseResult;\n}\n"],"names":["ListUsersUseCase","createAbstraction"],"mappings":";AASO,MAAMA,mBAAmBC,kBAAqC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { ListUsersUseCase } from "./abstractions/index.js";
|
|
3
|
+
import { ListUsersUseCase as external_ListUsersUseCase_js_ListUsersUseCase } from "./ListUsersUseCase.js";
|
|
4
|
+
import { ListUsersGateway } from "./ListUsersGateway.js";
|
|
5
|
+
const ListUsersFeature = createFeature({
|
|
6
|
+
name: "Cognito/Users/ListUsers",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(external_ListUsersUseCase_js_ListUsersUseCase);
|
|
9
|
+
container.register(ListUsersGateway).inSingletonScope();
|
|
10
|
+
},
|
|
11
|
+
resolve (container) {
|
|
12
|
+
return {
|
|
13
|
+
useCase: container.resolve(ListUsersUseCase)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { ListUsersFeature };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/listUsers/feature.js","sources":["../../../../../src/admin/features/users/listUsers/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { ListUsersUseCase as UseCaseAbstraction } from \"./abstractions/index.js\";\nimport { ListUsersUseCase } from \"./ListUsersUseCase.js\";\nimport { ListUsersGateway } from \"./ListUsersGateway.js\";\n\nexport const ListUsersFeature = createFeature({\n name: \"Cognito/Users/ListUsers\",\n register(container) {\n container.register(ListUsersUseCase);\n container.register(ListUsersGateway).inSingletonScope();\n },\n resolve(container) {\n return {\n useCase: container.resolve(UseCaseAbstraction)\n };\n }\n});\n"],"names":["ListUsersFeature","createFeature","container","ListUsersUseCase","ListUsersGateway","UseCaseAbstraction"],"mappings":";;;;AAKO,MAAMA,mBAAmBC,cAAc;IAC1C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,kBAAkB,gBAAgB;IACzD;IACA,SAAQF,SAAS;QACb,OAAO;YACH,SAASA,UAAU,OAAO,CAACG;QAC/B;IACJ;AACJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
2
|
+
import { UpdateUserGateway as GatewayAbstraction, type IUpdateUserGatewayParams, type IUpdateUserGatewayResult } from "./abstractions/index.js";
|
|
3
|
+
declare class UpdateUserGraphQLGateway implements GatewayAbstraction.Interface {
|
|
4
|
+
private readonly client;
|
|
5
|
+
constructor(client: MainGraphQLClient.Interface);
|
|
6
|
+
execute(params: IUpdateUserGatewayParams): Promise<IUpdateUserGatewayResult>;
|
|
7
|
+
}
|
|
8
|
+
export declare const UpdateUserGateway: typeof UpdateUserGraphQLGateway & {
|
|
9
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/UpdateUserGateway.js").IUpdateUserGateway>;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
|
|
2
|
+
import { UpdateUserGateway } from "./abstractions/index.js";
|
|
3
|
+
const UPDATE_USER = `
|
|
4
|
+
mutation UpdateUser($id: ID!, $data: AdminUsersUpdateInput!) {
|
|
5
|
+
adminUsers {
|
|
6
|
+
user: updateUser(id: $id, data: $data) {
|
|
7
|
+
data {
|
|
8
|
+
id
|
|
9
|
+
email
|
|
10
|
+
firstName
|
|
11
|
+
lastName
|
|
12
|
+
avatar
|
|
13
|
+
external
|
|
14
|
+
roles {
|
|
15
|
+
id
|
|
16
|
+
slug
|
|
17
|
+
name
|
|
18
|
+
}
|
|
19
|
+
teams {
|
|
20
|
+
id
|
|
21
|
+
slug
|
|
22
|
+
name
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
error {
|
|
26
|
+
code
|
|
27
|
+
message
|
|
28
|
+
data
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
class UpdateUserGraphQLGateway {
|
|
35
|
+
constructor(client){
|
|
36
|
+
this.client = client;
|
|
37
|
+
}
|
|
38
|
+
async execute(params) {
|
|
39
|
+
const response = await this.client.execute({
|
|
40
|
+
query: UPDATE_USER,
|
|
41
|
+
variables: {
|
|
42
|
+
id: params.id,
|
|
43
|
+
data: params.data
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const envelope = response.adminUsers.user;
|
|
47
|
+
if (envelope.error) throw new Error(envelope.error.message);
|
|
48
|
+
return envelope.data;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const UpdateUserGateway_UpdateUserGateway = UpdateUserGateway.createImplementation({
|
|
52
|
+
implementation: UpdateUserGraphQLGateway,
|
|
53
|
+
dependencies: [
|
|
54
|
+
MainGraphQLClient
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
export { UpdateUserGateway_UpdateUserGateway as UpdateUserGateway };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=UpdateUserGateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/updateUser/UpdateUserGateway.js","sources":["../../../../../src/admin/features/users/updateUser/UpdateUserGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport {\n UpdateUserGateway as GatewayAbstraction,\n type IUpdateUserGatewayParams,\n type IUpdateUserGatewayResult\n} from \"./abstractions/index.js\";\n\nconst UPDATE_USER = /* GraphQL */ `\n mutation UpdateUser($id: ID!, $data: AdminUsersUpdateInput!) {\n adminUsers {\n user: updateUser(id: $id, data: $data) {\n data {\n id\n email\n firstName\n lastName\n avatar\n external\n roles {\n id\n slug\n name\n }\n teams {\n id\n slug\n name\n }\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\ntype UpdateUserResponse = {\n adminUsers: {\n user:\n | { data: IUpdateUserGatewayResult; error: null }\n | { data: null; error: { code: string; message: string; data: unknown } };\n };\n};\n\nclass UpdateUserGraphQLGateway implements GatewayAbstraction.Interface {\n constructor(private readonly client: MainGraphQLClient.Interface) {}\n\n async execute(params: IUpdateUserGatewayParams): Promise<IUpdateUserGatewayResult> {\n const response = await this.client.execute<UpdateUserResponse>({\n query: UPDATE_USER,\n variables: { id: params.id, data: params.data }\n });\n\n const envelope = response.adminUsers.user;\n if (envelope.error) {\n throw new Error(envelope.error.message);\n }\n\n return envelope.data;\n }\n}\n\nexport const UpdateUserGateway = GatewayAbstraction.createImplementation({\n implementation: UpdateUserGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["UPDATE_USER","UpdateUserGraphQLGateway","client","params","response","envelope","Error","UpdateUserGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAOA,MAAMA,cAA4B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BnC,CAAC;AAUD,MAAMC;IACF,YAA6BC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAEnE,MAAM,QAAQC,MAAgC,EAAqC;QAC/E,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAqB;YAC3D,OAAOJ;YACP,WAAW;gBAAE,IAAIG,OAAO,EAAE;gBAAE,MAAMA,OAAO,IAAI;YAAC;QAClD;QAEA,MAAME,WAAWD,SAAS,UAAU,CAAC,IAAI;QACzC,IAAIC,SAAS,KAAK,EACd,MAAM,IAAIC,MAAMD,SAAS,KAAK,CAAC,OAAO;QAG1C,OAAOA,SAAS,IAAI;IACxB;AACJ;AAEO,MAAME,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UpdateUserGateway, UpdateUserUseCase as UseCaseAbstraction, type IUpdateUserUseCaseParams, type IUpdateUserUseCaseResult } from "./abstractions/index.js";
|
|
2
|
+
declare class UpdateUserUseCaseImpl implements UseCaseAbstraction.Interface {
|
|
3
|
+
private readonly gateway;
|
|
4
|
+
constructor(gateway: UpdateUserGateway.Interface);
|
|
5
|
+
execute(params: IUpdateUserUseCaseParams): Promise<IUpdateUserUseCaseResult>;
|
|
6
|
+
}
|
|
7
|
+
export declare const UpdateUserUseCase: typeof UpdateUserUseCaseImpl & {
|
|
8
|
+
__abstraction: import("@webiny/di").Abstraction<import("./abstractions/UpdateUserUseCase.js").IUpdateUserUseCase>;
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UpdateUserGateway, UpdateUserUseCase } from "./abstractions/index.js";
|
|
2
|
+
class UpdateUserUseCaseImpl {
|
|
3
|
+
constructor(gateway){
|
|
4
|
+
this.gateway = gateway;
|
|
5
|
+
}
|
|
6
|
+
async execute(params) {
|
|
7
|
+
return this.gateway.execute(params);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const UpdateUserUseCase_UpdateUserUseCase = UpdateUserUseCase.createImplementation({
|
|
11
|
+
implementation: UpdateUserUseCaseImpl,
|
|
12
|
+
dependencies: [
|
|
13
|
+
UpdateUserGateway
|
|
14
|
+
]
|
|
15
|
+
});
|
|
16
|
+
export { UpdateUserUseCase_UpdateUserUseCase as UpdateUserUseCase };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=UpdateUserUseCase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/updateUser/UpdateUserUseCase.js","sources":["../../../../../src/admin/features/users/updateUser/UpdateUserUseCase.ts"],"sourcesContent":["import {\n UpdateUserGateway,\n UpdateUserUseCase as UseCaseAbstraction,\n type IUpdateUserUseCaseParams,\n type IUpdateUserUseCaseResult\n} from \"./abstractions/index.js\";\n\nclass UpdateUserUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private readonly gateway: UpdateUserGateway.Interface) {}\n\n async execute(params: IUpdateUserUseCaseParams): Promise<IUpdateUserUseCaseResult> {\n return this.gateway.execute(params);\n }\n}\n\nexport const UpdateUserUseCase = UseCaseAbstraction.createImplementation({\n implementation: UpdateUserUseCaseImpl,\n dependencies: [UpdateUserGateway]\n});\n"],"names":["UpdateUserUseCaseImpl","gateway","params","UpdateUserUseCase","UseCaseAbstraction","UpdateUserGateway"],"mappings":";AAOA,MAAMA;IACF,YAA6BC,OAAoC,CAAE;aAAtCA,OAAO,GAAPA;IAAuC;IAEpE,MAAM,QAAQC,MAAgC,EAAqC;QAC/E,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAACA;IAChC;AACJ;AAEO,MAAMC,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBJ;IAChB,cAAc;QAACK;KAAkB;AACrC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface IUserRoleRef {
|
|
2
|
+
id: string;
|
|
3
|
+
slug: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IUserTeamRef {
|
|
7
|
+
id: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IUpdateUserGatewayResult {
|
|
12
|
+
id: string;
|
|
13
|
+
email: string;
|
|
14
|
+
firstName: string;
|
|
15
|
+
lastName: string;
|
|
16
|
+
avatar: any;
|
|
17
|
+
external: boolean;
|
|
18
|
+
roles: IUserRoleRef[];
|
|
19
|
+
teams: IUserTeamRef[];
|
|
20
|
+
}
|
|
21
|
+
export interface IUpdateUserGatewayParams {
|
|
22
|
+
id: string;
|
|
23
|
+
data: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
export interface IUpdateUserGateway {
|
|
26
|
+
execute(params: IUpdateUserGatewayParams): Promise<IUpdateUserGatewayResult>;
|
|
27
|
+
}
|
|
28
|
+
export declare const UpdateUserGateway: import("@webiny/di").Abstraction<IUpdateUserGateway>;
|
|
29
|
+
export declare namespace UpdateUserGateway {
|
|
30
|
+
type Interface = IUpdateUserGateway;
|
|
31
|
+
type Params = IUpdateUserGatewayParams;
|
|
32
|
+
type Result = IUpdateUserGatewayResult;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/updateUser/abstractions/UpdateUserGateway.js","sources":["../../../../../../src/admin/features/users/updateUser/abstractions/UpdateUserGateway.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\nexport interface IUserRoleRef {\n id: string;\n slug: string;\n name: string;\n}\n\nexport interface IUserTeamRef {\n id: string;\n slug: string;\n name: string;\n}\n\nexport interface IUpdateUserGatewayResult {\n id: string;\n email: string;\n firstName: string;\n lastName: string;\n avatar: any;\n external: boolean;\n roles: IUserRoleRef[];\n teams: IUserTeamRef[];\n}\n\nexport interface IUpdateUserGatewayParams {\n id: string;\n data: Record<string, any>;\n}\n\nexport interface IUpdateUserGateway {\n execute(params: IUpdateUserGatewayParams): Promise<IUpdateUserGatewayResult>;\n}\n\nexport const UpdateUserGateway = createAbstraction<IUpdateUserGateway>(\"UpdateUserGateway\");\n\nexport namespace UpdateUserGateway {\n export type Interface = IUpdateUserGateway;\n export type Params = IUpdateUserGatewayParams;\n export type Result = IUpdateUserGatewayResult;\n}\n"],"names":["UpdateUserGateway","createAbstraction"],"mappings":";AAkCO,MAAMA,oBAAoBC,kBAAsC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IUpdateUserGatewayResult } from "./UpdateUserGateway.js";
|
|
2
|
+
export type IUpdateUserUseCaseResult = IUpdateUserGatewayResult;
|
|
3
|
+
export interface IUpdateUserUseCaseParams {
|
|
4
|
+
id: string;
|
|
5
|
+
data: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
export interface IUpdateUserUseCase {
|
|
8
|
+
execute(params: IUpdateUserUseCaseParams): Promise<IUpdateUserUseCaseResult>;
|
|
9
|
+
}
|
|
10
|
+
export declare const UpdateUserUseCase: import("@webiny/di").Abstraction<IUpdateUserUseCase>;
|
|
11
|
+
export declare namespace UpdateUserUseCase {
|
|
12
|
+
type Interface = IUpdateUserUseCase;
|
|
13
|
+
type Params = IUpdateUserUseCaseParams;
|
|
14
|
+
type Result = IUpdateUserUseCaseResult;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/updateUser/abstractions/UpdateUserUseCase.js","sources":["../../../../../../src/admin/features/users/updateUser/abstractions/UpdateUserUseCase.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { IUpdateUserGatewayResult } from \"./UpdateUserGateway.js\";\n\nexport type IUpdateUserUseCaseResult = IUpdateUserGatewayResult;\n\nexport interface IUpdateUserUseCaseParams {\n id: string;\n data: Record<string, any>;\n}\n\nexport interface IUpdateUserUseCase {\n execute(params: IUpdateUserUseCaseParams): Promise<IUpdateUserUseCaseResult>;\n}\n\nexport const UpdateUserUseCase = createAbstraction<IUpdateUserUseCase>(\"UpdateUserUseCase\");\n\nexport namespace UpdateUserUseCase {\n export type Interface = IUpdateUserUseCase;\n export type Params = IUpdateUserUseCaseParams;\n export type Result = IUpdateUserUseCaseResult;\n}\n"],"names":["UpdateUserUseCase","createAbstraction"],"mappings":";AAcO,MAAMA,oBAAoBC,kBAAsC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { UpdateUserGateway, type IUpdateUserGateway, type IUpdateUserGatewayParams, type IUpdateUserGatewayResult } from "./UpdateUserGateway.js";
|
|
2
|
+
export { UpdateUserUseCase, type IUpdateUserUseCase, type IUpdateUserUseCaseParams, type IUpdateUserUseCaseResult } from "./UpdateUserUseCase.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFeature } from "@webiny/feature/admin";
|
|
2
|
+
import { UpdateUserUseCase } from "./abstractions/index.js";
|
|
3
|
+
import { UpdateUserUseCase as external_UpdateUserUseCase_js_UpdateUserUseCase } from "./UpdateUserUseCase.js";
|
|
4
|
+
import { UpdateUserGateway } from "./UpdateUserGateway.js";
|
|
5
|
+
const UpdateUserFeature = createFeature({
|
|
6
|
+
name: "Cognito/Users/UpdateUser",
|
|
7
|
+
register (container) {
|
|
8
|
+
container.register(external_UpdateUserUseCase_js_UpdateUserUseCase);
|
|
9
|
+
container.register(UpdateUserGateway).inSingletonScope();
|
|
10
|
+
},
|
|
11
|
+
resolve (container) {
|
|
12
|
+
return {
|
|
13
|
+
useCase: container.resolve(UpdateUserUseCase)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { UpdateUserFeature };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin/features/users/updateUser/feature.js","sources":["../../../../../src/admin/features/users/updateUser/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { UpdateUserUseCase as UseCaseAbstraction } from \"./abstractions/index.js\";\nimport { UpdateUserUseCase } from \"./UpdateUserUseCase.js\";\nimport { UpdateUserGateway } from \"./UpdateUserGateway.js\";\n\nexport const UpdateUserFeature = createFeature({\n name: \"Cognito/Users/UpdateUser\",\n register(container) {\n container.register(UpdateUserUseCase);\n container.register(UpdateUserGateway).inSingletonScope();\n },\n resolve(container) {\n return {\n useCase: container.resolve(UseCaseAbstraction)\n };\n }\n});\n"],"names":["UpdateUserFeature","createFeature","container","UpdateUserUseCase","UpdateUserGateway","UseCaseAbstraction"],"mappings":";;;;AAKO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,mBAAmB,gBAAgB;IAC1D;IACA,SAAQF,SAAS;QACb,OAAO;YACH,SAASA,UAAU,OAAO,CAACG;QAC/B;IACJ;AACJ"}
|
|
@@ -5,6 +5,6 @@ export interface CognitoLoginScreenProps {
|
|
|
5
5
|
clientId: string;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
-
export declare const CognitoLoginScreen: ((props: CognitoLoginScreenProps) => React.JSX.Element) & {
|
|
9
|
-
|
|
8
|
+
export declare const CognitoLoginScreen: ((props: CognitoLoginScreenProps) => React.JSX.Element) & React.NamedExoticComponent<CognitoLoginScreenProps> & {
|
|
9
|
+
readonly type: (props: CognitoLoginScreenProps) => React.JSX.Element;
|
|
10
10
|
};
|
|
@@ -287,6 +287,6 @@ export declare const Components: {
|
|
|
287
287
|
displayName: string;
|
|
288
288
|
}>) => (props: unknown) => React.JSX.Element;
|
|
289
289
|
};
|
|
290
|
-
Error:
|
|
290
|
+
Error: typeof import("./View.js").Error;
|
|
291
291
|
};
|
|
292
292
|
};
|
|
@@ -1,57 +1,65 @@
|
|
|
1
|
-
import react, { useState } from "react";
|
|
1
|
+
import react, { useEffect, useState } from "react";
|
|
2
2
|
import omit from "lodash/omit.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useFeature } from "@webiny/app";
|
|
4
4
|
import { i18n } from "@webiny/app/i18n/index.js";
|
|
5
5
|
import { Form } from "@webiny/form";
|
|
6
6
|
import { validation } from "@webiny/validation";
|
|
7
7
|
import { AvatarImage } from "../../components/AvatarImage/index.js";
|
|
8
|
-
import { GET_CURRENT_USER, UPDATE_CURRENT_USER } from "./graphql.js";
|
|
9
8
|
import { config } from "@webiny/app/config.js";
|
|
9
|
+
import { GetCurrentUserFeature } from "../../../features/account/getCurrentUser/index.js";
|
|
10
|
+
import { UpdateCurrentUserFeature } from "../../../features/account/updateCurrentUser/index.js";
|
|
10
11
|
import { CenteredView, SimpleForm, SimpleFormContent, SimpleFormFooter, SimpleFormHeader, useIdentity } from "@webiny/app-admin";
|
|
11
12
|
import { usePasswordValidator } from "../../../presentation/shared/usePasswordValidator.js";
|
|
12
13
|
import { Alert, Button, Grid, Input, OverlayLoader, useToast } from "@webiny/admin-ui";
|
|
13
14
|
const t = i18n.ns("app-security-admin-users/account-form");
|
|
14
15
|
const UserAccountForm = ()=>{
|
|
15
16
|
const [isSaving, setSaving] = useState(false);
|
|
17
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
18
|
+
const [user, setUser] = useState({});
|
|
16
19
|
const toast = useToast();
|
|
17
20
|
const { identity } = useIdentity();
|
|
18
21
|
const passwordValidator = usePasswordValidator();
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
const { useCase: getCurrentUser } = useFeature(GetCurrentUserFeature);
|
|
23
|
+
const { useCase: updateCurrentUser } = useFeature(UpdateCurrentUserFeature);
|
|
24
|
+
useEffect(()=>{
|
|
25
|
+
getCurrentUser.execute().then((data)=>{
|
|
26
|
+
setUser(data);
|
|
27
|
+
setIsLoading(false);
|
|
28
|
+
});
|
|
29
|
+
}, []);
|
|
30
|
+
const isFormLoading = isSaving || isLoading;
|
|
23
31
|
const loaderMessage = isSaving ? "Saving account..." : "Loading account...";
|
|
24
32
|
const emailIsDisabled = config.getKey("ADMIN_USER_CAN_CHANGE_EMAIL", "false" === process.env.REACT_APP_ADMIN_USER_CAN_CHANGE_EMAIL);
|
|
25
33
|
const isExternal = user?.external === true;
|
|
26
34
|
const onSubmit = async (formData)=>{
|
|
27
35
|
setSaving(true);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
36
|
+
try {
|
|
37
|
+
await updateCurrentUser.execute(omit(formData, [
|
|
38
|
+
"id",
|
|
39
|
+
"external"
|
|
40
|
+
]));
|
|
41
|
+
identity.update({
|
|
42
|
+
displayName: `${formData.firstName} ${formData.lastName}`,
|
|
43
|
+
profile: {
|
|
44
|
+
...identity.profile || {},
|
|
45
|
+
firstName: formData.firstName,
|
|
46
|
+
lastName: formData.lastName,
|
|
47
|
+
avatar: formData.avatar
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
toast.showSuccessToast({
|
|
51
|
+
title: "Account updated successfully!"
|
|
52
|
+
});
|
|
53
|
+
} catch (error) {
|
|
54
|
+
const message = error instanceof Error ? error.message : "Unknown error";
|
|
55
|
+
toast.showWarningToast({
|
|
56
|
+
title: "Error updating user account",
|
|
57
|
+
description: message,
|
|
58
|
+
duration: 1 / 0
|
|
59
|
+
});
|
|
60
|
+
} finally{
|
|
61
|
+
setSaving(false);
|
|
62
|
+
}
|
|
55
63
|
};
|
|
56
64
|
return /*#__PURE__*/ react.createElement(CenteredView, {
|
|
57
65
|
maxWidth: 600
|