diff --git a/.changeset/good-readers-drum.md b/.changeset/good-readers-drum.md new file mode 100644 index 0000000000..320868c221 --- /dev/null +++ b/.changeset/good-readers-drum.md @@ -0,0 +1,5 @@ +--- +'@aws-amplify/backend-output-schemas': patch +--- + +re-export construct output objects in root package namespace diff --git a/packages/backend-output-schemas/API.md b/packages/backend-output-schemas/API.md index 79c7a014e8..731a5a93ca 100644 --- a/packages/backend-output-schemas/API.md +++ b/packages/backend-output-schemas/API.md @@ -6,9 +6,18 @@ import { z } from 'zod'; +// @public (undocumented) +export type AuthOutput = z.infer; + // @public export const authOutputKey = "AWS::Amplify::Auth"; +// @public (undocumented) +export type AwsAppsyncAuthenticationType = z.infer; + +// @public (undocumented) +export const AwsAppsyncAuthenticationZodEnum: z.ZodEnum<["API_KEY", "AWS_LAMBDA", "AWS_IAM", "OPENID_CONNECT", "AMAZON_COGNITO_USER_POOLS"]>; + // @public export type BackendOutputEntryStackMetadata = z.infer; @@ -39,9 +48,15 @@ export const backendOutputStackMetadataSchema: z.ZodRecord>; +// @public (undocumented) +export type GraphqlOutput = z.infer; + // @public export const graphqlOutputKey = "AWS::Amplify::GraphQL"; +// @public (undocumented) +export type StorageOutput = z.infer; + // @public export const storageOutputKey = "AWS::Amplify::Storage"; @@ -241,6 +256,137 @@ export const unifiedBackendOutputSchema: z.ZodObject<{ } | undefined; }>; +// @public (undocumented) +export const versionedAuthOutputSchema: z.ZodDiscriminatedUnion<"version", [z.ZodObject<{ + version: z.ZodLiteral<"1">; + payload: z.ZodObject<{ + userPoolId: z.ZodString; + webClientId: z.ZodString; + identityPoolId: z.ZodString; + amazonClientId: z.ZodOptional; + appleClientId: z.ZodOptional; + facebookClientId: z.ZodOptional; + googleClientId: z.ZodOptional; + authRegion: z.ZodString; + }, "strip", z.ZodTypeAny, { + userPoolId: string; + webClientId: string; + identityPoolId: string; + authRegion: string; + amazonClientId?: string | undefined; + appleClientId?: string | undefined; + facebookClientId?: string | undefined; + googleClientId?: string | undefined; + }, { + userPoolId: string; + webClientId: string; + identityPoolId: string; + authRegion: string; + amazonClientId?: string | undefined; + appleClientId?: string | undefined; + facebookClientId?: string | undefined; + googleClientId?: string | undefined; + }>; +}, "strip", z.ZodTypeAny, { + version: "1"; + payload: { + userPoolId: string; + webClientId: string; + identityPoolId: string; + authRegion: string; + amazonClientId?: string | undefined; + appleClientId?: string | undefined; + facebookClientId?: string | undefined; + googleClientId?: string | undefined; + }; +}, { + version: "1"; + payload: { + userPoolId: string; + webClientId: string; + identityPoolId: string; + authRegion: string; + amazonClientId?: string | undefined; + appleClientId?: string | undefined; + facebookClientId?: string | undefined; + googleClientId?: string | undefined; + }; +}>]>; + +// @public (undocumented) +export const versionedGraphqlOutputSchema: z.ZodDiscriminatedUnion<"version", [z.ZodObject<{ + version: z.ZodLiteral<"1">; + payload: z.ZodObject<{ + awsAppsyncRegion: z.ZodString; + awsAppsyncApiEndpoint: z.ZodString; + awsAppsyncAuthenticationType: z.ZodEnum<["API_KEY", "AWS_LAMBDA", "AWS_IAM", "OPENID_CONNECT", "AMAZON_COGNITO_USER_POOLS"]>; + awsAppsyncApiKey: z.ZodOptional; + awsAppsyncApiId: z.ZodString; + amplifyApiModelSchemaS3Uri: z.ZodString; + }, "strip", z.ZodTypeAny, { + awsAppsyncRegion: string; + awsAppsyncApiEndpoint: string; + awsAppsyncAuthenticationType: "API_KEY" | "AWS_LAMBDA" | "AWS_IAM" | "OPENID_CONNECT" | "AMAZON_COGNITO_USER_POOLS"; + awsAppsyncApiId: string; + amplifyApiModelSchemaS3Uri: string; + awsAppsyncApiKey?: string | undefined; + }, { + awsAppsyncRegion: string; + awsAppsyncApiEndpoint: string; + awsAppsyncAuthenticationType: "API_KEY" | "AWS_LAMBDA" | "AWS_IAM" | "OPENID_CONNECT" | "AMAZON_COGNITO_USER_POOLS"; + awsAppsyncApiId: string; + amplifyApiModelSchemaS3Uri: string; + awsAppsyncApiKey?: string | undefined; + }>; +}, "strip", z.ZodTypeAny, { + version: "1"; + payload: { + awsAppsyncRegion: string; + awsAppsyncApiEndpoint: string; + awsAppsyncAuthenticationType: "API_KEY" | "AWS_LAMBDA" | "AWS_IAM" | "OPENID_CONNECT" | "AMAZON_COGNITO_USER_POOLS"; + awsAppsyncApiId: string; + amplifyApiModelSchemaS3Uri: string; + awsAppsyncApiKey?: string | undefined; + }; +}, { + version: "1"; + payload: { + awsAppsyncRegion: string; + awsAppsyncApiEndpoint: string; + awsAppsyncAuthenticationType: "API_KEY" | "AWS_LAMBDA" | "AWS_IAM" | "OPENID_CONNECT" | "AMAZON_COGNITO_USER_POOLS"; + awsAppsyncApiId: string; + amplifyApiModelSchemaS3Uri: string; + awsAppsyncApiKey?: string | undefined; + }; +}>]>; + +// @public (undocumented) +export const versionedStorageOutputSchema: z.ZodDiscriminatedUnion<"version", [z.ZodObject<{ + version: z.ZodLiteral<"1">; + payload: z.ZodObject<{ + bucketName: z.ZodString; + storageRegion: z.ZodString; + }, "strip", z.ZodTypeAny, { + bucketName: string; + storageRegion: string; + }, { + bucketName: string; + storageRegion: string; + }>; +}, "strip", z.ZodTypeAny, { + version: "1"; + payload: { + bucketName: string; + storageRegion: string; + }; +}, { + version: "1"; + payload: { + bucketName: string; + storageRegion: string; + }; +}>]>; + // (No @packageDocumentation comment for this package) ``` diff --git a/packages/backend-output-schemas/src/graphql/index.ts b/packages/backend-output-schemas/src/graphql/index.ts index 1abdc59732..c33fb6de39 100644 --- a/packages/backend-output-schemas/src/graphql/index.ts +++ b/packages/backend-output-schemas/src/graphql/index.ts @@ -1,6 +1,10 @@ import { z } from 'zod'; import { graphqlOutputSchema as graphqlOutputSchemaV1 } from './v1.js'; -export type { AwsAppsyncAuthenticationType } from './v1.js'; + +export { + AwsAppsyncAuthenticationType, + AwsAppsyncAuthenticationZodEnum, +} from './v1.js'; export const versionedGraphqlOutputSchema = z.discriminatedUnion('version', [ graphqlOutputSchemaV1, diff --git a/packages/backend-output-schemas/src/graphql/v1.ts b/packages/backend-output-schemas/src/graphql/v1.ts index 18f9b484f0..057d21b70e 100644 --- a/packages/backend-output-schemas/src/graphql/v1.ts +++ b/packages/backend-output-schemas/src/graphql/v1.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; -const AwsAppsyncAuthenticationZodEnum = z.enum([ +export const AwsAppsyncAuthenticationZodEnum = z.enum([ 'API_KEY', 'AWS_LAMBDA', 'AWS_IAM', diff --git a/packages/backend-output-schemas/src/index.ts b/packages/backend-output-schemas/src/index.ts index 9dfabee6f6..51d13dbe96 100644 --- a/packages/backend-output-schemas/src/index.ts +++ b/packages/backend-output-schemas/src/index.ts @@ -3,18 +3,58 @@ import { versionedAuthOutputSchema } from './auth/index.js'; import { versionedGraphqlOutputSchema } from './graphql/index.js'; import { versionedStorageOutputSchema } from './storage/index.js'; +/** + * The auth, graphql and storage exports here are duplicated from the submodule exports in the package.json file + * This is because these types need to be consumed in CDK Constructs that may be JSII classes. JSII only supports + * CommonJS modules which can't interpret submodule exports + */ + +/** + * ---------- Auth exports ---------- + */ + +/** + * re-export the auth output schema + */ +export * from './auth/index.js'; + /** * Expected key that auth output is stored under */ export const authOutputKey = 'AWS::Amplify::Auth'; + +/** + * ---------- GraphQL exports ---------- + */ + +/** + * re-export the graphql output schema + */ +export * from './graphql/index.js'; + /** * Expected key that graphql output is stored under */ export const graphqlOutputKey = 'AWS::Amplify::GraphQL'; + +/** + * ---------- Storage exports ---------- + */ + +/** + * re-export the storage output schema + */ +export * from './storage/index.js'; + /** * Expected key that storage output is stored under */ export const storageOutputKey = 'AWS::Amplify::Storage'; + +/** + * ---------- Unified exports ---------- + */ + /** * Defines the unified expected shape of Amplify backend output. * As new constructs are added that need to contribute backend output, entries should be added here so that client config generation is aware of these outputs