Skip to content

Commit bded861

Browse files
authored
release(required): Amplify JS release (#14262)
2 parents 94281bb + 0580740 commit bded861

File tree

13 files changed

+48
-240
lines changed

13 files changed

+48
-240
lines changed

jest.config.js

Lines changed: 0 additions & 3 deletions
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/adapter-nextjs/src/types/NextServer.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
import { GetServerSidePropsContext as NextGetServerSidePropsContext } from 'next';
55
import { NextRequest, NextResponse } from 'next/server.js';
66
import { cookies } from 'next/headers.js';
7-
import { AmplifyOutputs, LegacyConfig } from 'aws-amplify/adapter-core';
87
import {
8+
AmplifyOutputsUnknown,
99
AmplifyServer,
1010
CookieStorage,
11+
LegacyConfig,
1112
} from 'aws-amplify/adapter-core/internals';
1213
import { ResourcesConfig } from 'aws-amplify';
1314

@@ -86,7 +87,7 @@ export declare namespace NextServer {
8687
}
8788

8889
export interface CreateServerRunnerInput {
89-
config: ResourcesConfig | LegacyConfig | AmplifyOutputs;
90+
config: ResourcesConfig | LegacyConfig | AmplifyOutputsUnknown;
9091
runtimeOptions?: CreateServerRunnerRuntimeOptions;
9192
}
9293

packages/aws-amplify/src/adapter-core/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export {
88
createUserPoolsTokenProvider,
99
} from './authProvidersFactories/cognito';
1010
export {
11+
/** @deprecated This type is deprecated and will be removed in future versions. */
1112
LegacyConfig,
13+
/** @deprecated This type is deprecated and will be removed in future versions. */
1214
AmplifyOutputs,
1315
} from '@aws-amplify/core/internals/utils';
1416
export {

packages/aws-amplify/src/adapter-core/internals.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ export {
1414
assertTokenProviderConfig,
1515
urlSafeEncode,
1616
decodeJWT,
17+
LegacyConfig,
18+
AmplifyOutputsUnknown,
1719
} from '@aws-amplify/core/internals/utils';

packages/aws-amplify/src/initSingleton.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
defaultStorage,
99
} from '@aws-amplify/core';
1010
import {
11-
AmplifyOutputs,
11+
AmplifyOutputsUnknown,
1212
LegacyConfig,
1313
parseAmplifyConfig,
1414
} from '@aws-amplify/core/internals/utils';
@@ -32,7 +32,7 @@ export const DefaultAmplify = {
3232
* Amplify.configure(config);
3333
*/
3434
configure(
35-
resourceConfig: ResourcesConfig | LegacyConfig | AmplifyOutputs,
35+
resourceConfig: ResourcesConfig | LegacyConfig | AmplifyOutputsUnknown,
3636
libraryOptions?: LibraryOptions,
3737
): void {
3838
const resolvedResourceConfig = parseAmplifyConfig(resourceConfig);

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

Lines changed: 0 additions & 19 deletions
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

Lines changed: 0 additions & 198 deletions
This file was deleted.

packages/core/src/libraryUtils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ export {
2424
export { parseAWSExports } from './parseAWSExports';
2525
export { isAmplifyOutputs, parseAmplifyOutputs } from './parseAmplifyOutputs';
2626
export { LegacyConfig } from './singleton/types';
27-
export { AmplifyOutputs } from './singleton/AmplifyOutputs/types';
27+
export {
28+
AmplifyOutputs,
29+
AmplifyOutputsUnknown,
30+
} from './singleton/AmplifyOutputs/types';
2831
export { ADD_OAUTH_LISTENER } from './singleton/constants';
2932
export { amplifyUuid } from './utils/amplifyUuid';
3033
export { AmplifyUrl, AmplifyUrlSearchParams } from './utils/amplifyUrl';

packages/core/src/parseAmplifyOutputs.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
} from './singleton/Auth/types';
2020
import { NotificationsConfig } from './singleton/Notifications/types';
2121
import {
22-
AmplifyOutputs,
2322
AmplifyOutputsAnalyticsProperties,
2423
AmplifyOutputsAuthProperties,
2524
AmplifyOutputsCustomProperties,
@@ -28,6 +27,7 @@ import {
2827
AmplifyOutputsNotificationsProperties,
2928
AmplifyOutputsStorageBucketProperties,
3029
AmplifyOutputsStorageProperties,
30+
AmplifyOutputsUnknown,
3131
} from './singleton/AmplifyOutputs/types';
3232
import {
3333
AnalyticsConfig,
@@ -40,10 +40,10 @@ import {
4040
} from './singleton/types';
4141

4242
export function isAmplifyOutputs(
43-
config: ResourcesConfig | LegacyConfig | AmplifyOutputs,
44-
): config is AmplifyOutputs {
43+
config: ResourcesConfig | LegacyConfig | AmplifyOutputsUnknown,
44+
): config is AmplifyOutputsUnknown {
4545
// version format initially will be '1' but is expected to be something like x.y where x is major and y minor version
46-
const { version } = config as AmplifyOutputs;
46+
const { version } = config as AmplifyOutputsUnknown;
4747

4848
if (!version) {
4949
return false;
@@ -291,28 +291,36 @@ function parseNotifications(
291291
}
292292

293293
export function parseAmplifyOutputs(
294-
amplifyOutputs: AmplifyOutputs,
294+
amplifyOutputs: AmplifyOutputsUnknown,
295295
): ResourcesConfig {
296296
const resourcesConfig: ResourcesConfig = {};
297297

298298
if (amplifyOutputs.storage) {
299-
resourcesConfig.Storage = parseStorage(amplifyOutputs.storage);
299+
resourcesConfig.Storage = parseStorage(
300+
amplifyOutputs.storage as AmplifyOutputsStorageProperties,
301+
);
300302
}
301303

302304
if (amplifyOutputs.auth) {
303-
resourcesConfig.Auth = parseAuth(amplifyOutputs.auth);
305+
resourcesConfig.Auth = parseAuth(
306+
amplifyOutputs.auth as AmplifyOutputsAuthProperties,
307+
);
304308
}
305309

306310
if (amplifyOutputs.analytics) {
307311
resourcesConfig.Analytics = parseAnalytics(amplifyOutputs.analytics);
308312
}
309313

310314
if (amplifyOutputs.geo) {
311-
resourcesConfig.Geo = parseGeo(amplifyOutputs.geo);
315+
resourcesConfig.Geo = parseGeo(
316+
amplifyOutputs.geo as AmplifyOutputsGeoProperties,
317+
);
312318
}
313319

314320
if (amplifyOutputs.data) {
315-
resourcesConfig.API = parseData(amplifyOutputs.data);
321+
resourcesConfig.API = parseData(
322+
amplifyOutputs.data as AmplifyOutputsDataProperties,
323+
);
316324
}
317325

318326
if (amplifyOutputs.custom) {
@@ -325,7 +333,7 @@ export function parseAmplifyOutputs(
325333

326334
if (amplifyOutputs.notifications) {
327335
resourcesConfig.Notifications = parseNotifications(
328-
amplifyOutputs.notifications,
336+
amplifyOutputs.notifications as AmplifyOutputsNotificationsProperties,
329337
);
330338
}
331339

0 commit comments

Comments
 (0)