Skip to content

fix: update nuxt ssr example to replace internal types #8347

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ import type {
LibraryOptions,
FetchAuthSessionOptions,
} from "@aws-amplify/core";
import type {
GraphQLOptionsV6,
GraphQLResponseV6,
} from "@aws-amplify/api-graphql";

import outputs from "../amplify_outputs.json";

Expand Down Expand Up @@ -309,15 +305,12 @@ export default defineNuxtPlugin({
client: {
// Follow this typing to ensure the`graphql` API return type can
// be inferred correctly according to your queries and mutations
graphql: <
FALLBACK_TYPES = unknown,
TYPED_GQL_STRING extends string = string
>(
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
additionalHeaders?: Record<string, string>
graphql:(
options: Parameters<typeof gqlServerClient.graphql>[1],
additionalHeaders?: Record<string, string>
) =>
runWithAmplifyServerContext<
GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>
ReturnType<typeof gqlServerClient.graphql>
>(amplifyConfig, libraryOptions, (contextSpec) =>
gqlServerClient.graphql(
contextSpec,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ import type {
LibraryOptions,
FetchAuthSessionOptions
} from '@aws-amplify/core';
import type {
GraphQLOptionsV6,
GraphQLResponseV6
} from '@aws-amplify/api-graphql';

import config from '../amplifyconfiguration.json';

Expand Down Expand Up @@ -328,24 +324,21 @@ export default defineNuxtPlugin({
client: {
// Follow this typing to ensure the`graphql` API return type can
// be inferred correctly according to your queries and mutations
graphql: <
FALLBACK_TYPES = unknown,
TYPED_GQL_STRING extends string = string
>(
options: GraphQLOptionsV6<FALLBACK_TYPES, TYPED_GQL_STRING>,
additionalHeaders?: Record<string, string>
graphql:(
options: Parameters<typeof gqlServerClient.graphql>[1],
additionalHeaders?: Record<string, string>
) =>
runWithAmplifyServerContext<
GraphQLResponseV6<FALLBACK_TYPES, TYPED_GQL_STRING>
ReturnType<typeof gqlServerClient.graphql>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this still surface the model type being returned from this wrapper call?

>(amplifyConfig, libraryOptions, (contextSpec) =>
gqlServerClient.graphql(
contextSpec,
options,
additionalHeaders
)
)
}
}
),
},
},
}
}
};
Expand Down