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

chore: Upgrade Prettier #12582

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/callable-canary-e2e-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ jobs:
sample_name: ${{ toJSON(matrix.canary-config.sample_name) || '[""]' }}
browser: ${{ toJSON(matrix.canary-config.browser) || '[""]' }}
timeout_minutes: ${{ matrix.canary-config.timeout_minutes || 35 }}
retry_count: ${{ matrix.canary-config.retry_count || 3 }}
retry_count: ${{ matrix.canary-config.retry_count || 3 }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"json-loader": "^0.5.7",
"lerna": "^6.6.1",
"license-check-and-add": "^4.0.5",
"prettier": "^2.4.1",
"prettier": "^3.1.0",
"pretty-quick": "^1.11.1",
"rimraf": "^2.6.2",
"rollup": "^0.67.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('createCookieStorageAdapterFromNextServerContext', () => {
({
get: mockGetFunc,
getAll: mockGetAllFunc,
} as any)
}) as any
);

jest.spyOn(response, 'cookies', 'get').mockImplementation(() => ({
Expand Down Expand Up @@ -124,13 +124,13 @@ describe('createCookieStorageAdapterFromNextServerContext', () => {
({
get: mockGetFunc,
getAll: mockGetAllFunc,
} as any)
}) as any
);
jest.spyOn(response, 'headers', 'get').mockImplementation(
() =>
({
append: mockAppend,
} as any)
}) as any
);

