@webiny/cognito 6.5.0-beta.9 → 6.5.1-beta.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.
Files changed (141) hide show
  1. package/admin/Extension.js +9 -0
  2. package/admin/Extension.js.map +1 -1
  3. package/admin/features/users/checkEmail/CheckEmailGateway.d.ts +11 -0
  4. package/admin/features/users/checkEmail/CheckEmailGateway.js +44 -0
  5. package/admin/features/users/checkEmail/CheckEmailGateway.js.map +1 -0
  6. package/admin/features/users/checkEmail/CheckEmailUseCase.d.ts +10 -0
  7. package/admin/features/users/checkEmail/CheckEmailUseCase.js +18 -0
  8. package/admin/features/users/checkEmail/CheckEmailUseCase.js.map +1 -0
  9. package/admin/features/users/checkEmail/abstractions/CheckEmailGateway.d.ts +14 -0
  10. package/admin/features/users/checkEmail/abstractions/CheckEmailGateway.js +5 -0
  11. package/admin/features/users/checkEmail/abstractions/CheckEmailGateway.js.map +1 -0
  12. package/admin/features/users/checkEmail/abstractions/CheckEmailUseCase.d.ts +9 -0
  13. package/admin/features/users/checkEmail/abstractions/CheckEmailUseCase.js +5 -0
  14. package/admin/features/users/checkEmail/abstractions/CheckEmailUseCase.js.map +1 -0
  15. package/admin/features/users/checkEmail/abstractions/index.d.ts +2 -0
  16. package/admin/features/users/checkEmail/abstractions/index.js +2 -0
  17. package/admin/features/users/checkEmail/feature.d.ts +3 -0
  18. package/admin/features/users/checkEmail/feature.js +19 -0
  19. package/admin/features/users/checkEmail/feature.js.map +1 -0
  20. package/admin/features/users/checkEmail/index.d.ts +2 -0
  21. package/admin/features/users/checkEmail/index.js +2 -0
  22. package/admin/features/users/createUser/CreateUserGateway.js +2 -1
  23. package/admin/features/users/createUser/CreateUserGateway.js.map +1 -1
  24. package/admin/features/users/createUser/CreateUserUseCase.test.d.ts +1 -0
  25. package/admin/features/users/createUser/CreateUserUseCase.test.js +65 -0
  26. package/admin/features/users/createUser/CreateUserUseCase.test.js.map +1 -0
  27. package/admin/features/users/linkUser/LinkUserGateway.d.ts +11 -0
  28. package/admin/features/users/linkUser/LinkUserGateway.js +50 -0
  29. package/admin/features/users/linkUser/LinkUserGateway.js.map +1 -0
  30. package/admin/features/users/linkUser/LinkUserUseCase.d.ts +10 -0
  31. package/admin/features/users/linkUser/LinkUserUseCase.js +18 -0
  32. package/admin/features/users/linkUser/LinkUserUseCase.js.map +1 -0
  33. package/admin/features/users/linkUser/abstractions/LinkUserGateway.d.ts +18 -0
  34. package/admin/features/users/linkUser/abstractions/LinkUserGateway.js +5 -0
  35. package/admin/features/users/linkUser/abstractions/LinkUserGateway.js.map +1 -0
  36. package/admin/features/users/linkUser/abstractions/LinkUserUseCase.d.ts +15 -0
  37. package/admin/features/users/linkUser/abstractions/LinkUserUseCase.js +5 -0
  38. package/admin/features/users/linkUser/abstractions/LinkUserUseCase.js.map +1 -0
  39. package/admin/features/users/linkUser/abstractions/index.d.ts +2 -0
  40. package/admin/features/users/linkUser/abstractions/index.js +2 -0
  41. package/admin/features/users/linkUser/feature.d.ts +3 -0
  42. package/admin/features/users/linkUser/feature.js +19 -0
  43. package/admin/features/users/linkUser/feature.js.map +1 -0
  44. package/admin/features/users/linkUser/index.d.ts +2 -0
  45. package/admin/features/users/linkUser/index.js +2 -0
  46. package/admin/features/users/shared/AdminUsersError.d.ts +13 -0
  47. package/admin/features/users/shared/AdminUsersError.js +11 -0
  48. package/admin/features/users/shared/AdminUsersError.js.map +1 -0
  49. package/admin/presentation/Cognito/CognitoLoginScreen.js +9 -1
  50. package/admin/presentation/Cognito/CognitoLoginScreen.js.map +1 -1
  51. package/admin/presentation/Cognito/CognitoPresenter.d.ts +10 -1
  52. package/admin/presentation/Cognito/CognitoPresenter.js +50 -4
  53. package/admin/presentation/Cognito/CognitoPresenter.js.map +1 -1
  54. package/admin/presentation/Cognito/CognitoPresenter.test.d.ts +1 -0
  55. package/admin/presentation/Cognito/CognitoPresenter.test.js +180 -0
  56. package/admin/presentation/Cognito/CognitoPresenter.test.js.map +1 -0
  57. package/admin/presentation/Cognito/abstractions.d.ts +8 -1
  58. package/admin/presentation/Cognito/abstractions.js.map +1 -1
  59. package/admin/presentation/Cognito/components/NoTenantAccess.d.ts +23 -0
  60. package/admin/presentation/Cognito/components/NoTenantAccess.js +10 -0
  61. package/admin/presentation/Cognito/components/NoTenantAccess.js.map +1 -0
  62. package/admin/presentation/Cognito/components/SelectTenant.d.ts +26 -0
  63. package/admin/presentation/Cognito/components/SelectTenant.js +15 -0
  64. package/admin/presentation/Cognito/components/SelectTenant.js.map +1 -0
  65. package/admin/presentation/Cognito/components/index.d.ts +38 -0
  66. package/admin/presentation/Cognito/components/index.js +4 -0
  67. package/admin/presentation/Cognito/components/index.js.map +1 -1
  68. package/admin/presentation/users/UserForm/UserFormPresenter.d.ts +30 -0
  69. package/admin/presentation/users/UserForm/UserFormPresenter.js +118 -0
  70. package/admin/presentation/users/UserForm/UserFormPresenter.js.map +1 -0
  71. package/admin/presentation/users/UserForm/UserFormPresenter.test.d.ts +1 -0
  72. package/admin/presentation/users/UserForm/UserFormPresenter.test.js +248 -0
  73. package/admin/presentation/users/UserForm/UserFormPresenter.test.js.map +1 -0
  74. package/admin/presentation/users/UserForm/abstractions.d.ts +52 -0
  75. package/admin/presentation/users/UserForm/abstractions.js +5 -0
  76. package/admin/presentation/users/UserForm/abstractions.js.map +1 -0
  77. package/admin/presentation/users/UserForm/feature.d.ts +7 -0
  78. package/admin/presentation/users/UserForm/feature.js +17 -0
  79. package/admin/presentation/users/UserForm/feature.js.map +1 -0
  80. package/admin/ui/views/Users/UsersForm.d.ts +3 -1
  81. package/admin/ui/views/Users/UsersForm.js +43 -20
  82. package/admin/ui/views/Users/UsersForm.js.map +1 -1
  83. package/admin/ui/views/Users/components/LinkAccountAlert.d.ts +10 -0
  84. package/admin/ui/views/Users/components/LinkAccountAlert.js +17 -0
  85. package/admin/ui/views/Users/components/LinkAccountAlert.js.map +1 -0
  86. package/admin/ui/views/Users/hooks/useUserForm.d.ts +1 -0
  87. package/admin/ui/views/Users/hooks/useUserForm.js +31 -18
  88. package/admin/ui/views/Users/hooks/useUserForm.js.map +1 -1
  89. package/api/CognitoApiFeature.js +4 -0
  90. package/api/CognitoApiFeature.js.map +1 -1
  91. package/api/domain/errors.d.ts +49 -0
  92. package/api/domain/errors.js +53 -1
  93. package/api/domain/errors.js.map +1 -1
  94. package/api/features/CheckEmail/CheckEmailUseCase.d.ts +16 -0
  95. package/api/features/CheckEmail/CheckEmailUseCase.js +47 -0
  96. package/api/features/CheckEmail/CheckEmailUseCase.js.map +1 -0
  97. package/api/features/CheckEmail/abstractions.d.ts +29 -0
  98. package/api/features/CheckEmail/abstractions.js +5 -0
  99. package/api/features/CheckEmail/abstractions.js.map +1 -0
  100. package/api/features/CheckEmail/feature.d.ts +4 -0
  101. package/api/features/CheckEmail/feature.js +11 -0
  102. package/api/features/CheckEmail/feature.js.map +1 -0
  103. package/api/features/CheckEmail/index.d.ts +2 -0
  104. package/api/features/CheckEmail/index.js +2 -0
  105. package/api/features/CognitoService/CognitoService.d.ts +1 -1
  106. package/api/features/CognitoService/CognitoService.js +11 -5
  107. package/api/features/CognitoService/CognitoService.js.map +1 -1
  108. package/api/features/CognitoService/abstractions.d.ts +8 -2
  109. package/api/features/CognitoService/abstractions.js.map +1 -1
  110. package/api/features/CreateUser/CreateUserUseCase.d.ts +1 -2
  111. package/api/features/CreateUser/CreateUserUseCase.js +3 -3
  112. package/api/features/CreateUser/CreateUserUseCase.js.map +1 -1
  113. package/api/features/CreateUser/abstractions.d.ts +3 -1
  114. package/api/features/CreateUser/abstractions.js.map +1 -1
  115. package/api/features/DeleteUser/DeleteUserUseCase.d.ts +3 -1
  116. package/api/features/DeleteUser/DeleteUserUseCase.js +11 -2
  117. package/api/features/DeleteUser/DeleteUserUseCase.js.map +1 -1
  118. package/api/features/DeleteUser/abstractions.d.ts +2 -0
  119. package/api/features/DeleteUser/abstractions.js.map +1 -1
  120. package/api/features/LinkUser/LinkUserUseCase.d.ts +22 -0
  121. package/api/features/LinkUser/LinkUserUseCase.js +83 -0
  122. package/api/features/LinkUser/LinkUserUseCase.js.map +1 -0
  123. package/api/features/LinkUser/abstractions.d.ts +36 -0
  124. package/api/features/LinkUser/abstractions.js +5 -0
  125. package/api/features/LinkUser/abstractions.js.map +1 -0
  126. package/api/features/LinkUser/feature.d.ts +4 -0
  127. package/api/features/LinkUser/feature.js +11 -0
  128. package/api/features/LinkUser/feature.js.map +1 -0
  129. package/api/features/LinkUser/index.d.ts +2 -0
  130. package/api/features/LinkUser/index.js +2 -0
  131. package/api/features/UpdateUser/UpdateUserUseCase.d.ts +14 -1
  132. package/api/features/UpdateUser/UpdateUserUseCase.js +93 -4
  133. package/api/features/UpdateUser/UpdateUserUseCase.js.map +1 -1
  134. package/api/features/UpdateUser/abstractions.d.ts +7 -1
  135. package/api/features/UpdateUser/abstractions.js.map +1 -1
  136. package/api/features/UserInstaller/UserInstaller.d.ts +3 -1
  137. package/api/features/UserInstaller/UserInstaller.js +18 -3
  138. package/api/features/UserInstaller/UserInstaller.js.map +1 -1
  139. package/api/graphql/user.gql.js +68 -0
  140. package/api/graphql/user.gql.js.map +1 -1
  141. package/package.json +20 -20
