Skip to content

Commit 0580740

Browse files
ashwinkumar6Ashwin Kumar
and
Ashwin Kumar
authored
fix(core): add Partial back to AmplifyOutputs groups and paths (#14265)
* fix(core): add Partial back to AmplifyOutputs groups and paths * Revert "test(core): catch type issues when configuring from external json (#14101)" This reverts commit 7b97855. * set AmplifyOutputsAuthProperties authentication_flow_type to string --------- Co-authored-by: Ashwin Kumar <[email protected]>
1 parent 5dbfbf3 commit 0580740

File tree

4 files changed

+2
-222
lines changed

4 files changed

+2
-222
lines changed

jest.config.js

-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ module.exports = {
1515
noImplicitAny: false,
1616
types: ['jest', 'jsdom'],
1717
},
18-
diagnostics: {
19-
warnOnly: false,
20-
},
2118
},
2219
],
2320
},

packages/core/__tests__/singleton/Singleton.test.ts

-19
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ import { AuthClass as Auth } from '../../src/singleton/Auth';
66
import { decodeJWT } from '../../src/singleton/Auth/utils';
77
import { CredentialsAndIdentityId } from '../../src/singleton/Auth/types';
88
import { ResourcesConfig, fetchAuthSession } from '../../src';
9-
import { AmplifyOutputs } from '../../src/libraryUtils';
10-
11-
import mockAmplifyOutputs from './utils/amplify_outputs.json';
129

1310
Object.assign(global, { TextDecoder, TextEncoder });
1411

@@ -167,22 +164,6 @@ describe('Amplify.configure() and Amplify.getConfig()', () => {
167164
expect(result).toEqual(expectedResourceConfig);
168165
});
169166

170-
it(`should successfully configure from a 'amplify_outputs.json' file`, () => {
171-
type DeepRequired<T> = T extends object
172-
? { [K in keyof T]-?: DeepRequired<NonNullable<T[K]>> }
173-
: T;
174-
175-
const recreateObjectWithDeepRequired = <T>(obj: T): DeepRequired<T> =>
176-
obj as DeepRequired<T>;
177-
178-
// Ensures that all optional properties in mockAmplifyOutputs are defined
179-
const _amplifyOutputs: DeepRequired<AmplifyOutputs> =
180-
recreateObjectWithDeepRequired(mockAmplifyOutputs);
181-
182-
// Configures Amplify with mockAmplifyOutputs, relying on its inferred type
183-
Amplify.configure(mockAmplifyOutputs);
184-
});
185-
186167
it('dispatches hub event with parsed ResourceConfig from the legacy config', () => {
187168
Amplify.configure(mockLegacyConfig);
188169

packages/core/__tests__/singleton/utils/amplify_outputs.json

-198
This file was deleted.

packages/core/src/singleton/AmplifyOutputs/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export interface AmplifyOutputsAuthProperties {
4242
unauthenticated_identities_enabled?: boolean;
4343
mfa_configuration?: string;
4444
mfa_methods?: string[];
45-
groups?: Record<UserGroupName, UserGroupPrecedence>[];
45+
groups?: Partial<Record<UserGroupName, UserGroupPrecedence>>[];
4646
}
4747

4848
export interface AmplifyOutputsStorageBucketProperties {
@@ -53,7 +53,7 @@ export interface AmplifyOutputsStorageBucketProperties {
5353
/** Region for the bucket */
5454
aws_region: string;
5555
/** Paths to object with access permissions */
56-
paths?: Record<string, Record<string, string[] | undefined>>;
56+
paths?: Partial<Record<string, Record<string, string[] | undefined>>>;
5757
}
5858
export interface AmplifyOutputsStorageProperties {
5959
/** Default region for Storage */

0 commit comments

Comments
 (0)