const mockContext = {
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter-nextjs/src/api/generateServerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type ReqClientParams = {
* const result = await client.graphql({ query: listPosts });
*/
export function generateServerClientUsingCookies<
T extends Record<any, any> = never
T extends Record<any, any> = never,
>({
config,
cookies,
Expand Down Expand Up @@ -99,7 +99,7 @@ export function generateServerClientUsingCookies<
* });
*/
export function generateServerClientUsingReqRes<
T extends Record<any, any> = never
T extends Record<any, any> = never,
>({ config, authMode, authToken }: ReqClientParams): V6ClientSSRRequest<T> {
const amplifyConfig = getAmplifyConfig(config);
// passing `null` instance because each (future model) method must retrieve a valid instance
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/src/types/inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
* Input type for `identifyUser`.
*/
export type AnalyticsIdentifyUserInput<
ServiceOptions extends AnalyticsServiceOptions = AnalyticsServiceOptions
ServiceOptions extends AnalyticsServiceOptions = AnalyticsServiceOptions,
> = {
/**
* A User ID associated to the current device.
Expand Down
11 changes: 7 additions & 4 deletions packages/analytics/src/utils/groupBy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ export const groupBy = <T>(
getGroupId: (x: T) => string,
list: T[]
): Record<string, T[]> => {
return list.reduce((result, current) => {
const groupId = getGroupId(current);
return { ...result, [groupId]: [...(result[groupId] ?? []), current] };
}, {} as Record<string, T[]>);
return list.reduce(
(result, current) => {
const groupId = getGroupId(current);
return { ...result, [groupId]: [...(result[groupId] ?? []), current] };
},
{} as Record<string, T[]>
);
};
14 changes: 7 additions & 7 deletions packages/analytics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"importHelpers": true,
"strict": true,
"noImplicitAny": true
},
"include": ["./src"],
"extends": "../tsconfig.base.json",
"compilerOptions": {
"importHelpers": true,
"strict": true,
"noImplicitAny": true
},
"include": ["./src"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function generateClient<
T extends Record<any, any> = never,
ClientType extends
| V6ClientSSRRequest<T>
| V6ClientSSRCookies<T> = V6ClientSSRCookies<T>
| V6ClientSSRCookies<T> = V6ClientSSRCookies<T>,
>(
params: ServerClientGenerationParams & CommonPublicClientOptions
): ClientType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function generateModelsProperty<
| V6ClientSSRRequest<Record<string, any>>
| V6ClientSSRCookies<Record<string, any>> = V6ClientSSRCookies<
Record<string, any>
>
>,
>(client: ClientType, params: ServerClientGenerationParams): ClientType {
const models = {} as any;
const config = params.config;
Expand Down
2 changes: 1 addition & 1 deletion packages/api-graphql/src/internals/v6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ import { CustomHeaders } from '@aws-amplify/data-schema-types';
*/
export function graphql<
FALLBACK_TYPES = unknown,
TYPED_GQL_STRING extends string = string
TYPED_GQL_STRING extends string = string,
>(
this: V6Client,
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
Expand Down
53 changes: 28 additions & 25 deletions packages/api-graphql/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ type PagedList<T, TYPENAME> = {
type WithListsFixed<T> = T extends PagedList<infer IT, infer NAME>
? PagedList<Exclude<IT, null | undefined>, NAME>
: T extends {}
? {
[K in keyof T]: WithListsFixed<T[K]>;
}
: T;
? {
[K in keyof T]: WithListsFixed<T[K]>;
}
: T;

/**
* Returns an updated response type to always return a value.
Expand Down Expand Up @@ -205,7 +205,7 @@ export type GraphQLOperation = Source | string;
*/
export interface GraphQLOptionsV6<
FALLBACK_TYPES = unknown,
TYPED_GQL_STRING extends string = string
TYPED_GQL_STRING extends string = string,
> {
query: TYPED_GQL_STRING | DocumentNode;
variables?: GraphQLVariablesV6<FALLBACK_TYPES, TYPED_GQL_STRING>;
Expand Down Expand Up @@ -234,37 +234,40 @@ export type UnknownGraphQLResponse =
*/
export type GraphQLVariablesV6<
FALLBACK_TYPES = unknown,
TYPED_GQL_STRING extends string = string
TYPED_GQL_STRING extends string = string,
> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, any>
? IN
: TYPED_GQL_STRING extends GeneratedMutation<infer IN, any>
? IN
: TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any>
? IN
: FALLBACK_TYPES extends GraphQLOperationType<infer IN, any>
? IN
: any;
? IN
: TYPED_GQL_STRING extends GeneratedSubscription<infer IN, any>
? IN
: FALLBACK_TYPES extends GraphQLOperationType<infer IN, any>
? IN
: any;

/**
* The expected return type with respect to the given `FALLBACK_TYPE`
* and `TYPED_GQL_STRING`.
*/
export type GraphQLResponseV6<
FALLBACK_TYPE = unknown,
TYPED_GQL_STRING extends string = string
TYPED_GQL_STRING extends string = string,
> = TYPED_GQL_STRING extends GeneratedQuery<infer IN, infer QUERY_OUT>
? Promise<GraphQLResult<FixedQueryResult<QUERY_OUT>>>
: TYPED_GQL_STRING extends GeneratedMutation<infer IN, infer MUTATION_OUT>
? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>>
: TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT>
? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>>
: FALLBACK_TYPE extends GraphQLQuery<infer T>
? Promise<GraphQLResult<FALLBACK_TYPE>>
: FALLBACK_TYPE extends GraphQLSubscription<infer T>
? GraphqlSubscriptionResult<FALLBACK_TYPE>
: FALLBACK_TYPE extends GraphQLOperationType<infer IN, infer CUSTOM_OUT>
? CUSTOM_OUT
: UnknownGraphQLResponse;
? Promise<GraphQLResult<NeverEmpty<MUTATION_OUT>>>
: TYPED_GQL_STRING extends GeneratedSubscription<infer IN, infer SUB_OUT>
? GraphqlSubscriptionResult<NeverEmpty<SUB_OUT>>
: FALLBACK_TYPE extends GraphQLQuery<infer T>
? Promise<GraphQLResult<FALLBACK_TYPE>>
: FALLBACK_TYPE extends GraphQLSubscription<infer T>
? GraphqlSubscriptionResult<FALLBACK_TYPE>
: FALLBACK_TYPE extends GraphQLOperationType<
infer IN,
infer CUSTOM_OUT
>
? CUSTOM_OUT
: UnknownGraphQLResponse;

/**
* The shape customers can use to provide `T` to `graphql<T>()` to specify both
Expand Down Expand Up @@ -407,15 +410,15 @@ export type V6ClientSSRCookies<T extends Record<any, any> = never> =

export type GraphQLMethod = <
FALLBACK_TYPES = unknown,
TYPED_GQL_STRING extends string = string
TYPED_GQL_STRING extends string = string,
>(
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
additionalHeaders?: CustomHeaders | undefined
) => GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>;

export type GraphQLMethodSSR = <
FALLBACK_TYPES = unknown,
TYPED_GQL_STRING extends string = string
TYPED_GQL_STRING extends string = string,
>(
contextSpec: AmplifyServer.ContextSpec,
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
Expand Down
10 changes: 5 additions & 5 deletions packages/api/src/internals/InternalAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ export class InternalAPIClass {
): T extends GraphQLQuery<T>
? Promise<GraphQLResult<T>>
: T extends GraphQLSubscription<T>
? Observable<{
provider: AWSAppSyncRealTimeProvider;
value: GraphQLResult<T>;
}>
: Promise<GraphQLResult<any>> | Observable<object>;
? Observable<{
provider: AWSAppSyncRealTimeProvider;
value: GraphQLResult<T>;
}>
: Promise<GraphQLResult<any>> | Observable<object>;
graphql<T = any>(
options: GraphQLOptions,
additionalHeaders?: CustomHeaders,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ describe('signIn API happy path cases', () => {
.spyOn(initiateAuthHelpers, 'handleUserPasswordAuthFlow')
.mockImplementation(
async (): Promise<RespondToAuthChallengeCommandOutput> => {
const deviceKeys = await tokenOrchestrator.getDeviceMetadata(
lastAuthUser
);
const deviceKeys =
await tokenOrchestrator.getDeviceMetadata(lastAuthUser);
if (deviceKeys) {
throw new AuthError({
name: 'ResourceNotFoundException',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,3 @@ export function buildMockErrorResponse(errorName: string): {
},
};
}

2 changes: 1 addition & 1 deletion packages/auth/__tests__/utils/openAuthSession.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('openAuthSession', () => {
// create mocks

beforeAll(() => {
windowSpy.mockImplementation(() => ({ location } as any));
windowSpy.mockImplementation(() => ({ location }) as any);
});

beforeEach(() => {
Expand Down
6 changes: 3 additions & 3 deletions packages/auth/jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (
const crypto = require('crypto');

Object.defineProperty(globalThis, 'crypto', {
value: {
getRandomValues: arr => crypto.randomBytes(arr.length)
}
value: {
getRandomValues: arr => crypto.randomBytes(arr.length),
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export const fetchUserAttributes = async (
assertAuthTokens(tokens);

const { UserAttributes } = await getUser(
{
region: getRegion(authConfig.userPoolId),
userAgentValue: getAuthUserAgentValue(AuthAction.FetchUserAttributes)
{
region: getRegion(authConfig.userPoolId),
userAgentValue: getAuthUserAgentValue(AuthAction.FetchUserAttributes),
},
{
AccessToken: tokens.accessToken.toString(),
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/src/providers/cognito/types/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,5 @@ export interface AuthUser extends AWSAuthUser {
* Holds data describing the dispatch of a confirmation code.
*/
export type CodeDeliveryDetails<
CognitoUserAttributeKey extends UserAttributeKey = UserAttributeKey
CognitoUserAttributeKey extends UserAttributeKey = UserAttributeKey,
> = AuthCodeDeliveryDetails<CognitoUserAttributeKey>;
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ export async function getNewDeviceMetatada(
*
*/
export async function retryOnResourceNotFoundException<
F extends (...args: any[]) => any
F extends (...args: any[]) => any,
>(
func: F,
args: Parameters<F>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,8 @@ export class DefaultOAuthStore implements OAuthStore {
this.cognitoConfig.userPoolClientId
);

const isLegacyHostedUISignIn = await this.keyValueStorage.getItem(
V5_HOSTED_UI_KEY
);
const isLegacyHostedUISignIn =
await this.keyValueStorage.getItem(V5_HOSTED_UI_KEY);

const [isOAuthSignIn, preferPrivateSession] =
(await this.keyValueStorage.getItem(authKeys.oauthSignIn))?.split(',') ??
Expand Down
Loading
Loading