@@ -10,6 +10,9 @@ import { GetUserFeature } from "./features/users/getUser/index.js";
10
10
  import { CreateUserFeature } from "./features/users/createUser/index.js";
11
11
  import { UpdateUserFeature } from "./features/users/updateUser/index.js";
12
12
  import { DeleteUserFeature } from "./features/users/deleteUser/index.js";
13
+ import { LinkUserFeature } from "./features/users/linkUser/index.js";
14
+ import { CheckEmailFeature } from "./features/users/checkEmail/index.js";
15
+ import { UserFormFeature } from "./presentation/users/UserForm/feature.js";
13
16
  const Extension = ()=>{
14
17
  const region = process.env.REACT_APP_USER_POOL_REGION || "";
15
18
  const userPoolId = process.env.REACT_APP_USER_POOL_ID || "";
@@ -32,6 +35,12 @@ const Extension = ()=>{
32
35
  feature: UpdateUserFeature
33
36
  }), /*#__PURE__*/ react.createElement(RegisterFeature, {
34
37
  feature: DeleteUserFeature
38
+ }), /*#__PURE__*/ react.createElement(RegisterFeature, {
39
+ feature: LinkUserFeature
40
+ }), /*#__PURE__*/ react.createElement(RegisterFeature, {
41
+ feature: CheckEmailFeature
42
+ }), /*#__PURE__*/ react.createElement(RegisterFeature, {
43
+ feature: UserFormFeature
35
44
  }), /*#__PURE__*/ react.createElement(CognitoAdmin, {
36
45
  login: {
37
46
  region,
@@ -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\";\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"}
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\";\nimport { LinkUserFeature } from \"./features/users/linkUser/index.js\";\nimport { CheckEmailFeature } from \"./features/users/checkEmail/index.js\";\nimport { UserFormFeature } from \"./presentation/users/UserForm/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 <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 <RegisterFeature feature={LinkUserFeature} />\n <RegisterFeature feature={CheckEmailFeature} />\n <RegisterFeature feature={UserFormFeature} />\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","LinkUserFeature","CheckEmailFeature","UserFormFeature","CognitoAdmin"],"mappings":";;;;;;;;;;;;;;;AAgBO,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,oBAACT,iBAAeA;QAAC,SAASU;sBAC1B,oBAACV,iBAAeA;QAAC,SAASW;sBAC1B,oBAACX,iBAAeA;QAAC,SAASY;sBAC1B,oBAACC,cAAYA;QACT,OAAO;YACHjB;YACAE;YACAC;QACJ;;AAIhB"}
@@ -0,0 +1,11 @@
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
+ import { CheckEmailGateway as GatewayAbstraction, type EmailStatus } from "./abstractions/index.js";
3
+ declare class CheckEmailGraphQLGateway implements GatewayAbstraction.Interface {
4
+ private readonly client;
5
+ constructor(client: MainGraphQLClient.Interface);
6
+ execute(email: string): Promise<EmailStatus>;
7
+ }
8
+ export declare const CheckEmailGateway: typeof CheckEmailGraphQLGateway & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions/CheckEmailGateway.js").ICheckEmailGateway>;
10
+ };
11
+ export {};
@@ -0,0 +1,44 @@
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
+ import { AdminUsersError } from "../shared/AdminUsersError.js";
3
+ import { CheckEmailGateway } from "./abstractions/index.js";
4
+ const CHECK_EMAIL = `
5
+ query CheckEmail($email: String!) {
6
+ adminUsers {
7
+ checkEmail(email: $email) {
8
+ data {
9
+ status
10
+ }
11
+ error {
12
+ code
13
+ message
14
+ data
15
+ }
16
+ }
17
+ }
18
+ }
19
+ `;
20
+ class CheckEmailGraphQLGateway {
21
+ constructor(client){
22
+ this.client = client;
23
+ }
24
+ async execute(email) {
25
+ const response = await this.client.execute({
26
+ query: CHECK_EMAIL,
27
+ variables: {
28
+ email
29
+ }
30
+ });
31
+ const envelope = response.adminUsers.checkEmail;
32
+ if (envelope.error) throw new AdminUsersError(envelope.error);
33
+ return envelope.data.status;
34
+ }
35
+ }
36
+ const CheckEmailGateway_CheckEmailGateway = CheckEmailGateway.createImplementation({
37
+ implementation: CheckEmailGraphQLGateway,
38
+ dependencies: [
39
+ MainGraphQLClient
40
+ ]
41
+ });
42
+ export { CheckEmailGateway_CheckEmailGateway as CheckEmailGateway };
43
+
44
+ //# sourceMappingURL=CheckEmailGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/checkEmail/CheckEmailGateway.js","sources":["../../../../../src/admin/features/users/checkEmail/CheckEmailGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { AdminUsersError } from \"../shared/AdminUsersError.js\";\nimport { CheckEmailGateway as GatewayAbstraction, type EmailStatus } from \"./abstractions/index.js\";\n\nconst CHECK_EMAIL = /* GraphQL */ `\n query CheckEmail($email: String!) {\n adminUsers {\n checkEmail(email: $email) {\n data {\n status\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\ntype CheckEmailResponse = {\n adminUsers: {\n checkEmail:\n | { data: { status: EmailStatus }; error: null }\n | { data: null; error: { code: string; message: string; data: any } };\n };\n};\n\nclass CheckEmailGraphQLGateway implements GatewayAbstraction.Interface {\n constructor(private readonly client: MainGraphQLClient.Interface) {}\n\n async execute(email: string): Promise<EmailStatus> {\n const response = await this.client.execute<CheckEmailResponse>({\n query: CHECK_EMAIL,\n variables: { email }\n });\n\n const envelope = response.adminUsers.checkEmail;\n if (envelope.error) {\n throw new AdminUsersError(envelope.error);\n }\n\n return envelope.data.status;\n }\n}\n\nexport const CheckEmailGateway = GatewayAbstraction.createImplementation({\n implementation: CheckEmailGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["CHECK_EMAIL","CheckEmailGraphQLGateway","client","email","response","envelope","AdminUsersError","CheckEmailGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;;AAIA,MAAMA,cAA4B,CAAC;;;;;;;;;;;;;;;AAenC,CAAC;AAUD,MAAMC;IACF,YAA6BC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAEnE,MAAM,QAAQC,KAAa,EAAwB;QAC/C,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAqB;YAC3D,OAAOJ;YACP,WAAW;gBAAEG;YAAM;QACvB;QAEA,MAAME,WAAWD,SAAS,UAAU,CAAC,UAAU;QAC/C,IAAIC,SAAS,KAAK,EACd,MAAM,IAAIC,gBAAgBD,SAAS,KAAK;QAG5C,OAAOA,SAAS,IAAI,CAAC,MAAM;IAC/B;AACJ;AAEO,MAAME,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
@@ -0,0 +1,10 @@
1
+ import { CheckEmailGateway, CheckEmailUseCase as UseCaseAbstraction, type EmailStatus } from "./abstractions/index.js";
2
+ declare class CheckEmailUseCaseImpl implements UseCaseAbstraction.Interface {
3
+ private readonly gateway;
4
+ constructor(gateway: CheckEmailGateway.Interface);
5
+ execute(email: string): Promise<EmailStatus>;
6
+ }
7
+ export declare const CheckEmailUseCase: typeof CheckEmailUseCaseImpl & {
8
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions/CheckEmailUseCase.js").ICheckEmailUseCase>;
9
+ };
10
+ export {};
@@ -0,0 +1,18 @@
1
+ import { CheckEmailGateway, CheckEmailUseCase } from "./abstractions/index.js";
2
+ class CheckEmailUseCaseImpl {
3
+ constructor(gateway){
4
+ this.gateway = gateway;
5
+ }
6
+ async execute(email) {
7
+ return this.gateway.execute(email.trim());
8
+ }
9
+ }
10
+ const CheckEmailUseCase_CheckEmailUseCase = CheckEmailUseCase.createImplementation({
11
+ implementation: CheckEmailUseCaseImpl,
12
+ dependencies: [
13
+ CheckEmailGateway
14
+ ]
15
+ });
16
+ export { CheckEmailUseCase_CheckEmailUseCase as CheckEmailUseCase };
17
+
18
+ //# sourceMappingURL=CheckEmailUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/checkEmail/CheckEmailUseCase.js","sources":["../../../../../src/admin/features/users/checkEmail/CheckEmailUseCase.ts"],"sourcesContent":["import {\n CheckEmailGateway,\n CheckEmailUseCase as UseCaseAbstraction,\n type EmailStatus\n} from \"./abstractions/index.js\";\n\nclass CheckEmailUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private readonly gateway: CheckEmailGateway.Interface) {}\n\n async execute(email: string): Promise<EmailStatus> {\n return this.gateway.execute(email.trim());\n }\n}\n\nexport const CheckEmailUseCase = UseCaseAbstraction.createImplementation({\n implementation: CheckEmailUseCaseImpl,\n dependencies: [CheckEmailGateway]\n});\n"],"names":["CheckEmailUseCaseImpl","gateway","email","CheckEmailUseCase","UseCaseAbstraction","CheckEmailGateway"],"mappings":";AAMA,MAAMA;IACF,YAA6BC,OAAoC,CAAE;aAAtCA,OAAO,GAAPA;IAAuC;IAEpE,MAAM,QAAQC,KAAa,EAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAACA,MAAM,IAAI;IAC1C;AACJ;AAEO,MAAMC,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBJ;IAChB,cAAc;QAACK;KAAkB;AACrC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * - `AVAILABLE`: a new user can be created with this email.
3
+ * - `EXISTS_HERE`: the current tenant already has a user with this email.
4
+ * - `EXISTS_ELSEWHERE`: the email has an account in another tenant, which can be linked here.
5
+ */
6
+ export type EmailStatus = "AVAILABLE" | "EXISTS_HERE" | "EXISTS_ELSEWHERE";
7
+ export interface ICheckEmailGateway {
8
+ execute(email: string): Promise<EmailStatus>;
9
+ }
10
+ export declare const CheckEmailGateway: import("@webiny/di").Abstraction<ICheckEmailGateway>;
11
+ export declare namespace CheckEmailGateway {
12
+ type Interface = ICheckEmailGateway;
13
+ type Status = EmailStatus;
14
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const CheckEmailGateway = createAbstraction("CheckEmailGateway");
3
+ export { CheckEmailGateway };
4
+
5
+ //# sourceMappingURL=CheckEmailGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/checkEmail/abstractions/CheckEmailGateway.js","sources":["../../../../../../src/admin/features/users/checkEmail/abstractions/CheckEmailGateway.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\n\n/**\n * - `AVAILABLE`: a new user can be created with this email.\n * - `EXISTS_HERE`: the current tenant already has a user with this email.\n * - `EXISTS_ELSEWHERE`: the email has an account in another tenant, which can be linked here.\n */\nexport type EmailStatus = \"AVAILABLE\" | \"EXISTS_HERE\" | \"EXISTS_ELSEWHERE\";\n\nexport interface ICheckEmailGateway {\n execute(email: string): Promise<EmailStatus>;\n}\n\nexport const CheckEmailGateway = createAbstraction<ICheckEmailGateway>(\"CheckEmailGateway\");\n\nexport namespace CheckEmailGateway {\n export type Interface = ICheckEmailGateway;\n export type Status = EmailStatus;\n}\n"],"names":["CheckEmailGateway","createAbstraction"],"mappings":";AAaO,MAAMA,oBAAoBC,kBAAsC"}
@@ -0,0 +1,9 @@
1
+ import type { EmailStatus } from "./CheckEmailGateway.js";
2
+ export interface ICheckEmailUseCase {
3
+ execute(email: string): Promise<EmailStatus>;
4
+ }
5
+ export declare const CheckEmailUseCase: import("@webiny/di").Abstraction<ICheckEmailUseCase>;
6
+ export declare namespace CheckEmailUseCase {
7
+ type Interface = ICheckEmailUseCase;
8
+ type Status = EmailStatus;
9
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const CheckEmailUseCase = createAbstraction("CheckEmailUseCase");
3
+ export { CheckEmailUseCase };
4
+
5
+ //# sourceMappingURL=CheckEmailUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/checkEmail/abstractions/CheckEmailUseCase.js","sources":["../../../../../../src/admin/features/users/checkEmail/abstractions/CheckEmailUseCase.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { EmailStatus } from \"./CheckEmailGateway.js\";\n\nexport interface ICheckEmailUseCase {\n execute(email: string): Promise<EmailStatus>;\n}\n\nexport const CheckEmailUseCase = createAbstraction<ICheckEmailUseCase>(\"CheckEmailUseCase\");\n\nexport namespace CheckEmailUseCase {\n export type Interface = ICheckEmailUseCase;\n export type Status = EmailStatus;\n}\n"],"names":["CheckEmailUseCase","createAbstraction"],"mappings":";AAOO,MAAMA,oBAAoBC,kBAAsC"}
@@ -0,0 +1,2 @@
1
+ export { CheckEmailGateway, type ICheckEmailGateway, type EmailStatus } from "./CheckEmailGateway.js";
2
+ export { CheckEmailUseCase, type ICheckEmailUseCase } from "./CheckEmailUseCase.js";
@@ -0,0 +1,2 @@
1
+ export { CheckEmailGateway } from "./CheckEmailGateway.js";
2
+ export { CheckEmailUseCase } from "./CheckEmailUseCase.js";
@@ -0,0 +1,3 @@
1
+ export declare const CheckEmailFeature: import("@webiny/feature/admin").FeatureDefinition<{
2
+ useCase: import("./abstractions/CheckEmailUseCase.js").ICheckEmailUseCase;
3
+ }, []>;
@@ -0,0 +1,19 @@
1
+ import { createFeature } from "@webiny/feature/admin";
2
+ import { CheckEmailUseCase } from "./abstractions/index.js";
3
+ import { CheckEmailUseCase as external_CheckEmailUseCase_js_CheckEmailUseCase } from "./CheckEmailUseCase.js";
4
+ import { CheckEmailGateway } from "./CheckEmailGateway.js";
5
+ const CheckEmailFeature = createFeature({
6
+ name: "Cognito/Users/CheckEmail",
7
+ register (container) {
8
+ container.register(external_CheckEmailUseCase_js_CheckEmailUseCase);
9
+ container.register(CheckEmailGateway).inSingletonScope();
10
+ },
11
+ resolve (container) {
12
+ return {
13
+ useCase: container.resolve(CheckEmailUseCase)
14
+ };
15
+ }
16
+ });
17
+ export { CheckEmailFeature };
18
+
19
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/checkEmail/feature.js","sources":["../../../../../src/admin/features/users/checkEmail/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { CheckEmailUseCase as UseCaseAbstraction } from \"./abstractions/index.js\";\nimport { CheckEmailUseCase } from \"./CheckEmailUseCase.js\";\nimport { CheckEmailGateway } from \"./CheckEmailGateway.js\";\n\nexport const CheckEmailFeature = createFeature({\n name: \"Cognito/Users/CheckEmail\",\n register(container) {\n container.register(CheckEmailUseCase);\n container.register(CheckEmailGateway).inSingletonScope();\n },\n resolve(container) {\n return {\n useCase: container.resolve(UseCaseAbstraction)\n };\n }\n});\n"],"names":["CheckEmailFeature","createFeature","container","CheckEmailUseCase","CheckEmailGateway","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"}
@@ -0,0 +1,2 @@
1
+ export { CheckEmailUseCase, type EmailStatus } from "./abstractions/index.js";
2
+ export { CheckEmailFeature } from "./feature.js";
@@ -0,0 +1,2 @@
1
+ export { CheckEmailUseCase } from "./abstractions/index.js";
2
+ export { CheckEmailFeature } from "./feature.js";
@@ -1,4 +1,5 @@
1
1
  import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
+ import { AdminUsersError } from "../shared/AdminUsersError.js";
2
3
  import { CreateUserGateway } from "./abstractions/index.js";
3
4
  const CREATE_USER = `
4
5
  mutation CreateUser($data: AdminUsersCreateInput!) {
@@ -34,7 +35,7 @@ class CreateUserGraphQLGateway {
34
35
  }
35
36
  });
36
37
  const envelope = response.adminUsers.user;
37
- if (envelope.error) throw new Error(envelope.error.message);
38
+ if (envelope.error) throw new AdminUsersError(envelope.error);
38
39
  return envelope.data;
39
40
  }
40
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"admin/features/users/createUser/CreateUserGateway.js","sources":["../../../../../src/admin/features/users/createUser/CreateUserGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport {\n CreateUserGateway as GatewayAbstraction,\n type ICreateUserGatewayParams,\n type ICreateUserGatewayResult\n} from \"./abstractions/index.js\";\n\nconst CREATE_USER = /* GraphQL */ `\n mutation CreateUser($data: AdminUsersCreateInput!) {\n adminUsers {\n user: createUser(data: $data) {\n data {\n id\n email\n firstName\n lastName\n avatar\n createdOn\n external\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\ntype CreateUserResponse = {\n adminUsers: {\n user:\n | { data: ICreateUserGatewayResult; error: null }\n | { data: null; error: { code: string; message: string; data: unknown } };\n };\n};\n\nclass CreateUserGraphQLGateway implements GatewayAbstraction.Interface {\n constructor(private readonly client: MainGraphQLClient.Interface) {}\n\n async execute(params: ICreateUserGatewayParams): Promise<ICreateUserGatewayResult> {\n const response = await this.client.execute<CreateUserResponse>({\n query: CREATE_USER,\n variables: { 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 CreateUserGateway = GatewayAbstraction.createImplementation({\n implementation: CreateUserGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["CREATE_USER","CreateUserGraphQLGateway","client","params","response","envelope","Error","CreateUserGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;AAOA,MAAMA,cAA4B,CAAC;;;;;;;;;;;;;;;;;;;;;AAqBnC,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,MAAMG,OAAO,IAAI;YAAC;QACnC;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"}
1
+ {"version":3,"file":"admin/features/users/createUser/CreateUserGateway.js","sources":["../../../../../src/admin/features/users/createUser/CreateUserGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { AdminUsersError } from \"../shared/AdminUsersError.js\";\nimport {\n CreateUserGateway as GatewayAbstraction,\n type ICreateUserGatewayParams,\n type ICreateUserGatewayResult\n} from \"./abstractions/index.js\";\n\nconst CREATE_USER = /* GraphQL */ `\n mutation CreateUser($data: AdminUsersCreateInput!) {\n adminUsers {\n user: createUser(data: $data) {\n data {\n id\n email\n firstName\n lastName\n avatar\n createdOn\n external\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\ntype CreateUserResponse = {\n adminUsers: {\n user:\n | { data: ICreateUserGatewayResult; error: null }\n | { data: null; error: { code: string; message: string; data: any } };\n };\n};\n\nclass CreateUserGraphQLGateway implements GatewayAbstraction.Interface {\n constructor(private readonly client: MainGraphQLClient.Interface) {}\n\n async execute(params: ICreateUserGatewayParams): Promise<ICreateUserGatewayResult> {\n const response = await this.client.execute<CreateUserResponse>({\n query: CREATE_USER,\n variables: { data: params.data }\n });\n\n const envelope = response.adminUsers.user;\n if (envelope.error) {\n throw new AdminUsersError(envelope.error);\n }\n\n return envelope.data;\n }\n}\n\nexport const CreateUserGateway = GatewayAbstraction.createImplementation({\n implementation: CreateUserGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["CREATE_USER","CreateUserGraphQLGateway","client","params","response","envelope","AdminUsersError","CreateUserGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;;AAQA,MAAMA,cAA4B,CAAC;;;;;;;;;;;;;;;;;;;;;AAqBnC,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,MAAMG,OAAO,IAAI;YAAC;QACnC;QAEA,MAAME,WAAWD,SAAS,UAAU,CAAC,IAAI;QACzC,IAAIC,SAAS,KAAK,EACd,MAAM,IAAIC,gBAAgBD,SAAS,KAAK;QAG5C,OAAOA,SAAS,IAAI;IACxB;AACJ;AAEO,MAAME,sCAAoBC,kBAAAA,oBAAuC,CAAC;IACrE,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
@@ -0,0 +1,65 @@
1
+ import { beforeEach, describe, expect, it, vi } from "vitest";
2
+ import { Container } from "@webiny/di";
3
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
4
+ import { CreateUserFeature } from "./feature.js";
5
+ const user = {
6
+ id: "user-1",
7
+ email: "person@example.com",
8
+ firstName: "Some",
9
+ lastName: "Person",
10
+ avatar: null,
11
+ createdOn: "2026-10-22T00:00:00.000Z",
12
+ external: false
13
+ };
14
+ describe("CreateUser feature", ()=>{
15
+ let container;
16
+ let execute;
17
+ const createUser = ()=>{
18
+ const { useCase } = CreateUserFeature.resolve(container);
19
+ return useCase.execute({
20
+ data: {
21
+ email: user.email,
22
+ password: "SecurePass123!"
23
+ }
24
+ });
25
+ };
26
+ beforeEach(()=>{
27
+ container = new Container();
28
+ execute = vi.fn();
29
+ container.registerInstance(MainGraphQLClient, {
30
+ execute
31
+ });
32
+ CreateUserFeature.register(container);
33
+ });
34
+ it("returns the created user", async ()=>{
35
+ execute.mockResolvedValue({
36
+ adminUsers: {
37
+ user: {
38
+ data: user,
39
+ error: null
40
+ }
41
+ }
42
+ });
43
+ expect(await createUser()).toEqual(user);
44
+ });
45
+ it("throws the API's error with its code", async ()=>{
46
+ execute.mockResolvedValue({
47
+ adminUsers: {
48
+ user: {
49
+ data: null,
50
+ error: {
51
+ code: "Cognito/Account/Exists",
52
+ message: "Already here.",
53
+ data: null
54
+ }
55
+ }
56
+ }
57
+ });
58
+ await expect(createUser()).rejects.toMatchObject({
59
+ message: "Already here.",
60
+ code: "Cognito/Account/Exists"
61
+ });
62
+ });
63
+ });
64
+
65
+ //# sourceMappingURL=CreateUserUseCase.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/createUser/CreateUserUseCase.test.js","sources":["../../../../../src/admin/features/users/createUser/CreateUserUseCase.test.ts"],"sourcesContent":["import { describe, it, expect, vi, beforeEach } from \"vitest\";\nimport { Container } from \"@webiny/di\";\nimport { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { CreateUserFeature } from \"./feature.js\";\n\nconst user = {\n id: \"user-1\",\n email: \"person@example.com\",\n firstName: \"Some\",\n lastName: \"Person\",\n avatar: null,\n createdOn: \"2026-10-22T00:00:00.000Z\",\n external: false\n};\n\ndescribe(\"CreateUser feature\", () => {\n let container: Container;\n let execute: ReturnType<typeof vi.fn>;\n\n const createUser = () => {\n const { useCase } = CreateUserFeature.resolve(container);\n return useCase.execute({ data: { email: user.email, password: \"SecurePass123!\" } });\n };\n\n beforeEach(() => {\n container = new Container();\n execute = vi.fn();\n container.registerInstance(MainGraphQLClient, {\n execute\n } as unknown as MainGraphQLClient.Interface);\n CreateUserFeature.register(container);\n });\n\n it(\"returns the created user\", async () => {\n execute.mockResolvedValue({ adminUsers: { user: { data: user, error: null } } });\n\n expect(await createUser()).toEqual(user);\n });\n\n it(\"throws the API's error with its code\", async () => {\n execute.mockResolvedValue({\n adminUsers: {\n user: {\n data: null,\n error: { code: \"Cognito/Account/Exists\", message: \"Already here.\", data: null }\n }\n }\n });\n\n await expect(createUser()).rejects.toMatchObject({\n message: \"Already here.\",\n code: \"Cognito/Account/Exists\"\n });\n });\n});\n"],"names":["user","describe","container","execute","createUser","useCase","CreateUserFeature","beforeEach","Container","vi","MainGraphQLClient","it","expect"],"mappings":";;;;AAKA,MAAMA,OAAO;IACT,IAAI;IACJ,OAAO;IACP,WAAW;IACX,UAAU;IACV,QAAQ;IACR,WAAW;IACX,UAAU;AACd;AAEAC,SAAS,sBAAsB;IAC3B,IAAIC;IACJ,IAAIC;IAEJ,MAAMC,aAAa;QACf,MAAM,EAAEC,OAAO,EAAE,GAAGC,kBAAkB,OAAO,CAACJ;QAC9C,OAAOG,QAAQ,OAAO,CAAC;YAAE,MAAM;gBAAE,OAAOL,KAAK,KAAK;gBAAE,UAAU;YAAiB;QAAE;IACrF;IAEAO,WAAW;QACPL,YAAY,IAAIM;QAChBL,UAAUM,GAAG,EAAE;QACfP,UAAU,gBAAgB,CAACQ,mBAAmB;YAC1CP;QACJ;QACAG,kBAAkB,QAAQ,CAACJ;IAC/B;IAEAS,GAAG,4BAA4B;QAC3BR,QAAQ,iBAAiB,CAAC;YAAE,YAAY;gBAAE,MAAM;oBAAE,MAAMH;oBAAM,OAAO;gBAAK;YAAE;QAAE;QAE9EY,OAAO,MAAMR,cAAc,OAAO,CAACJ;IACvC;IAEAW,GAAG,wCAAwC;QACvCR,QAAQ,iBAAiB,CAAC;YACtB,YAAY;gBACR,MAAM;oBACF,MAAM;oBACN,OAAO;wBAAE,MAAM;wBAA0B,SAAS;wBAAiB,MAAM;oBAAK;gBAClF;YACJ;QACJ;QAEA,MAAMS,OAAOR,cAAc,OAAO,CAAC,aAAa,CAAC;YAC7C,SAAS;YACT,MAAM;QACV;IACJ;AACJ"}
@@ -0,0 +1,11 @@
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
+ import { LinkUserGateway as GatewayAbstraction, type ILinkUserGatewayParams, type ILinkUserGatewayResult } from "./abstractions/index.js";
3
+ declare class LinkUserGraphQLGateway implements GatewayAbstraction.Interface {
4
+ private readonly client;
5
+ constructor(client: MainGraphQLClient.Interface);
6
+ execute(params: ILinkUserGatewayParams): Promise<ILinkUserGatewayResult>;
7
+ }
8
+ export declare const LinkUserGateway: typeof LinkUserGraphQLGateway & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions/LinkUserGateway.js").ILinkUserGateway>;
10
+ };
11
+ export {};
@@ -0,0 +1,50 @@
1
+ import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient/index.js";
2
+ import { AdminUsersError } from "../shared/AdminUsersError.js";
3
+ import { LinkUserGateway } from "./abstractions/index.js";
4
+ const LINK_USER = `
5
+ mutation LinkUser($data: AdminUsersLinkInput!) {
6
+ adminUsers {
7
+ user: linkUser(data: $data) {
8
+ data {
9
+ id
10
+ email
11
+ firstName
12
+ lastName
13
+ avatar
14
+ createdOn
15
+ external
16
+ }
17
+ error {
18
+ code
19
+ message
20
+ data
21
+ }
22
+ }
23
+ }
24
+ }
25
+ `;
26
+ class LinkUserGraphQLGateway {
27
+ constructor(client){
28
+ this.client = client;
29
+ }
30
+ async execute(params) {
31
+ const response = await this.client.execute({
32
+ query: LINK_USER,
33
+ variables: {
34
+ data: params.data
35
+ }
36
+ });
37
+ const envelope = response.adminUsers.user;
38
+ if (envelope.error) throw new AdminUsersError(envelope.error);
39
+ return envelope.data;
40
+ }
41
+ }
42
+ const LinkUserGateway_LinkUserGateway = LinkUserGateway.createImplementation({
43
+ implementation: LinkUserGraphQLGateway,
44
+ dependencies: [
45
+ MainGraphQLClient
46
+ ]
47
+ });
48
+ export { LinkUserGateway_LinkUserGateway as LinkUserGateway };
49
+
50
+ //# sourceMappingURL=LinkUserGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/linkUser/LinkUserGateway.js","sources":["../../../../../src/admin/features/users/linkUser/LinkUserGateway.ts"],"sourcesContent":["import { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient/index.js\";\nimport { AdminUsersError } from \"../shared/AdminUsersError.js\";\nimport {\n LinkUserGateway as GatewayAbstraction,\n type ILinkUserGatewayParams,\n type ILinkUserGatewayResult\n} from \"./abstractions/index.js\";\n\nconst LINK_USER = /* GraphQL */ `\n mutation LinkUser($data: AdminUsersLinkInput!) {\n adminUsers {\n user: linkUser(data: $data) {\n data {\n id\n email\n firstName\n lastName\n avatar\n createdOn\n external\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n\ntype LinkUserResponse = {\n adminUsers: {\n user:\n | { data: ILinkUserGatewayResult; error: null }\n | { data: null; error: { code: string; message: string; data: any } };\n };\n};\n\nclass LinkUserGraphQLGateway implements GatewayAbstraction.Interface {\n constructor(private readonly client: MainGraphQLClient.Interface) {}\n\n async execute(params: ILinkUserGatewayParams): Promise<ILinkUserGatewayResult> {\n const response = await this.client.execute<LinkUserResponse>({\n query: LINK_USER,\n variables: { data: params.data }\n });\n\n const envelope = response.adminUsers.user;\n if (envelope.error) {\n throw new AdminUsersError(envelope.error);\n }\n\n return envelope.data;\n }\n}\n\nexport const LinkUserGateway = GatewayAbstraction.createImplementation({\n implementation: LinkUserGraphQLGateway,\n dependencies: [MainGraphQLClient]\n});\n"],"names":["LINK_USER","LinkUserGraphQLGateway","client","params","response","envelope","AdminUsersError","LinkUserGateway","GatewayAbstraction","MainGraphQLClient"],"mappings":";;;AAQA,MAAMA,YAA0B,CAAC;;;;;;;;;;;;;;;;;;;;;AAqBjC,CAAC;AAUD,MAAMC;IACF,YAA6BC,MAAmC,CAAE;aAArCA,MAAM,GAANA;IAAsC;IAEnE,MAAM,QAAQC,MAA8B,EAAmC;QAC3E,MAAMC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAmB;YACzD,OAAOJ;YACP,WAAW;gBAAE,MAAMG,OAAO,IAAI;YAAC;QACnC;QAEA,MAAME,WAAWD,SAAS,UAAU,CAAC,IAAI;QACzC,IAAIC,SAAS,KAAK,EACd,MAAM,IAAIC,gBAAgBD,SAAS,KAAK;QAG5C,OAAOA,SAAS,IAAI;IACxB;AACJ;AAEO,MAAME,kCAAkBC,gBAAAA,oBAAuC,CAAC;IACnE,gBAAgBP;IAChB,cAAc;QAACQ;KAAkB;AACrC"}
@@ -0,0 +1,10 @@
1
+ import { LinkUserGateway, LinkUserUseCase as UseCaseAbstraction, type ILinkUserUseCaseParams, type ILinkUserUseCaseResult } from "./abstractions/index.js";
2
+ declare class LinkUserUseCaseImpl implements UseCaseAbstraction.Interface {
3
+ private readonly gateway;
4
+ constructor(gateway: LinkUserGateway.Interface);
5
+ execute(params: ILinkUserUseCaseParams): Promise<ILinkUserUseCaseResult>;
6
+ }
7
+ export declare const LinkUserUseCase: typeof LinkUserUseCaseImpl & {
8
+ __abstraction: import("@webiny/di").Abstraction<import("./abstractions/LinkUserUseCase.js").ILinkUserUseCase>;
9
+ };
10
+ export {};
@@ -0,0 +1,18 @@
1
+ import { LinkUserGateway, LinkUserUseCase } from "./abstractions/index.js";
2
+ class LinkUserUseCaseImpl {
3
+ constructor(gateway){
4
+ this.gateway = gateway;
5
+ }
6
+ async execute(params) {
7
+ return this.gateway.execute(params);
8
+ }
9
+ }
10
+ const LinkUserUseCase_LinkUserUseCase = LinkUserUseCase.createImplementation({
11
+ implementation: LinkUserUseCaseImpl,
12
+ dependencies: [
13
+ LinkUserGateway
14
+ ]
15
+ });
16
+ export { LinkUserUseCase_LinkUserUseCase as LinkUserUseCase };
17
+
18
+ //# sourceMappingURL=LinkUserUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/linkUser/LinkUserUseCase.js","sources":["../../../../../src/admin/features/users/linkUser/LinkUserUseCase.ts"],"sourcesContent":["import {\n LinkUserGateway,\n LinkUserUseCase as UseCaseAbstraction,\n type ILinkUserUseCaseParams,\n type ILinkUserUseCaseResult\n} from \"./abstractions/index.js\";\n\nclass LinkUserUseCaseImpl implements UseCaseAbstraction.Interface {\n constructor(private readonly gateway: LinkUserGateway.Interface) {}\n\n async execute(params: ILinkUserUseCaseParams): Promise<ILinkUserUseCaseResult> {\n return this.gateway.execute(params);\n }\n}\n\nexport const LinkUserUseCase = UseCaseAbstraction.createImplementation({\n implementation: LinkUserUseCaseImpl,\n dependencies: [LinkUserGateway]\n});\n"],"names":["LinkUserUseCaseImpl","gateway","params","LinkUserUseCase","UseCaseAbstraction","LinkUserGateway"],"mappings":";AAOA,MAAMA;IACF,YAA6BC,OAAkC,CAAE;aAApCA,OAAO,GAAPA;IAAqC;IAElE,MAAM,QAAQC,MAA8B,EAAmC;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAACA;IAChC;AACJ;AAEO,MAAMC,kCAAkBC,gBAAAA,oBAAuC,CAAC;IACnE,gBAAgBJ;IAChB,cAAc;QAACK;KAAgB;AACnC"}
@@ -0,0 +1,18 @@
1
+ import type { ICreateUserGatewayResult } from "../../createUser/abstractions/index.js";
2
+ export type ILinkUserGatewayResult = ICreateUserGatewayResult;
3
+ export interface ILinkUserGatewayParams {
4
+ data: {
5
+ email: string;
6
+ roles?: unknown[];
7
+ teams?: unknown[];
8
+ };
9
+ }
10
+ export interface ILinkUserGateway {
11
+ execute(params: ILinkUserGatewayParams): Promise<ILinkUserGatewayResult>;
12
+ }
13
+ export declare const LinkUserGateway: import("@webiny/di").Abstraction<ILinkUserGateway>;
14
+ export declare namespace LinkUserGateway {
15
+ type Interface = ILinkUserGateway;
16
+ type Params = ILinkUserGatewayParams;
17
+ type Result = ILinkUserGatewayResult;
18
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const LinkUserGateway = createAbstraction("LinkUserGateway");
3
+ export { LinkUserGateway };
4
+
5
+ //# sourceMappingURL=LinkUserGateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/linkUser/abstractions/LinkUserGateway.js","sources":["../../../../../../src/admin/features/users/linkUser/abstractions/LinkUserGateway.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { ICreateUserGatewayResult } from \"../../createUser/abstractions/index.js\";\n\nexport type ILinkUserGatewayResult = ICreateUserGatewayResult;\n\nexport interface ILinkUserGatewayParams {\n data: {\n email: string;\n roles?: unknown[];\n teams?: unknown[];\n };\n}\n\nexport interface ILinkUserGateway {\n execute(params: ILinkUserGatewayParams): Promise<ILinkUserGatewayResult>;\n}\n\nexport const LinkUserGateway = createAbstraction<ILinkUserGateway>(\"LinkUserGateway\");\n\nexport namespace LinkUserGateway {\n export type Interface = ILinkUserGateway;\n export type Params = ILinkUserGatewayParams;\n export type Result = ILinkUserGatewayResult;\n}\n"],"names":["LinkUserGateway","createAbstraction"],"mappings":";AAiBO,MAAMA,kBAAkBC,kBAAoC"}
@@ -0,0 +1,15 @@
1
+ import type { ILinkUserGatewayParams, ILinkUserGatewayResult } from "./LinkUserGateway.js";
2
+ export type ILinkUserUseCaseParams = ILinkUserGatewayParams;
3
+ export type ILinkUserUseCaseResult = ILinkUserGatewayResult;
4
+ /**
5
+ * Gives a person whose account exists in another tenant access to the current tenant.
6
+ */
7
+ export interface ILinkUserUseCase {
8
+ execute(params: ILinkUserUseCaseParams): Promise<ILinkUserUseCaseResult>;
9
+ }
10
+ export declare const LinkUserUseCase: import("@webiny/di").Abstraction<ILinkUserUseCase>;
11
+ export declare namespace LinkUserUseCase {
12
+ type Interface = ILinkUserUseCase;
13
+ type Params = ILinkUserUseCaseParams;
14
+ type Result = ILinkUserUseCaseResult;
15
+ }
@@ -0,0 +1,5 @@
1
+ import { createAbstraction } from "@webiny/feature/admin";
2
+ const LinkUserUseCase = createAbstraction("LinkUserUseCase");
3
+ export { LinkUserUseCase };
4
+
5
+ //# sourceMappingURL=LinkUserUseCase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/linkUser/abstractions/LinkUserUseCase.js","sources":["../../../../../../src/admin/features/users/linkUser/abstractions/LinkUserUseCase.ts"],"sourcesContent":["import { createAbstraction } from \"@webiny/feature/admin\";\nimport type { ILinkUserGatewayParams, ILinkUserGatewayResult } from \"./LinkUserGateway.js\";\n\nexport type ILinkUserUseCaseParams = ILinkUserGatewayParams;\nexport type ILinkUserUseCaseResult = ILinkUserGatewayResult;\n\n/**\n * Gives a person whose account exists in another tenant access to the current tenant.\n */\nexport interface ILinkUserUseCase {\n execute(params: ILinkUserUseCaseParams): Promise<ILinkUserUseCaseResult>;\n}\n\nexport const LinkUserUseCase = createAbstraction<ILinkUserUseCase>(\"LinkUserUseCase\");\n\nexport namespace LinkUserUseCase {\n export type Interface = ILinkUserUseCase;\n export type Params = ILinkUserUseCaseParams;\n export type Result = ILinkUserUseCaseResult;\n}\n"],"names":["LinkUserUseCase","createAbstraction"],"mappings":";AAaO,MAAMA,kBAAkBC,kBAAoC"}
@@ -0,0 +1,2 @@
1
+ export { LinkUserGateway, type ILinkUserGateway, type ILinkUserGatewayParams, type ILinkUserGatewayResult } from "./LinkUserGateway.js";
2
+ export { LinkUserUseCase, type ILinkUserUseCase, type ILinkUserUseCaseParams, type ILinkUserUseCaseResult } from "./LinkUserUseCase.js";
@@ -0,0 +1,2 @@
1
+ export { LinkUserGateway } from "./LinkUserGateway.js";
2
+ export { LinkUserUseCase } from "./LinkUserUseCase.js";
@@ -0,0 +1,3 @@
1
+ export declare const LinkUserFeature: import("@webiny/feature/admin").FeatureDefinition<{
2
+ useCase: import("./abstractions/LinkUserUseCase.js").ILinkUserUseCase;
3
+ }, []>;
@@ -0,0 +1,19 @@
1
+ import { createFeature } from "@webiny/feature/admin";
2
+ import { LinkUserUseCase } from "./abstractions/index.js";
3
+ import { LinkUserUseCase as external_LinkUserUseCase_js_LinkUserUseCase } from "./LinkUserUseCase.js";
4
+ import { LinkUserGateway } from "./LinkUserGateway.js";
5
+ const LinkUserFeature = createFeature({
6
+ name: "Cognito/Users/LinkUser",
7
+ register (container) {
8
+ container.register(external_LinkUserUseCase_js_LinkUserUseCase);
9
+ container.register(LinkUserGateway).inSingletonScope();
10
+ },
11
+ resolve (container) {
12
+ return {
13
+ useCase: container.resolve(LinkUserUseCase)
14
+ };
15
+ }
16
+ });
17
+ export { LinkUserFeature };
18
+
19
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/linkUser/feature.js","sources":["../../../../../src/admin/features/users/linkUser/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/admin\";\nimport { LinkUserUseCase as UseCaseAbstraction } from \"./abstractions/index.js\";\nimport { LinkUserUseCase } from \"./LinkUserUseCase.js\";\nimport { LinkUserGateway } from \"./LinkUserGateway.js\";\n\nexport const LinkUserFeature = createFeature({\n name: \"Cognito/Users/LinkUser\",\n register(container) {\n container.register(LinkUserUseCase);\n container.register(LinkUserGateway).inSingletonScope();\n },\n resolve(container) {\n return {\n useCase: container.resolve(UseCaseAbstraction)\n };\n }\n});\n"],"names":["LinkUserFeature","createFeature","container","LinkUserUseCase","LinkUserGateway","UseCaseAbstraction"],"mappings":";;;;AAKO,MAAMA,kBAAkBC,cAAc;IACzC,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE,iBAAiB,gBAAgB;IACxD;IACA,SAAQF,SAAS;QACb,OAAO;YACH,SAASA,UAAU,OAAO,CAACG;QAC/B;IACJ;AACJ"}
@@ -0,0 +1,2 @@
1
+ export { LinkUserUseCase } from "./abstractions/index.js";
2
+ export { LinkUserFeature } from "./feature.js";
@@ -0,0 +1,2 @@
1
+ export { LinkUserUseCase } from "./abstractions/index.js";
2
+ export { LinkUserFeature } from "./feature.js";
@@ -0,0 +1,13 @@
1
+ export interface AdminUsersErrorParams {
2
+ code?: string | null;
3
+ message: string;
4
+ data?: Record<string, any> | null;
5
+ }
6
+ /**
7
+ * An error the Admin Users API returned, with its code, so callers can tell errors apart.
8
+ */
9
+ export declare class AdminUsersError extends Error {
10
+ readonly code: string;
11
+ readonly data: Record<string, any>;
12
+ constructor(params: AdminUsersErrorParams);
13
+ }
@@ -0,0 +1,11 @@
1
+ class AdminUsersError extends Error {
2
+ constructor(params){
3
+ super(params.message);
4
+ this.name = "AdminUsersError";
5
+ this.code = params.code ?? "";
6
+ this.data = params.data ?? {};
7
+ }
8
+ }
9
+ export { AdminUsersError };
10
+
11
+ //# sourceMappingURL=AdminUsersError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin/features/users/shared/AdminUsersError.js","sources":["../../../../../src/admin/features/users/shared/AdminUsersError.ts"],"sourcesContent":["export interface AdminUsersErrorParams {\n code?: string | null;\n message: string;\n data?: Record<string, any> | null;\n}\n\n/**\n * An error the Admin Users API returned, with its code, so callers can tell errors apart.\n */\nexport class AdminUsersError extends Error {\n public readonly code: string;\n public readonly data: Record<string, any>;\n\n constructor(params: AdminUsersErrorParams) {\n super(params.message);\n this.name = \"AdminUsersError\";\n this.code = params.code ?? \"\";\n this.data = params.data ?? {};\n }\n}\n"],"names":["AdminUsersError","Error","params"],"mappings":"AASO,MAAMA,wBAAwBC;IAIjC,YAAYC,MAA6B,CAAE;QACvC,KAAK,CAACA,OAAO,OAAO;QACpB,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI,IAAI;QAC3B,IAAI,CAAC,IAAI,GAAGA,OAAO,IAAI,IAAI,CAAC;IAChC;AACJ"}