Skip to content

Commit

Permalink
fix(api): issue 12756 by exporting CONNECTION_STATE_CHANGE as a value (
Browse files Browse the repository at this point in the history
…#12757)

fix: issue 12756 by exporting CONNECTION_STATE_CHANGE as a value

rather than as a type

Co-authored-by: Ivan Artemiev <29709626+iartemiev@users.noreply.github.com>
  • Loading branch information
timheilman and iartemiev committed Jan 2, 2024
1 parent e13e180 commit bedbdbd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/api/__tests__/API.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ResourcesConfig } from 'aws-amplify';
import { InternalGraphQLAPIClass } from '@aws-amplify/api-graphql/internals';
import { generateClient } from '@aws-amplify/api';
import { generateClient, CONNECTION_STATE_CHANGE } from '@aws-amplify/api';
import { AmplifyClassV6 } from '@aws-amplify/core';
// import { runWithAmplifyServerContext } from 'aws-amplify/internals/adapter-core';

Expand Down Expand Up @@ -38,6 +38,9 @@ describe('API generateClient', () => {
);
});

test('CONNECTION_STATE_CHANGE importable as a value, not a type', async () => {
expect(CONNECTION_STATE_CHANGE).toBe('ConnectionStateChange');
})
// test('server-side client.graphql', async () => {
// const config: ResourcesConfig = {
// API: {
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ export { GraphQLAuthError, ConnectionState } from '@aws-amplify/api-graphql';
export type {
GraphQLResult,
GraphQLReturnType,
CONNECTION_STATE_CHANGE,
} from '@aws-amplify/api-graphql';

export { CONNECTION_STATE_CHANGE } from '@aws-amplify/api-graphql';

import type { V6Client } from '@aws-amplify/api-graphql';

// explicitly defaulting to `never` here resolves
Expand Down
1 change: 1 addition & 0 deletions packages/aws-amplify/__tests__/exports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('aws-amplify Exports', () => {
it('should only export expected symbols from the top level', () => {
expect(Object.keys(apiTopLevelExports).sort()).toEqual(
[
'CONNECTION_STATE_CHANGE',
'ConnectionState',
'GraphQLAuthError',
'del',
Expand Down

0 comments on commit bedbdbd

Please sign in to comment.