@webiny/cognito 0.0.0-unstable.0d717d18dd → 0.0.0-unstable.5387e5f7c8
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.js +3 -1
- package/Cognito.js.map +1 -1
- package/admin/ui/views/Account/Account.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.js.map +1 -1
- package/api/features/CognitoIdp/feature.js +1 -1
- package/api/features/CognitoIdp/feature.js.map +1 -1
- package/api/graphql/user.gql.d.ts +1 -0
- package/api/graphql/user.gql.js +4 -0
- package/api/graphql/user.gql.js.map +1 -1
- package/infra/CognitoFederationPulumi.d.ts +1 -1
- package/package.json +19 -20
package/Cognito.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import react from "react";
|
|
2
2
|
import { defineExtension } from "@webiny/project/defineExtension/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Api } from "@webiny/project-aws/api.js";
|
|
4
|
+
import { Admin } from "@webiny/project-aws/admin.js";
|
|
5
|
+
import { Infra } from "@webiny/project-aws/infra.js";
|
|
4
6
|
import { Await } from "@webiny/react-properties";
|
|
5
7
|
import { z } from "zod";
|
|
6
8
|
const identityProviderSchema = z.object({
|
package/Cognito.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cognito.js","sources":["../src/Cognito.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { Api
|
|
1
|
+
{"version":3,"file":"Cognito.js","sources":["../src/Cognito.tsx"],"sourcesContent":["import React from \"react\";\nimport { defineExtension } from \"@webiny/project/defineExtension/index.js\";\nimport { Api } from \"@webiny/project-aws/api.js\";\nimport { Admin } from \"@webiny/project-aws/admin.js\";\nimport { Infra } from \"@webiny/project-aws/infra.js\";\nimport { Await } from \"@webiny/react-properties\";\nimport { z } from \"zod\";\n\nconst identityProviderSchema = z.object({\n type: z.enum([\"google\", \"facebook\", \"amazon\", \"apple\", \"oidc\"]),\n name: z.string().optional(),\n label: z.string(),\n providerDetails: z.record(z.string(), z.any()),\n idpIdentifiers: z.array(z.string()).optional(),\n attributeMapping: z.record(z.string(), z.string()).optional()\n});\n\nconst federationSchema = z.object({\n domain: z.string().describe(\"Cognito User Pool domain prefix.\"),\n callbackUrls: z.array(z.string()).describe(\"OAuth callback URLs.\"),\n logoutUrls: z.array(z.string()).optional(),\n responseType: z.enum([\"code\", \"token\"]).default(\"code\"),\n allowCredentialsLogin: z.boolean().default(true),\n identityProviders: z.array(identityProviderSchema)\n});\n\nexport const Cognito = defineExtension({\n type: \"Project/Cognito\",\n tags: { runtimeContext: \"project\" },\n description: \"Enable and configure Cognito authentication.\",\n paramsSchema: z.object({\n apiConfig: z.string().describe(\"Path to API configuration.\").optional(),\n adminConfig: z.string().describe(\"Path to Admin configuration.\").optional(),\n federation: z\n .union([\n federationSchema,\n z.custom<() => Promise<z.infer<typeof federationSchema>>>(\n val => typeof val === \"function\"\n )\n ])\n .optional(),\n mfa: z.boolean().describe(\"Enable TOTP MFA for all users.\").default(false)\n }),\n render: props => {\n const federationProp = props.federation;\n const federationFn = federationProp\n ? typeof federationProp === \"function\"\n ? federationProp\n : () => Promise.resolve(federationProp)\n : null;\n\n return (\n <>\n <Infra.EnvVar varName={\"REACT_APP_IDP_TYPE\"} value={\"cognito\"} />\n {props.mfa ? <Infra.EnvVar varName={\"COGNITO_MFA\"} value={\"true\"} /> : null}\n\n {/* Api extensions */}\n <Api.Extension\n src={import.meta.dirname + \"/api/CognitoApiFeature.js\"}\n exportName={\"CognitoApiFeature\"}\n />\n {props.apiConfig ? <Api.Extension src={props.apiConfig} /> : null}\n\n {/* Admin extensions */}\n <Admin.Extension src={import.meta.dirname + \"/admin/Extension.js\"} />\n {props.adminConfig ? <Admin.Extension src={props.adminConfig} /> : null}\n\n {/* Federation infra + admin config */}\n {federationFn ? (\n <Await fn={federationFn}>\n {federation => (\n <>\n <Admin.Extension\n src={import.meta.dirname + \"/admin/SignInExtension.js\"}\n exportName={\"SignInExtension\"}\n />\n <Infra.EnvVar\n varName={\"COGNITO_FEDERATION_INFRA_CONFIG\"}\n value={JSON.stringify({\n domain: federation.domain,\n callbackUrls: federation.callbackUrls,\n logoutUrls: federation.logoutUrls,\n identityProviders: federation.identityProviders.map(\n idp => ({\n type: idp.type,\n name: idp.name,\n providerDetails: idp.providerDetails,\n idpIdentifiers: idp.idpIdentifiers,\n attributeMapping: idp.attributeMapping\n })\n )\n })}\n />\n <Infra.Core.Pulumi\n src={import.meta.dirname + \"/infra/CognitoFederationPulumi.js\"}\n />\n <Admin.BuildParam\n paramName={\"cognitoFederation\"}\n value={{\n callbackUrls: federation.callbackUrls,\n logoutUrls:\n federation.logoutUrls || federation.callbackUrls,\n responseType: federation.responseType,\n allowCredentialsLogin: federation.allowCredentialsLogin,\n providers: federation.identityProviders.map(idp => ({\n name: idp.name || idp.type,\n label: idp.label\n }))\n }}\n />\n </>\n )}\n </Await>\n ) : null}\n </>\n );\n }\n});\n"],"names":["identityProviderSchema","z","federationSchema","Cognito","defineExtension","val","props","federationProp","federationFn","Promise","Infra","Api","Admin","Await","federation","JSON","idp"],"mappings":";;;;;;;AAQA,MAAMA,yBAAyBC,EAAE,MAAM,CAAC;IACpC,MAAMA,CAAC,CAADA,OAAM,CAAC;QAAC;QAAU;QAAY;QAAU;QAAS;KAAO;IAC9D,MAAMA,EAAE,MAAM,GAAG,QAAQ;IACzB,OAAOA,EAAE,MAAM;IACf,iBAAiBA,EAAE,MAAM,CAACA,EAAE,MAAM,IAAIA,EAAE,GAAG;IAC3C,gBAAgBA,EAAE,KAAK,CAACA,EAAE,MAAM,IAAI,QAAQ;IAC5C,kBAAkBA,EAAE,MAAM,CAACA,EAAE,MAAM,IAAIA,EAAE,MAAM,IAAI,QAAQ;AAC/D;AAEA,MAAMC,mBAAmBD,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,oBAG7D,oBAACM,MAAM,SAAS;YAAC,KAAK,YAAY,OAAO,GAAG;YAC3CN,MAAM,WAAW,GAAG,WAAH,GAAG,oBAACM,MAAM,SAAS;YAAC,KAAKN,MAAM,WAAW;aAAO,MAGlEE,eAAe,WAAfA,GACG,oBAACK,OAAKA;YAAC,IAAIL;WACNM,CAAAA,aAAAA,WAAAA,GACG,wDACI,oBAACF,MAAM,SAAS;gBACZ,KAAK,YAAY,OAAO,GAAG;gBAC3B,YAAY;8BAEhB,oBAACF,MAAM,MAAM;gBACT,SAAS;gBACT,OAAOK,KAAK,SAAS,CAAC;oBAClB,QAAQD,WAAW,MAAM;oBACzB,cAAcA,WAAW,YAAY;oBACrC,YAAYA,WAAW,UAAU;oBACjC,mBAAmBA,WAAW,iBAAiB,CAAC,GAAG,CAC/CE,CAAAA,MAAQ;4BACJ,MAAMA,IAAI,IAAI;4BACd,MAAMA,IAAI,IAAI;4BACd,iBAAiBA,IAAI,eAAe;4BACpC,gBAAgBA,IAAI,cAAc;4BAClC,kBAAkBA,IAAI,gBAAgB;wBAC1C;gBAER;8BAEJ,oBAACN,MAAM,IAAI,CAAC,MAAM;gBACd,KAAK,YAAY,OAAO,GAAG;8BAE/B,oBAACE,MAAM,UAAU;gBACb,WAAW;gBACX,OAAO;oBACH,cAAcE,WAAW,YAAY;oBACrC,YACIA,WAAW,UAAU,IAAIA,WAAW,YAAY;oBACpD,cAAcA,WAAW,YAAY;oBACrC,uBAAuBA,WAAW,qBAAqB;oBACvD,WAAWA,WAAW,iBAAiB,CAAC,GAAG,CAACE,CAAAA,MAAQ;4BAChD,MAAMA,IAAI,IAAI,IAAIA,IAAI,IAAI;4BAC1B,OAAOA,IAAI,KAAK;wBACpB;gBACJ;mBAKhB;IAGhB;AACJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/ui/views/Account/Account.js","sources":["../../../../../src/admin/ui/views/Account/Account.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport omit from \"lodash/omit.js\";\nimport { useFeature } from \"@webiny/app\";\nimport { i18n } from \"@webiny/app/i18n/index.js\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { AvatarImage } from \"../../components/AvatarImage/index.js\";\nimport { config as appConfig } from \"@webiny/app/config.js\";\nimport { GetCurrentUserFeature } from \"~/admin/features/account/getCurrentUser/index.js\";\nimport { UpdateCurrentUserFeature } from \"~/admin/features/account/updateCurrentUser/index.js\";\n\nimport {\n SimpleForm,\n SimpleFormHeader,\n SimpleFormFooter,\n SimpleFormContent,\n useIdentity\n} from \"@webiny/app-admin\";\nimport { CenteredView } from \"@webiny/app-admin\";\nimport { usePasswordValidator } from \"~/admin/presentation/shared/usePasswordValidator.js\";\nimport { Alert, Button, Grid, Input, OverlayLoader, useToast } from \"@webiny/admin-ui\";\n\nconst t = i18n.ns(\"app-security-admin-users/account-form\");\n\ninterface UserAccountFormData {\n id?: boolean;\n firstName: string;\n lastName: string;\n email: string;\n password?: string;\n external?: boolean;\n avatar: {\n src?: string;\n };\n}\n\nexport const UserAccountForm = () => {\n const [isSaving, setSaving] = useState(false);\n const [isLoading, setIsLoading] = useState(true);\n const [user, setUser] = useState<Record<string, any>>({});\n const toast = useToast();\n const { identity } = useIdentity();\n const passwordValidator = usePasswordValidator();\n const { useCase: getCurrentUser } = useFeature(GetCurrentUserFeature);\n const { useCase: updateCurrentUser } = useFeature(UpdateCurrentUserFeature);\n\n useEffect(() => {\n getCurrentUser.execute().then(data => {\n setUser(data);\n setIsLoading(false);\n });\n }, []);\n\n const isFormLoading = isSaving || isLoading;\n const loaderMessage = isSaving ? \"Saving account...\" : \"Loading account...\";\n\n const emailIsDisabled = appConfig.getKey(\n \"ADMIN_USER_CAN_CHANGE_EMAIL\",\n process.env.REACT_APP_ADMIN_USER_CAN_CHANGE_EMAIL === \"false\"\n );\n\n const isExternal = user?.external === true;\n\n const onSubmit = async (formData: UserAccountFormData) => {\n setSaving(true);\n\n try {\n await updateCurrentUser.execute(omit(formData, [\"id\", \"external\"]));\n\n identity.update({\n displayName: `${formData.firstName} ${formData.lastName}`,\n profile: {\n ...(identity.profile || {}),\n firstName: formData.firstName,\n lastName: formData.lastName,\n avatar: formData.avatar\n }\n });\n\n toast.showSuccessToast({ title: \"Account updated successfully!\" });\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Unknown error\";\n toast.showWarningToast({\n title: \"Error updating user account\",\n description: message,\n duration: Infinity\n });\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <CenteredView maxWidth={600}>\n <Form<UserAccountFormData> data={user} onSubmit={onSubmit}>\n {({ data, form, Bind }) => (\n <SimpleForm>\n {isFormLoading && <OverlayLoader text={loaderMessage} />}\n <SimpleFormHeader title={\"Account\"} />\n <SimpleFormContent>\n {isExternal && (\n <Grid>\n <Grid.Column span={12}>\n <Alert type={\"info\"} title={\"External User\"}>\n This user is an external user and cannot be edited.\n </Alert>\n </Grid.Column>\n </Grid>\n )}\n <Grid>\n <Grid.Column span={12} data-testid={\"avatar\"}>\n <Bind name=\"avatar\">\n <AvatarImage round disabled={isExternal} />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name=\"firstName\"\n validators={validation.create(\"required\")}\n >\n <Input\n label={t`First Name`}\n disabled={isExternal}\n data-testid=\"account.firstname\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n {\" \"}\n <Bind\n name=\"lastName\"\n validators={validation.create(\"required\")}\n >\n <Input\n label={t`Last Name`}\n disabled={isExternal}\n data-testid=\"account.lastname\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name=\"email\"\n validators={validation.create(\"required,email\")}\n >\n <Input\n value={data.email}\n label={t`Email`}\n disabled={emailIsDisabled || isExternal}\n data-testid=\"account.email\"\n description={\n \"Email is your unique identifier used to login!\"\n }\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name=\"password\" validators={passwordValidator}>\n <Input\n autoComplete=\"off\"\n disabled={data.external}\n description={\n data.id && \"Type a new password to reset it.\"\n }\n type=\"password\"\n label={\"Password\"}\n data-testid=\"account.password\"\n />\n </Bind>\n </Grid.Column>\n </Grid>\n </SimpleFormContent>\n <SimpleFormFooter data-testid={\"form-footer\"}>\n <Button\n disabled={isExternal}\n data-testid=\"account.updatebutton\"\n onClick={form.submit}\n >{t`Update account`}</Button>\n </SimpleFormFooter>\n </SimpleForm>\n )}\n </Form>\n </CenteredView>\n );\n};\n"],"names":["t","i18n","UserAccountForm","isSaving","setSaving","useState","isLoading","setIsLoading","user","setUser","toast","useToast","identity","useIdentity","passwordValidator","usePasswordValidator","getCurrentUser","useFeature","GetCurrentUserFeature","updateCurrentUser","UpdateCurrentUserFeature","useEffect","data","isFormLoading","loaderMessage","emailIsDisabled","appConfig","process","isExternal","onSubmit","formData","omit","error","message","Error","Infinity","CenteredView","Form","form","Bind","SimpleForm","OverlayLoader","SimpleFormHeader","SimpleFormContent","Grid","Alert","AvatarImage","validation","Input","SimpleFormFooter","Button"],"mappings":";;;;;;;;;;;;;AAsBA,MAAMA,IAAIC,KAAK,EAAE,CAAC;AAcX,MAAMC,kBAAkB;IAC3B,MAAM,CAACC,UAAUC,UAAU,GAAGC,SAAS;IACvC,MAAM,CAACC,WAAWC,aAAa,GAAGF,SAAS;IAC3C,MAAM,CAACG,MAAMC,QAAQ,GAAGJ,SAA8B,CAAC;IACvD,MAAMK,QAAQC;IACd,MAAM,EAAEC,QAAQ,EAAE,GAAGC;IACrB,MAAMC,oBAAoBC;IAC1B,MAAM,EAAE,SAASC,cAAc,EAAE,GAAGC,WAAWC;IAC/C,MAAM,EAAE,SAASC,iBAAiB,EAAE,GAAGF,WAAWG;IAElDC,UAAU;QACNL,eAAe,OAAO,GAAG,IAAI,CAACM,CAAAA;YAC1Bb,QAAQa;YACRf,aAAa;QACjB;IACJ,GAAG,EAAE;IAEL,MAAMgB,gBAAgBpB,YAAYG;IAClC,MAAMkB,gBAAgBr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AIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;YAAC,MAAM;YAAI,eAAa;yBAChC,oBAACL,MAAAA;YAAK,MAAK;yBACP,oBAACO,aAAWA;YAAC;YAAM,UAAUlB;4BAGrC,oBAACgB,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACL,MAAAA;YACG,MAAK;YACL,YAAYQ,WAAW,MAAM,CAAC;yBAE9B,oBAACC,OAAKA;YACF,OAAOhD,CAAC,CAAC,UAAU,CAAC;YACpB,UAAU4B;YACV,eAAY;4BAIxB,oBAACgB,KAAK,MAAM;YAAC,MAAM;WACd,mBACD,oBAACL,MAAAA;YACG,MAAK;YACL,YAAYQ,WAAW,MAAM,CAAC;yBAE9B,oBAACC,OAAKA;YACF,OAAOhD,CAAC,CAAC,SAAS,CAAC;YACnB,UAAU4B;YACV,eAAY;4BAIxB,oBAACgB,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACL,MAAAA;YACG,MAAK;YACL,YAAYQ,WAAW,MAAM,CAAC;yBAE9B,oBAACC,OAAKA;YACF,OAAO1B,KAAK,KAAK;YACjB,OAAOtB,CAAC,CAAC,KAAK,CAAC;YACf,UAAUyB,mBAAmBG;YAC7B,eAAY;YACZ,aACI;4BAKhB,oBAACgB,KAAK,MAAM;YAAC,MAAM;yBACf,oBAACL,MAAAA;YAAK,MAAK;YAAW,YAAYzB;yBAC9B,oBAACkC,OAAKA;YACF,cAAa;YACb,UAAU1B,KAAK,QAAQ;YACvB,aACIA,KAAK,EAAE,IAAI;YAEf,MAAK;YACL,OAAO;YACP,eAAY;8BAMhC,oBAAC2B,kBAAgBA;YAAC,eAAa;yBAC3B,oBAACC,QAAMA;YACH,UAAUtB;YACV,eAAY;YACZ,SAASU,KAAK,MAAM;WACtBtC,CAAC,CAAC,cAAc,CAAC;AAO/C"}
|
|
1
|
+
{"version":3,"file":"admin/ui/views/Account/Account.js","sources":["../../../../../src/admin/ui/views/Account/Account.tsx"],"sourcesContent":["import React, { useEffect, useState } from \"react\";\nimport omit from \"lodash/omit.js\";\nimport { useFeature } from \"@webiny/app\";\nimport { i18n } from \"@webiny/app/i18n/index.js\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { AvatarImage } from \"../../components/AvatarImage/index.js\";\nimport { config as appConfig } from \"@webiny/app/config.js\";\nimport { GetCurrentUserFeature } from \"~/admin/features/account/getCurrentUser/index.js\";\nimport { UpdateCurrentUserFeature } from \"~/admin/features/account/updateCurrentUser/index.js\";\n\nimport {\n SimpleForm,\n SimpleFormHeader,\n SimpleFormFooter,\n SimpleFormContent,\n useIdentity\n} from \"@webiny/app-admin\";\nimport { CenteredView } from \"@webiny/app-admin\";\nimport { usePasswordValidator } from \"~/admin/presentation/shared/usePasswordValidator.js\";\nimport { Alert, Button, Grid, Input, OverlayLoader, useToast } from \"@webiny/admin-ui\";\n\nconst t = i18n.ns(\"app-security-admin-users/account-form\");\n\ninterface UserAccountFormData {\n id?: boolean;\n firstName: string;\n lastName: string;\n email: string;\n password?: string;\n external?: boolean;\n avatar: {\n src?: string;\n };\n}\n\nexport const UserAccountForm = () => {\n const [isSaving, setSaving] = useState(false);\n const [isLoading, setIsLoading] = useState(true);\n const [user, setUser] = useState<Record<string, any>>({});\n const toast = useToast();\n const { identity } = useIdentity();\n const passwordValidator = usePasswordValidator();\n const { useCase: getCurrentUser } = useFeature(GetCurrentUserFeature);\n const { useCase: updateCurrentUser } = useFeature(UpdateCurrentUserFeature);\n\n useEffect(() => {\n getCurrentUser.execute().then(data => {\n setUser(data);\n setIsLoading(false);\n });\n }, []);\n\n const isFormLoading = isSaving || isLoading;\n const loaderMessage = isSaving ? \"Saving account...\" : \"Loading account...\";\n\n const emailIsDisabled = appConfig.getKey(\n \"ADMIN_USER_CAN_CHANGE_EMAIL\",\n process.env.REACT_APP_ADMIN_USER_CAN_CHANGE_EMAIL === \"false\"\n );\n\n const isExternal = user?.external === true;\n\n const onSubmit = async (formData: UserAccountFormData) => {\n setSaving(true);\n\n try {\n await updateCurrentUser.execute(omit(formData, [\"id\", \"external\"]));\n\n identity.update({\n displayName: `${formData.firstName} ${formData.lastName}`,\n profile: {\n ...(identity.profile || {}),\n firstName: formData.firstName,\n lastName: formData.lastName,\n avatar: formData.avatar\n }\n });\n\n toast.showSuccessToast({ title: \"Account updated successfully!\" });\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Unknown error\";\n toast.showWarningToast({\n title: \"Error updating user account\",\n description: message,\n duration: Infinity\n });\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <CenteredView maxWidth={600}>\n <Form<UserAccountFormData> data={user} onSubmit={onSubmit}>\n {({ data, form, Bind }) => (\n <SimpleForm>\n {isFormLoading && <OverlayLoader text={loaderMessage} />}\n <SimpleFormHeader title={\"Account\"} />\n <SimpleFormContent>\n {isExternal && (\n <Grid>\n <Grid.Column span={12}>\n <Alert type={\"info\"} title={\"External User\"}>\n This user is an external user and cannot be edited.\n </Alert>\n </Grid.Column>\n </Grid>\n )}\n <Grid>\n <Grid.Column span={12} data-testid={\"avatar\"}>\n <Bind name=\"avatar\">\n <AvatarImage round disabled={isExternal} />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name=\"firstName\"\n validators={validation.create(\"required\")}\n >\n <Input\n label={t`First Name`}\n disabled={isExternal}\n data-testid=\"account.firstname\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n {\" \"}\n <Bind\n name=\"lastName\"\n validators={validation.create(\"required\")}\n >\n <Input\n label={t`Last Name`}\n disabled={isExternal}\n data-testid=\"account.lastname\"\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind\n name=\"email\"\n validators={validation.create(\"required,email\")}\n >\n <Input\n value={data.email}\n label={t`Email`}\n disabled={emailIsDisabled || isExternal}\n data-testid=\"account.email\"\n description={\n \"Email is your unique identifier used to login!\"\n }\n />\n </Bind>\n </Grid.Column>\n <Grid.Column span={12}>\n <Bind name=\"password\" validators={passwordValidator}>\n <Input\n autoComplete=\"off\"\n disabled={data.external}\n description={\n data.id && \"Type a new password to reset it.\"\n }\n type=\"password\"\n label={\"Password\"}\n data-testid=\"account.password\"\n />\n </Bind>\n </Grid.Column>\n </Grid>\n </SimpleFormContent>\n <SimpleFormFooter data-testid={\"form-footer\"}>\n <Button\n disabled={isExternal}\n data-testid=\"account.updatebutton\"\n onClick={form.submit}\n >{t`Update account`}</Button>\n </SimpleFormFooter>\n </SimpleForm>\n )}\n </Form>\n </CenteredView>\n );\n};\n"],"names":["t","i18n","UserAccountForm","isSaving","setSaving","useState","isLoading","setIsLoading","user","setUser","toast","useToast","identity","useIdentity","passwordValidator","usePasswordValidator","getCurrentUser","useFeature","GetCurrentUserFeature","updateCurrentUser","UpdateCurrentUserFeature","useEffect","data","isFormLoading","loaderMessage","emailIsDisabled","appConfig","process","isExternal","onSubmit","formData","omit","error","message","Error","Infinity","CenteredView","Form","form","Bind","SimpleForm","OverlayLoader","SimpleFormHeader","SimpleFormContent","Grid","Alert","AvatarImage","validation","Input","SimpleFormFooter","Button"],"mappings":";;;;;;;;;;;;;AAsBA,MAAMA,IAAIC,KAAK,EAAE,CAAC;AAcX,MAAMC,kBAAkB;IAC3B,MAAM,CAACC,UAAUC,UAAU,GAAGC,SAAS;IACvC,MAAM,CAACC,WAAWC,aAAa,GAAGF,SAAS;IAC3C,MAAM,CAACG,MAAMC,QAAQ,GAAGJ,SAA8B,CAAC;IACvD,MAAMK,QAAQC;IACd,MAAM,EAAEC,QAAQ,EAAE,GAAGC;IACrB,MAAMC,oBAAoBC;IAC1B,MAAM,EAAE,SAASC,cAAc,EAAE,GAAGC,WAAWC;IAC/C,MAAM,EAAE,SAASC,iBAAiB,EAAE,GAAGF,WAAWG;IAElDC,UAAU;QACNL,eAAe,OAAO,GAAG,IAAI,CAACM,CAAAA;YAC1Bb,QAAQa;YACRf,aAAa;QACjB;IACJ,GAAG,EAAE;IAEL,MAAMgB,gBAAgBpB,YAAYG;IAClC,MAAMkB,g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2
|
+
import { LeftPanel, RightPanel, SplitView, useFeatureFlags } from "@webiny/app-admin";
|
|
3
3
|
import UsersDataList from "./UsersDataList.js";
|
|
4
4
|
import { UserForm } from "./UsersForm.js";
|
|
5
5
|
const UsersView = ()=>{
|
|
6
|
-
const
|
|
7
|
-
const teams =
|
|
6
|
+
const featureFlags = useFeatureFlags();
|
|
7
|
+
const teams = featureFlags.isEnabled("advancedAccessControlLayer.teams");
|
|
8
8
|
return /*#__PURE__*/ react.createElement(SplitView, null, /*#__PURE__*/ react.createElement(LeftPanel, null, /*#__PURE__*/ react.createElement(UsersDataList, null)), /*#__PURE__*/ react.createElement(RightPanel, null, /*#__PURE__*/ react.createElement(UserForm, {
|
|
9
9
|
teams: teams
|
|
10
10
|
})));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/ui/views/Users/UsersView.js","sources":["../../../../../src/admin/ui/views/Users/UsersView.tsx"],"sourcesContent":["import React from \"react\";\nimport { LeftPanel, RightPanel, SplitView } from \"@webiny/app-admin\";\nimport UsersDataList from \"~/admin/ui/views/Users/UsersDataList.js\";\nimport {
|
|
1
|
+
{"version":3,"file":"admin/ui/views/Users/UsersView.js","sources":["../../../../../src/admin/ui/views/Users/UsersView.tsx"],"sourcesContent":["import React from \"react\";\nimport { LeftPanel, RightPanel, SplitView } from \"@webiny/app-admin\";\nimport UsersDataList from \"~/admin/ui/views/Users/UsersDataList.js\";\nimport { useFeatureFlags } from \"@webiny/app-admin\";\nimport { UserForm } from \"./UsersForm.js\";\n\nexport const UsersView = () => {\n const featureFlags = useFeatureFlags();\n\n const teams = featureFlags.isEnabled(\"advancedAccessControlLayer.teams\");\n\n return (\n <SplitView>\n <LeftPanel>\n <UsersDataList />\n </LeftPanel>\n <RightPanel>\n <UserForm teams={teams} />\n </RightPanel>\n </SplitView>\n );\n};\n"],"names":["UsersView","featureFlags","useFeatureFlags","teams","SplitView","LeftPanel","UsersDataList","RightPanel","UserForm"],"mappings":";;;;AAMO,MAAMA,YAAY;IACrB,MAAMC,eAAeC;IAErB,MAAMC,QAAQF,aAAa,SAAS,CAAC;IAErC,OAAO,WAAP,GACI,oBAACG,WAASA,MAAAA,WAAAA,GACN,oBAACC,WAASA,MAAAA,WAAAA,GACN,oBAACC,eAAaA,QAAAA,WAAAA,GAElB,oBAACC,YAAUA,MAAAA,WAAAA,GACP,oBAACC,UAAQA;QAAC,OAAOL;;AAIjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin/ui/views/Users/hooks/useUserForm.js","sources":["../../../../../../src/admin/ui/views/Users/hooks/useUserForm.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from \"react\";\nimport isEmpty from \"lodash/isEmpty.js\";\nimport omit from \"lodash/omit.js\";\nimport { useFeature } from \"@webiny/app\";\nimport { useRoute, useRouter } from \"@webiny/app-admin\";\nimport { GetUserFeature } from \"~/admin/features/users/getUser/index.js\";\nimport type { IGetUserGatewayResult } from \"~/admin/features/users/getUser/abstractions/GetUserGateway.js\";\nimport { CreateUserFeature } from \"~/admin/features/users/createUser/index.js\";\nimport { UpdateUserFeature } from \"~/admin/features/users/updateUser/index.js\";\nimport { Routes } from \"~/admin/routes.js\";\nimport { useToast } from \"@webiny/admin-ui\";\n\ninterface SubmitUserCallableParams {\n id?: string;\n firstName: string;\n lastName: string;\n email: string;\n password?: string;\n avatar: {\n src?: string;\n };\n external?: boolean;\n}\n\ninterface SubmitUserCallable {\n (data: SubmitUserCallableParams): Promise<void>;\n}\n\nexport function useUserForm() {\n const { goToRoute } = useRouter();\n const { route } = useRoute(Routes.Users.List);\n const toast = useToast();\n\n const { useCase: getUser } = useFeature(GetUserFeature);\n const { useCase: createUser } = useFeature(CreateUserFeature);\n const { useCase: updateUser } = useFeature(UpdateUserFeature);\n\n const id = route.params.id;\n const newUser = route.params.new === true;\n\n const [user, setUser] = useState<IGetUserGatewayResult | undefined>(undefined);\n const [userLoading, setUserLoading] = useState(false);\n const [mutationLoading, setMutationLoading] = useState(false);\n\n useEffect(() => {\n if (!id) {\n return;\n }\n setUserLoading(true);\n getUser\n .execute({ id })\n .then(data => {\n setUser(data);\n setUserLoading(false);\n })\n .catch(error => {\n goToRoute(Routes.Users.List);\n toast.showWarningToast({\n title: \"Error loading user profile\",\n description: error.message,\n duration: Infinity\n });\n setUserLoading(false);\n });\n }, [id]);\n\n const loading = userLoading || mutationLoading;\n\n const onSubmit = useCallback<SubmitUserCallable>(\n async data => {\n setMutationLoading(true);\n\n try {\n if (newUser) {\n const resultUser = await createUser.execute({ data });\n goToRoute(Routes.Users.List, { id: resultUser.id });\n } else {\n const { id: userId, ...rest } = data;\n await updateUser.execute({\n id: userId as string,\n data: omit(rest, [\"external\"])\n });\n }\n\n toast.showSuccessToast({\n title: \"User saved successfully.\"\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Unknown error\";\n toast.showWarningToast({\n title: \"Error updating user profile\",\n description: message,\n duration: Infinity\n });\n } finally {\n setMutationLoading(false);\n }\n },\n [id, newUser]\n );\n\n const showEmptyView = !newUser && !userLoading && isEmpty(user);\n\n return {\n id,\n loading,\n user,\n onSubmit,\n isNewUser: newUser,\n fullName: `${user?.firstName || \"\"} ${user?.lastName || \"\"}`.trim(),\n showEmptyView,\n createUser() {\n goToRoute(Routes.Users.List, { new: true });\n },\n cancelEditing() {\n goToRoute(Routes.Users.List);\n }\n };\n}\n"],"names":["useUserForm","goToRoute","useRouter","route","useRoute","Routes","toast","useToast","getUser","useFeature","GetUserFeature","createUser","CreateUserFeature","updateUser","UpdateUserFeature","id","newUser","user","setUser","useState","undefined","userLoading","setUserLoading","mutationLoading","setMutationLoading","useEffect","data","error","Infinity","loading","onSubmit","useCallback","resultUser","userId","rest","omit","message","Error","showEmptyView","isEmpty"],"mappings":";;;;;;;;;;AA4BO,SAASA;IACZ,MAAM,EAAEC,SAAS,EAAE,GAAGC;IACtB,MAAM,EAAEC,KAAK,EAAE,GAAGC,SAASC,OAAO,KAAK,CAAC,IAAI;IAC5C,MAAMC,QAAQC;IAEd,MAAM,EAAE,SAASC,OAAO,EAAE,GAAGC,WAAWC;IACxC,MAAM,EAAE,SAASC,UAAU,EAAE,GAAGF,WAAWG;IAC3C,MAAM,EAAE,SAASC,UAAU,EAAE,GAAGJ,WAAWK;IAE3C,MAAMC,KAAKZ,MAAM,MAAM,CAAC,EAAE;IAC1B,MAAMa,UAAUb,AAAqB,SAArBA,MAAM,MAAM,CAAC,GAAG;IAEhC,MAAM,CAACc,MAAMC,QAAQ,GAAGC,SAA4CC;IACpE,MAAM,CAACC,aAAaC,eAAe,GAAGH,SAAS;IAC/C,MAAM,CAACI,iBAAiBC,mBAAmB,GAAGL,SAAS;IAEvDM,UAAU;QACN,IAAI,CAACV,IACD;QAEJO,eAAe;QACfd,QACK,OAAO,CAAC;YAAEO;QAAG,GACb,IAAI,CAACW,CAAAA;YACFR,QAAQQ;YACRJ,eAAe;QACnB,GACC,KAAK,CAACK,CAAAA;YACH1B,UAAUI,OAAO,KAAK,CAAC,IAAI;YAC3BC,MAAM,gBAAgB,CAAC;gBACnB,OAAO;gBACP,aAAaqB,MAAM,OAAO;gBAC1B,UAAUC;
|
|
1
|
+
{"version":3,"file":"admin/ui/views/Users/hooks/useUserForm.js","sources":["../../../../../../src/admin/ui/views/Users/hooks/useUserForm.ts"],"sourcesContent":["import { useCallback, useEffect, useState } from \"react\";\nimport isEmpty from \"lodash/isEmpty.js\";\nimport omit from \"lodash/omit.js\";\nimport { useFeature } from \"@webiny/app\";\nimport { useRoute, useRouter } from \"@webiny/app-admin\";\nimport { GetUserFeature } from \"~/admin/features/users/getUser/index.js\";\nimport type { IGetUserGatewayResult } from \"~/admin/features/users/getUser/abstractions/GetUserGateway.js\";\nimport { CreateUserFeature } from \"~/admin/features/users/createUser/index.js\";\nimport { UpdateUserFeature } from \"~/admin/features/users/updateUser/index.js\";\nimport { Routes } from \"~/admin/routes.js\";\nimport { useToast } from \"@webiny/admin-ui\";\n\ninterface SubmitUserCallableParams {\n id?: string;\n firstName: string;\n lastName: string;\n email: string;\n password?: string;\n avatar: {\n src?: string;\n };\n external?: boolean;\n}\n\ninterface SubmitUserCallable {\n (data: SubmitUserCallableParams): Promise<void>;\n}\n\nexport function useUserForm() {\n const { goToRoute } = useRouter();\n const { route } = useRoute(Routes.Users.List);\n const toast = useToast();\n\n const { useCase: getUser } = useFeature(GetUserFeature);\n const { useCase: createUser } = useFeature(CreateUserFeature);\n const { useCase: updateUser } = useFeature(UpdateUserFeature);\n\n const id = route.params.id;\n const newUser = route.params.new === true;\n\n const [user, setUser] = useState<IGetUserGatewayResult | undefined>(undefined);\n const [userLoading, setUserLoading] = useState(false);\n const [mutationLoading, setMutationLoading] = useState(false);\n\n useEffect(() => {\n if (!id) {\n return;\n }\n setUserLoading(true);\n getUser\n .execute({ id })\n .then(data => {\n setUser(data);\n setUserLoading(false);\n })\n .catch(error => {\n goToRoute(Routes.Users.List);\n toast.showWarningToast({\n title: \"Error loading user profile\",\n description: error.message,\n duration: Infinity\n });\n setUserLoading(false);\n });\n }, [id]);\n\n const loading = userLoading || mutationLoading;\n\n const onSubmit = useCallback<SubmitUserCallable>(\n async data => {\n setMutationLoading(true);\n\n try {\n if (newUser) {\n const resultUser = await createUser.execute({ data });\n goToRoute(Routes.Users.List, { id: resultUser.id });\n } else {\n const { id: userId, ...rest } = data;\n await updateUser.execute({\n id: userId as string,\n data: omit(rest, [\"external\"])\n });\n }\n\n toast.showSuccessToast({\n title: \"User saved successfully.\"\n });\n } catch (error) {\n const message = error instanceof Error ? error.message : \"Unknown error\";\n toast.showWarningToast({\n title: \"Error updating user profile\",\n description: message,\n duration: Infinity\n });\n } finally {\n setMutationLoading(false);\n }\n },\n [id, newUser]\n );\n\n const showEmptyView = !newUser && !userLoading && isEmpty(user);\n\n return {\n id,\n loading,\n user,\n onSubmit,\n isNewUser: newUser,\n fullName: `${user?.firstName || \"\"} ${user?.lastName || \"\"}`.trim(),\n showEmptyView,\n createUser() {\n goToRoute(Routes.Users.List, { new: true });\n },\n cancelEditing() {\n goToRoute(Routes.Users.List);\n }\n };\n}\n"],"names":["useUserForm","goToRoute","useRouter","route","useRoute","Routes","toast","useToast","getUser","useFeature","GetUserFeature","createUser","CreateUserFeature","updateUser","UpdateUserFeature","id","newUser","user","setUser","useState","undefined","userLoading","setUserLoading","mutationLoading","setMutationLoading","useEffect","data","error","Infinity","loading","onSubmit","useCallback","resultUser","userId","rest","omit","message","Error","showEmptyView","isEmpty"],"mappings":";;;;;;;;;;AA4BO,SAASA;IACZ,MAAM,EAAEC,SAAS,EAAE,GAAGC;IACtB,MAAM,EAAEC,KAAK,EAAE,GAAGC,SAASC,OAAO,KAAK,CAAC,IAAI;IAC5C,MAAMC,QAAQC;IAEd,MAAM,EAAE,SAASC,OAAO,EAAE,GAAGC,WAAWC;IACxC,MAAM,EAAE,SAASC,UAAU,EAAE,GAAGF,WAAWG;IAC3C,MAAM,EAAE,SAASC,UAAU,EAAE,GAAGJ,WAAWK;IAE3C,MAAMC,KAAKZ,MAAM,MAAM,CAAC,EAAE;IAC1B,MAAMa,UAAUb,AAAqB,SAArBA,MAAM,MAAM,CAAC,GAAG;IAEhC,MAAM,CAACc,MAAMC,QAAQ,GAAGC,SAA4CC;IACpE,MAAM,CAACC,aAAaC,eAAe,GAAGH,SAAS;IAC/C,MAAM,CAACI,iBAAiBC,mBAAmB,GAAGL,SAAS;IAEvDM,UAAU;QACN,IAAI,CAACV,IACD;QAEJO,eAAe;QACfd,QACK,OAAO,CAAC;YAAEO;QAAG,GACb,IAAI,CAACW,CAAAA;YACFR,QAAQQ;YACRJ,eAAe;QACnB,GACC,KAAK,CAACK,CAAAA;YACH1B,UAAUI,OAAO,KAAK,CAAC,IAAI;YAC3BC,MAAM,gBAAgB,CAAC;gBACnB,OAAO;gBACP,aAAaqB,MAAM,OAAO;gBAC1B,UAAUC,KAAQ;YACtB;YACAN,eAAe;QACnB;IACR,GAAG;QAACP;KAAG;IAEP,MAAMc,UAAUR,eAAeE;IAE/B,MAAMO,WAAWC,YACb,OAAML;QACFF,mBAAmB;QAEnB,IAAI;YACA,IAAIR,SAAS;gBACT,MAAMgB,aAAa,MAAMrB,WAAW,OAAO,CAAC;oBAAEe;gBAAK;gBACnDzB,UAAUI,OAAO,KAAK,CAAC,IAAI,EAAE;oBAAE,IAAI2B,WAAW,EAAE;gBAAC;YACrD,OAAO;gBACH,MAAM,EAAE,IAAIC,MAAM,EAAE,GAAGC,MAAM,GAAGR;gBAChC,MAAMb,WAAW,OAAO,CAAC;oBACrB,IAAIoB;oBACJ,MAAME,KAAKD,MAAM;wBAAC;qBAAW;gBACjC;YACJ;YAEA5B,MAAM,gBAAgB,CAAC;gBACnB,OAAO;YACX;QACJ,EAAE,OAAOqB,OAAO;YACZ,MAAMS,UAAUT,iBAAiBU,QAAQV,MAAM,OAAO,GAAG;YACzDrB,MAAM,gBAAgB,CAAC;gBACnB,OAAO;gBACP,aAAa8B;gBACb,UAAUR,KAAQ;YACtB;QACJ,SAAU;YACNJ,mBAAmB;QACvB;IACJ,GACA;QAACT;QAAIC;KAAQ;IAGjB,MAAMsB,gBAAgB,CAACtB,WAAW,CAACK,eAAekB,QAAQtB;IAE1D,OAAO;QACHF;QACAc;QACAZ;QACAa;QACA,WAAWd;QACX,UAAU,GAAGC,MAAM,aAAa,GAAG,CAAC,EAAEA,MAAM,YAAY,IAAI,CAAC,IAAI;QACjEqB;QACA;YACIrC,UAAUI,OAAO,KAAK,CAAC,IAAI,EAAE;gBAAE,KAAK;YAAK;QAC7C;QACA;YACIJ,UAAUI,OAAO,KAAK,CAAC,IAAI;QAC/B;IACJ;AACJ"}
|
|
@@ -3,7 +3,7 @@ import { CognitoIdentityProvider } from "./CognitoIdentityProvider.js";
|
|
|
3
3
|
const CognitoIdpFeature = createFeature({
|
|
4
4
|
name: "CognitoIdp",
|
|
5
5
|
register (container) {
|
|
6
|
-
container.register(CognitoIdentityProvider).
|
|
6
|
+
container.register(CognitoIdentityProvider).inContainerScope();
|
|
7
7
|
}
|
|
8
8
|
});
|
|
9
9
|
export { CognitoIdpFeature };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/features/CognitoIdp/feature.js","sources":["../../../../src/api/features/CognitoIdp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CognitoIdentityProvider } from \"./CognitoIdentityProvider.js\";\n\nexport const CognitoIdpFeature = createFeature({\n name: \"CognitoIdp\",\n register(container) {\n container.register(CognitoIdentityProvider).
|
|
1
|
+
{"version":3,"file":"api/features/CognitoIdp/feature.js","sources":["../../../../src/api/features/CognitoIdp/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { CognitoIdentityProvider } from \"./CognitoIdentityProvider.js\";\n\nexport const CognitoIdpFeature = createFeature({\n name: \"CognitoIdp\",\n register(container) {\n // Registered per request by CognitoApiFeature (the `<Cognito/>` extension). Container scoped:\n // one provider per request, built from the request container, so it sees the optional\n // CognitoIdpConfig that other extensions (e.g. Entra ID) register there.\n container.register(CognitoIdentityProvider).inContainerScope();\n }\n});\n"],"names":["CognitoIdpFeature","createFeature","container","CognitoIdentityProvider"],"mappings":";;AAGO,MAAMA,oBAAoBC,cAAc;IAC3C,MAAM;IACN,UAASC,SAAS;QAIdA,UAAU,QAAQ,CAACC,yBAAyB,gBAAgB;IAChE;AACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
|
|
2
2
|
declare class AdminUserSchemaImpl implements CoreGraphQLSchemaFactory.Interface {
|
|
3
|
+
getSchemaKey: () => string;
|
|
3
4
|
execute(builder: CoreGraphQLSchemaFactory.SchemaBuilder): CoreGraphQLSchemaFactory.Return;
|
|
4
5
|
}
|
|
5
6
|
export declare const AdminUsersSchema: typeof AdminUserSchemaImpl & {
|
package/api/graphql/user.gql.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ErrorResponse, NotFoundResponse, Response } from "@webiny/api-graphql/responses.js";
|
|
2
|
+
import { staticSchemaKey } from "@webiny/api-graphql/graphql/staticSchemaKey.js";
|
|
2
3
|
import { CoreGraphQLSchemaFactory } from "@webiny/api-graphql/graphql/abstractions.js";
|
|
3
4
|
import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
|
|
4
5
|
import { GetUserUseCase } from "@webiny/api-core/features/users/GetUser/index.js";
|
|
@@ -133,6 +134,9 @@ class AdminUserSchemaImpl {
|
|
|
133
134
|
});
|
|
134
135
|
return builder;
|
|
135
136
|
}
|
|
137
|
+
constructor(){
|
|
138
|
+
this.getSchemaKey = staticSchemaKey("cognito/AdminUserSchemaImpl");
|
|
139
|
+
}
|
|
136
140
|
}
|
|
137
141
|
const AdminUsersSchema = CoreGraphQLSchemaFactory.createImplementation({
|
|
138
142
|
implementation: AdminUserSchemaImpl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api/graphql/user.gql.js","sources":["../../../src/api/graphql/user.gql.ts"],"sourcesContent":["import { ErrorResponse, NotFoundResponse, Response } from \"@webiny/api-graphql/responses.js\";\nimport { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { GetUserUseCase } from \"@webiny/api-core/features/users/GetUser/index.js\";\nimport NotAuthorizedResponse from \"@webiny/api-core/graphql/security/NotAuthorizedResponse.js\";\nimport { CreateUserUseCase } from \"~/api/features/CreateUser/index.js\";\nimport { UpdateUserUseCase } from \"~/api/features/UpdateUser/index.js\";\nimport { DeleteUserUseCase } from \"~/api/features/DeleteUser/index.js\";\n\nclass AdminUserSchemaImpl implements CoreGraphQLSchemaFactory.Interface {\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n \"\"\"\n This input type is used by administrators to create other user's accounts within the same tenant.\n \"\"\"\n input AdminUsersCreateInput {\n email: String!\n firstName: String!\n lastName: String!\n password: String!\n avatar: JSON\n roles: [RefInput!]\n teams: [RefInput!]\n }\n\n \"\"\"\n This input type is used by administrators to update other user's accounts within the same tenant.\n \"\"\"\n input AdminUsersUpdateInput {\n email: String\n firstName: String\n lastName: String\n password: String\n avatar: JSON\n roles: [RefInput!]\n teams: [RefInput!]\n }\n\n \"\"\"\n This input type is used by the user who is updating his own account\n \"\"\"\n input AdminUsersCurrentUserInput {\n email: String\n firstName: String\n lastName: String\n password: String\n avatar: JSON\n }\n\n extend type AdminUsersMutation {\n updateCurrentUser(data: AdminUsersCurrentUserInput!): AdminUsersResponse\n\n createUser(data: AdminUsersCreateInput!): AdminUsersResponse\n\n updateUser(id: ID!, data: AdminUsersUpdateInput!): AdminUsersResponse\n\n deleteUser(id: ID!): AdminUsersBooleanResponse\n }\n `);\n\n builder.addResolver({\n path: \"AdminUsersMutation.updateCurrentUser\",\n dependencies: [IdentityContext, GetUserUseCase, UpdateUserUseCase],\n resolver: (\n identityContext: IdentityContext.Interface,\n getUserUseCase: GetUserUseCase.Interface,\n updateUserUseCase: UpdateUserUseCase.Interface\n ) => {\n return async ({ args }) => {\n const identity = identityContext.getIdentity();\n if (!identity.isAdmin()) {\n return new NotAuthorizedResponse();\n }\n\n // Current user might not have permissions for `adminUsers`.\n return await identityContext.withoutAuthorization(async () => {\n const getUserResult = await getUserUseCase.execute({ id: identity.id });\n if (getUserResult.isFail()) {\n // TODO: check if current identity belongs to a different tenant.\n // TODO: If so, switch to that other tenant, and update his profile there.\n return new NotFoundResponse(\"User not found!\");\n }\n\n const user = getUserResult.value;\n\n // TODO: UpdateCurrentUser should be a dedicated use case\n const updateResult = await updateUserUseCase.execute(user.id, args.data);\n if (updateResult.isFail()) {\n return new ErrorResponse({\n message: updateResult.error.message,\n code: updateResult.error.code,\n data: updateResult.error.data\n });\n }\n\n return new Response(updateResult.value);\n });\n };\n }\n });\n\n builder.addResolver({\n path: \"AdminUsersMutation.createUser\",\n dependencies: [CreateUserUseCase],\n resolver: (createUserUseCase: CreateUserUseCase.Interface) => {\n return async ({ args }) => {\n const result = await createUserUseCase.execute(args.data);\n if (result.isFail()) {\n return new ErrorResponse({\n message: result.error.message,\n code: result.error.code,\n data: result.error.data\n });\n }\n\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver({\n path: \"AdminUsersMutation.updateUser\",\n dependencies: [UpdateUserUseCase, IdentityContext],\n resolver: (\n updateUserUseCase: UpdateUserUseCase.Interface,\n identityContext: IdentityContext.Interface\n ) => {\n return async ({ args }) => {\n if (args.id === identityContext.getIdentity().id) {\n return new ErrorResponse({\n message:\n \"You're not allowed to update your own account using this API.\",\n code: \"AdminUser/GraphQL/UpdateSelf\"\n });\n }\n\n const result = await updateUserUseCase.execute(args.id, args.data);\n if (result.isFail()) {\n return new ErrorResponse({\n message: result.error.message,\n code: result.error.code\n });\n }\n\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver({\n path: \"AdminUsersMutation.deleteUser\",\n dependencies: [DeleteUserUseCase],\n resolver: (deleteUserUseCase: DeleteUserUseCase.Interface) => {\n return async ({ args }) => {\n const result = await deleteUserUseCase.execute(args.id);\n if (result.isFail()) {\n return new ErrorResponse({\n message: result.error.message,\n code: result.error.code,\n data: result.error.data\n });\n }\n\n return new Response(true);\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const AdminUsersSchema = CoreGraphQLSchemaFactory.createImplementation({\n implementation: AdminUserSchemaImpl,\n dependencies: []\n});\n"],"names":["AdminUserSchemaImpl","builder","IdentityContext","GetUserUseCase","UpdateUserUseCase","identityContext","getUserUseCase","updateUserUseCase","args","identity","NotAuthorizedResponse","getUserResult","NotFoundResponse","user","updateResult","ErrorResponse","Response","CreateUserUseCase","createUserUseCase","result","DeleteUserUseCase","deleteUserUseCase","AdminUsersSchema","CoreGraphQLSchemaFactory"],"mappings":";;;;;;;;AASA,MAAMA;IACF,MAAM,QACFC,OAA+C,EAChB;QAC/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AIH,SAASG,OAAO,KAAK;gBACpC;QAER;QAEAlB,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc;gBAACG;gBAAmBF;aAAgB;YAClD,UAAU,CACNK,mBACAF,kBAEO,OAAO,EAAEG,IAAI,EAAE;oBAClB,IAAIA,KAAK,EAAE,KAAKH,gBAAgB,WAAW,GAAG,EAAE,EAC5C,OAAO,IAAIU,cAAc;wBACrB,SACI;wBACJ,MAAM;oBACV;oBAGJ,MAAMI,SAAS,MAAMZ,kBAAkB,OAAO,CAACC,KAAK,EAAE,EAAEA,KAAK,IAAI;oBACjE,IAAIW,OAAO,MAAM,IACb,OAAO,IAAIJ,cAAc;wBACrB,SAASI,OAAO,KAAK,CAAC,OAAO;wBAC7B,MAAMA,OAAO,KAAK,CAAC,IAAI;oBAC3B;oBAGJ,OAAO,IAAIH,SAASG,OAAO,KAAK;gBACpC;QAER;QAEAlB,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc;gBAACmB;aAAkB;YACjC,UAAU,CAACC,oBACA,OAAO,EAAEb,IAAI,EAAE;oBAClB,MAAMW,SAAS,MAAME,kBAAkB,OAAO,CAACb,KAAK,EAAE;oBACtD,IAAIW,OAAO,MAAM,IACb,OAAO,IAAIJ,cAAc;wBACrB,SAASI,OAAO,KAAK,CAAC,OAAO;wBAC7B,MAAMA,OAAO,KAAK,CAAC,IAAI;wBACvB,MAAMA,OAAO,KAAK,CAAC,IAAI;oBAC3B;oBAGJ,OAAO,IAAIH,SAAS;gBACxB;QAER;QAEA,OAAOf;IACX;AACJ;AAEO,MAAMqB,mBAAmBC,yBAAyB,oBAAoB,CAAC;IAC1E,gBAAgBvB;IAChB,cAAc,EAAE;AACpB"}
|
|
1
|
+
{"version":3,"file":"api/graphql/user.gql.js","sources":["../../../src/api/graphql/user.gql.ts"],"sourcesContent":["import { ErrorResponse, NotFoundResponse, Response } from \"@webiny/api-graphql/responses.js\";\nimport { staticSchemaKey } from \"@webiny/api-graphql/graphql/staticSchemaKey.js\";\nimport { CoreGraphQLSchemaFactory } from \"@webiny/api-graphql/graphql/abstractions.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { GetUserUseCase } from \"@webiny/api-core/features/users/GetUser/index.js\";\nimport NotAuthorizedResponse from \"@webiny/api-core/graphql/security/NotAuthorizedResponse.js\";\nimport { CreateUserUseCase } from \"~/api/features/CreateUser/index.js\";\nimport { UpdateUserUseCase } from \"~/api/features/UpdateUser/index.js\";\nimport { DeleteUserUseCase } from \"~/api/features/DeleteUser/index.js\";\n\nclass AdminUserSchemaImpl implements CoreGraphQLSchemaFactory.Interface {\n public getSchemaKey = staticSchemaKey(\"cognito/AdminUserSchemaImpl\");\n\n async execute(\n builder: CoreGraphQLSchemaFactory.SchemaBuilder\n ): CoreGraphQLSchemaFactory.Return {\n builder.addTypeDefs(/* GraphQL */ `\n \"\"\"\n This input type is used by administrators to create other user's accounts within the same tenant.\n \"\"\"\n input AdminUsersCreateInput {\n email: String!\n firstName: String!\n lastName: String!\n password: String!\n avatar: JSON\n roles: [RefInput!]\n teams: [RefInput!]\n }\n\n \"\"\"\n This input type is used by administrators to update other user's accounts within the same tenant.\n \"\"\"\n input AdminUsersUpdateInput {\n email: String\n firstName: String\n lastName: String\n password: String\n avatar: JSON\n roles: [RefInput!]\n teams: [RefInput!]\n }\n\n \"\"\"\n This input type is used by the user who is updating his own account\n \"\"\"\n input AdminUsersCurrentUserInput {\n email: String\n firstName: String\n lastName: String\n password: String\n avatar: JSON\n }\n\n extend type AdminUsersMutation {\n updateCurrentUser(data: AdminUsersCurrentUserInput!): AdminUsersResponse\n\n createUser(data: AdminUsersCreateInput!): AdminUsersResponse\n\n updateUser(id: ID!, data: AdminUsersUpdateInput!): AdminUsersResponse\n\n deleteUser(id: ID!): AdminUsersBooleanResponse\n }\n `);\n\n builder.addResolver({\n path: \"AdminUsersMutation.updateCurrentUser\",\n dependencies: [IdentityContext, GetUserUseCase, UpdateUserUseCase],\n resolver: (\n identityContext: IdentityContext.Interface,\n getUserUseCase: GetUserUseCase.Interface,\n updateUserUseCase: UpdateUserUseCase.Interface\n ) => {\n return async ({ args }) => {\n const identity = identityContext.getIdentity();\n if (!identity.isAdmin()) {\n return new NotAuthorizedResponse();\n }\n\n // Current user might not have permissions for `adminUsers`.\n return await identityContext.withoutAuthorization(async () => {\n const getUserResult = await getUserUseCase.execute({ id: identity.id });\n if (getUserResult.isFail()) {\n // TODO: check if current identity belongs to a different tenant.\n // TODO: If so, switch to that other tenant, and update his profile there.\n return new NotFoundResponse(\"User not found!\");\n }\n\n const user = getUserResult.value;\n\n // TODO: UpdateCurrentUser should be a dedicated use case\n const updateResult = await updateUserUseCase.execute(user.id, args.data);\n if (updateResult.isFail()) {\n return new ErrorResponse({\n message: updateResult.error.message,\n code: updateResult.error.code,\n data: updateResult.error.data\n });\n }\n\n return new Response(updateResult.value);\n });\n };\n }\n });\n\n builder.addResolver({\n path: \"AdminUsersMutation.createUser\",\n dependencies: [CreateUserUseCase],\n resolver: (createUserUseCase: CreateUserUseCase.Interface) => {\n return async ({ args }) => {\n const result = await createUserUseCase.execute(args.data);\n if (result.isFail()) {\n return new ErrorResponse({\n message: result.error.message,\n code: result.error.code,\n data: result.error.data\n });\n }\n\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver({\n path: \"AdminUsersMutation.updateUser\",\n dependencies: [UpdateUserUseCase, IdentityContext],\n resolver: (\n updateUserUseCase: UpdateUserUseCase.Interface,\n identityContext: IdentityContext.Interface\n ) => {\n return async ({ args }) => {\n if (args.id === identityContext.getIdentity().id) {\n return new ErrorResponse({\n message:\n \"You're not allowed to update your own account using this API.\",\n code: \"AdminUser/GraphQL/UpdateSelf\"\n });\n }\n\n const result = await updateUserUseCase.execute(args.id, args.data);\n if (result.isFail()) {\n return new ErrorResponse({\n message: result.error.message,\n code: result.error.code\n });\n }\n\n return new Response(result.value);\n };\n }\n });\n\n builder.addResolver({\n path: \"AdminUsersMutation.deleteUser\",\n dependencies: [DeleteUserUseCase],\n resolver: (deleteUserUseCase: DeleteUserUseCase.Interface) => {\n return async ({ args }) => {\n const result = await deleteUserUseCase.execute(args.id);\n if (result.isFail()) {\n return new ErrorResponse({\n message: result.error.message,\n code: result.error.code,\n data: result.error.data\n });\n }\n\n return new Response(true);\n };\n }\n });\n\n return builder;\n }\n}\n\nexport const AdminUsersSchema = CoreGraphQLSchemaFactory.createImplementation({\n implementation: AdminUserSchemaImpl,\n dependencies: []\n});\n"],"names":["AdminUserSchemaImpl","builder","IdentityContext","GetUserUseCase","UpdateUserUseCase","identityContext","getUserUseCase","updateUserUseCase","args","identity","NotAuthorizedResponse","getUserResult","NotFoundResponse","user","updateResult","ErrorResponse","Response","CreateUserUseCase","createUserUseCase","result","DeleteUserUseCase","deleteUserUseCase","staticSchemaKey","AdminUsersSchema","CoreGraphQLSchemaFactory"],"mappings":";;;;;;;;;AAUA,MAAMA;IAGF,MAAM,QACFC,OAA+C,EAChB;QAC/BA,QAAQ,WAAW,CAAe,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+CnC,CAAC;QAEDA,QAAQ,WAAW,CAAC;YAChB,MAAM;YACN,cAAc;gBAACC;gBAAiBC;gBAAgBC;aAAkB;YAClE,UAAU,CACNC,iBACAC,gBACAC,oBAEO,OAAO,EAAEC,IAAI,EAAE;oBAClB,MAAMC,WAAWJ,gBAAgB,WAAW;oBAC5C,IAAI,CAACI,SAAS,OAAO,IACjB,OAAO,IAAIC;oBAIf,OAAO,MAAML,gBAAgB,oBAAoB,CAAC;wBAC9C,MAAMM,gBAAgB,MAAML,eAAe,OAAO,CAAC;4BAAE,IAAIG,SAAS,EAAE;wBAAC;wBACrE,IAAIE,cAAc,MAAM,IAGpB,OAAO,IAAIC,iBAAiB;wBAGhC,MAAMC,OAAOF,cAAc,KAAK;wBAGhC,MAAMG,eAAe,MAAMP,kBAAkB,OAAO,CAACM,KAAK,EAAE,EAAEL,KAAK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ACjC,UAAU,CAACC,oBACA,OAAO,EAAEb,IAAI,EAAE;oBAClB,MAAMW,SAAS,MAAME,kBAAkB,OAAO,CAACb,KAAK,EAAE;oBACtD,IAAIW,OAAO,MAAM,IACb,OAAO,IAAIJ,cAAc;wBACrB,SAASI,OAAO,KAAK,CAAC,OAAO;wBAC7B,MAAMA,OAAO,KAAK,CAAC,IAAI;wBACvB,MAAMA,OAAO,KAAK,CAAC,IAAI;oBAC3B;oBAGJ,OAAO,IAAIH,SAAS;gBACxB;QAER;QAEA,OAAOf;IACX;;aAnKO,YAAY,GAAGqB,gBAAgB;;AAoK1C;AAEO,MAAMC,mBAAmBC,yBAAyB,oBAAoB,CAAC;IAC1E,gBAAgBxB;IAChB,cAAc,EAAE;AACpB"}
|
|
@@ -3,6 +3,6 @@ declare class CognitoFederationPulumiImpl implements CorePulumi.Interface {
|
|
|
3
3
|
execute(app: CorePulumi.Params): void;
|
|
4
4
|
}
|
|
5
5
|
declare const _default: typeof CognitoFederationPulumiImpl & {
|
|
6
|
-
__abstraction: import("@webiny/di").Abstraction<import("@webiny/project-aws/abstractions").ICorePulumi>;
|
|
6
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/project-aws/abstractions/features/pulumi/CorePulumi").ICorePulumi>;
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/cognito",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.5387e5f7c8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -13,34 +13,33 @@
|
|
|
13
13
|
"description": "Security plugins for Cognito",
|
|
14
14
|
"author": "Webiny Ltd.",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@webiny/admin-ui": "0.0.0-unstable.
|
|
17
|
-
"@webiny/api-core": "0.0.0-unstable.
|
|
18
|
-
"@webiny/api-graphql": "0.0.0-unstable.
|
|
19
|
-
"@webiny/app": "0.0.0-unstable.
|
|
20
|
-
"@webiny/app-admin": "0.0.0-unstable.
|
|
21
|
-
"@webiny/aws-sdk": "0.0.0-unstable.
|
|
22
|
-
"@webiny/feature": "0.0.0-unstable.
|
|
23
|
-
"@webiny/form": "0.0.0-unstable.
|
|
24
|
-
"@webiny/icons": "0.0.0-unstable.
|
|
25
|
-
"@webiny/project": "0.0.0-unstable.
|
|
26
|
-
"@webiny/project-aws": "0.0.0-unstable.
|
|
27
|
-
"@webiny/react-properties": "0.0.0-unstable.
|
|
28
|
-
"@webiny/validation": "0.0.0-unstable.
|
|
16
|
+
"@webiny/admin-ui": "0.0.0-unstable.5387e5f7c8",
|
|
17
|
+
"@webiny/api-core": "0.0.0-unstable.5387e5f7c8",
|
|
18
|
+
"@webiny/api-graphql": "0.0.0-unstable.5387e5f7c8",
|
|
19
|
+
"@webiny/app": "0.0.0-unstable.5387e5f7c8",
|
|
20
|
+
"@webiny/app-admin": "0.0.0-unstable.5387e5f7c8",
|
|
21
|
+
"@webiny/aws-sdk": "0.0.0-unstable.5387e5f7c8",
|
|
22
|
+
"@webiny/feature": "0.0.0-unstable.5387e5f7c8",
|
|
23
|
+
"@webiny/form": "0.0.0-unstable.5387e5f7c8",
|
|
24
|
+
"@webiny/icons": "0.0.0-unstable.5387e5f7c8",
|
|
25
|
+
"@webiny/project": "0.0.0-unstable.5387e5f7c8",
|
|
26
|
+
"@webiny/project-aws": "0.0.0-unstable.5387e5f7c8",
|
|
27
|
+
"@webiny/react-properties": "0.0.0-unstable.5387e5f7c8",
|
|
28
|
+
"@webiny/validation": "0.0.0-unstable.5387e5f7c8",
|
|
29
29
|
"aws-amplify": "6.20.0",
|
|
30
30
|
"graphql": "16.14.2",
|
|
31
31
|
"jsonwebtoken": "9.0.3",
|
|
32
32
|
"lodash": "4.18.1",
|
|
33
|
-
"mobx": "7.0.
|
|
34
|
-
"mobx-react-lite": "5.0.
|
|
33
|
+
"mobx": "7.0.3",
|
|
34
|
+
"mobx-react-lite": "5.0.3",
|
|
35
35
|
"react": "18.3.1",
|
|
36
36
|
"zod": "4.4.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/react": "18.3.31",
|
|
40
|
-
"@webiny/build-tools": "0.0.0-unstable.
|
|
41
|
-
"@webiny/
|
|
42
|
-
"
|
|
43
|
-
"vitest": "4.1.10"
|
|
40
|
+
"@webiny/build-tools": "0.0.0-unstable.5387e5f7c8",
|
|
41
|
+
"@webiny/wcp": "0.0.0-unstable.5387e5f7c8",
|
|
42
|
+
"vitest": "4.1.11"
|
|
44
43
|
},
|
|
45
44
|
"publishConfig": {
|
|
46
45
|
"access": "public"
|