Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-add the V1 of client config version #1917

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/flat-rules-help.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@aws-amplify/client-config': minor
'@aws-amplify/backend': minor
---

re-add the V1 of client config version
40 changes: 20 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/backend/src/backend_factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const rootStackTypeIdentifier = 'root';

// Client config version that is used by `backend.addOutput()`
const DEFAULT_CLIENT_CONFIG_VERSION_FOR_BACKEND_ADD_OUTPUT =
ClientConfigVersionOption.V1;
ClientConfigVersionOption.V1_1;

/**
* Factory that collects and instantiates all the Amplify backend constructs
Expand Down
119 changes: 114 additions & 5 deletions packages/client-config/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,27 @@ import { S3Client } from '@aws-sdk/client-s3';
// @public
type AmazonCognitoStandardAttributes = 'address' | 'birthdate' | 'email' | 'family_name' | 'gender' | 'given_name' | 'locale' | 'middle_name' | 'name' | 'nickname' | 'phone_number' | 'picture' | 'preferred_username' | 'profile' | 'sub' | 'updated_at' | 'website' | 'zoneinfo';

// @public
type AmazonCognitoStandardAttributes_2 = 'address' | 'birthdate' | 'email' | 'family_name' | 'gender' | 'given_name' | 'locale' | 'middle_name' | 'name' | 'nickname' | 'phone_number' | 'picture' | 'preferred_username' | 'profile' | 'sub' | 'updated_at' | 'website' | 'zoneinfo';

// @public
interface AmazonLocationServiceConfig {
name?: string;
style?: string;
}

// @public
interface AmazonLocationServiceConfig_2 {
name?: string;
style?: string;
}

// @public
type AmazonPinpointChannels = 'IN_APP_MESSAGING' | 'FCM' | 'APNS' | 'EMAIL' | 'SMS';

// @public
type AmazonPinpointChannels_2 = 'IN_APP_MESSAGING' | 'FCM' | 'APNS' | 'EMAIL' | 'SMS';

// @public (undocumented)
interface AmplifyStorageBucket {
// (undocumented)
Expand Down Expand Up @@ -150,14 +162,97 @@ interface AWSAmplifyBackendOutputs {
version: '1.1';
}

// @public
interface AWSAmplifyBackendOutputs_2 {
analytics?: {
amazon_pinpoint?: {
aws_region: AwsRegion_2;
app_id: string;
};
};
auth?: {
aws_region: AwsRegion_2;
user_pool_id: string;
user_pool_client_id: string;
identity_pool_id?: string;
password_policy?: {
min_length: number;
require_numbers: boolean;
require_lowercase: boolean;
require_uppercase: boolean;
require_symbols: boolean;
};
oauth?: {
identity_providers: ('GOOGLE' | 'FACEBOOK' | 'LOGIN_WITH_AMAZON' | 'SIGN_IN_WITH_APPLE')[];
domain: string;
scopes: string[];
redirect_sign_in_uri: string[];
redirect_sign_out_uri: string[];
response_type: 'code' | 'token';
};
standard_required_attributes?: AmazonCognitoStandardAttributes_2[];
username_attributes?: ('email' | 'phone_number' | 'username')[];
user_verification_types?: ('email' | 'phone_number')[];
unauthenticated_identities_enabled?: boolean;
mfa_configuration?: 'NONE' | 'OPTIONAL' | 'REQUIRED';
mfa_methods?: ('SMS' | 'TOTP')[];
};
custom?: {
[k: string]: unknown;
};
data?: {
aws_region: AwsRegion_2;
url: string;
model_introspection?: {
[k: string]: unknown;
};
api_key?: string;
default_authorization_type: AwsAppsyncAuthorizationType_2;
authorization_types: AwsAppsyncAuthorizationType_2[];
};
geo?: {
aws_region: AwsRegion_2;
maps?: {
items: {
[k: string]: AmazonLocationServiceConfig_2;
};
default: string;
};
search_indices?: {
items: string[];
default: string;
};
geofence_collections?: {
items: string[];
default: string;
};
};
notifications?: {
aws_region: AwsRegion_2;
amazon_pinpoint_app_id: string;
channels: AmazonPinpointChannels_2[];
};
storage?: {
aws_region: AwsRegion_2;
bucket_name: string;
};
version: '1';
}

// @public
type AwsAppsyncAuthorizationType = 'AMAZON_COGNITO_USER_POOLS' | 'API_KEY' | 'AWS_IAM' | 'AWS_LAMBDA' | 'OPENID_CONNECT';

// @public
type AwsAppsyncAuthorizationType_2 = 'AMAZON_COGNITO_USER_POOLS' | 'API_KEY' | 'AWS_IAM' | 'AWS_LAMBDA' | 'OPENID_CONNECT';

// @public (undocumented)
type AwsRegion = string;

// @public (undocumented)
type AwsRegion_2 = string;

// @public
export type ClientConfig = clientConfigTypesV1.AWSAmplifyBackendOutputs;
export type ClientConfig = clientConfigTypesV1_1.AWSAmplifyBackendOutputs | clientConfigTypesV1.AWSAmplifyBackendOutputs;

// @public (undocumented)
export enum ClientConfigFileBaseName {
Expand Down Expand Up @@ -185,6 +280,18 @@ export enum ClientConfigFormat {
export type ClientConfigLegacy = Partial<AnalyticsClientConfig & AuthClientConfig & GeoClientConfig & GraphqlClientConfig & NotificationsClientConfig & StorageClientConfig & PlatformClientConfig & CustomClientConfig>;

declare namespace clientConfigTypesV1 {
export {
AmazonCognitoStandardAttributes_2 as AmazonCognitoStandardAttributes,
AwsRegion_2 as AwsRegion,
AwsAppsyncAuthorizationType_2 as AwsAppsyncAuthorizationType,
AmazonPinpointChannels_2 as AmazonPinpointChannels,
AWSAmplifyBackendOutputs_2 as AWSAmplifyBackendOutputs,
AmazonLocationServiceConfig_2 as AmazonLocationServiceConfig
}
}
export { clientConfigTypesV1 }

declare namespace clientConfigTypesV1_1 {
export {
AmazonCognitoStandardAttributes,
AwsRegion,
Expand All @@ -195,7 +302,7 @@ declare namespace clientConfigTypesV1 {
AmplifyStorageBucket
}
}
export { clientConfigTypesV1 }
export { clientConfigTypesV1_1 }

// @public (undocumented)
export type ClientConfigVersion = `${ClientConfigVersionOption}`;
Expand All @@ -205,11 +312,13 @@ export enum ClientConfigVersionOption {
// (undocumented)
V0 = "0",
// (undocumented)
V1 = "1.1"
V1 = "1",
// (undocumented)
V1_1 = "1.1"
}

// @public
export type ClientConfigVersionTemplateType<T> = T extends '1.1' ? clientConfigTypesV1.AWSAmplifyBackendOutputs : never;
export type ClientConfigVersionTemplateType<T> = T extends '1.1' ? clientConfigTypesV1_1.AWSAmplifyBackendOutputs : T extends '1' ? clientConfigTypesV1.AWSAmplifyBackendOutputs : never;

// @public (undocumented)
export type CustomClientConfig = {
Expand All @@ -220,7 +329,7 @@ export type CustomClientConfig = {
export const DEFAULT_CLIENT_CONFIG_VERSION: ClientConfigVersion;

// @public
export const generateClientConfig: <T extends "1.1" | "0">(backendIdentifier: DeployedBackendIdentifier, version: T, awsClientProvider?: AWSClientProvider<{
export const generateClientConfig: <T extends "1" | "1.1" | "0">(backendIdentifier: DeployedBackendIdentifier, version: T, awsClientProvider?: AWSClientProvider<{
getS3Client: S3Client;
getAmplifyClient: AmplifyClient;
getCloudFormationClient: CloudFormationClient;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Versions of config schemas supported by this package version
import {
AuthClientConfigContributor as Auth1,
CustomClientConfigContributor as Custom1,
DataClientConfigContributor as Data1,
StorageClientConfigContributor as Storage1,
VersionContributor as VersionContributor1,
AuthClientConfigContributor as Auth1_1,
CustomClientConfigContributor as Custom1_1,
DataClientConfigContributor as Data1_1,
StorageClientConfigContributorV1 as Storage1,
StorageClientConfigContributor as Storage1_1,
VersionContributor as VersionContributor1_1,
VersionContributorV1,
} from './client_config_contributor_v1.js';

import { ClientConfigContributor } from '../client-config-types/client_config_contributor.js';
Expand All @@ -29,21 +31,30 @@ export class ClientConfigContributorFactory {
private readonly modelIntrospectionSchemaAdapter: ModelIntrospectionSchemaAdapter
) {
this.versionedClientConfigContributors = {
[ClientConfigVersionOption.V1_1]: [
new Auth1_1(),
new Data1_1(this.modelIntrospectionSchemaAdapter),
new Storage1_1(),
new VersionContributor1_1(),
new Custom1_1(),
],

// Except for storage and version, other contributors are same as V1
[ClientConfigVersionOption.V1]: [
new Auth1(),
new Data1(this.modelIntrospectionSchemaAdapter),
new Auth1_1(),
new Data1_1(this.modelIntrospectionSchemaAdapter),
new Storage1(),
new VersionContributor1(),
new Custom1(),
new VersionContributorV1(),
new Custom1_1(),
],

// Legacy config is derived from V1 of unified default config
// Legacy config is derived from V1.1 (latest) of unified default config
[ClientConfigVersionOption.V0]: [
new Auth1(),
new Data1(this.modelIntrospectionSchemaAdapter),
new Storage1(),
new VersionContributor1(),
new Custom1(),
new Auth1_1(),
new Data1_1(this.modelIntrospectionSchemaAdapter),
new Storage1_1(),
new VersionContributor1_1(),
new Custom1_1(),
],
};
}
Expand Down
Loading