-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(ssr): remove mentioning of internal packages #8282
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,7 @@ import { | |
} from 'aws-amplify/auth'; | ||
import { list } from 'aws-amplify/storage'; | ||
import { generateClient } from 'aws-amplify/api'; | ||
import outputs from '../amplify_outputs.json'; | ||
import config from '../amplify_outputs.json'; | ||
|
||
const client = generateClient<Schema>(); | ||
|
||
|
@@ -122,17 +122,14 @@ Example implementation: | |
import type { CookieRef } from 'nuxt/app'; | ||
import type { Schema } from '~/amplify/data/resource'; | ||
import type { ListPaginateWithPathInput } from 'aws-amplify/storage'; | ||
import type { | ||
LibraryOptions, | ||
FetchAuthSessionOptions | ||
} from '@aws-amplify/core'; | ||
import { | ||
createKeyValueStorageFromCookieStorageAdapter, | ||
createUserPoolsTokenProvider, | ||
createAWSCredentialsAndIdentityIdProvider, | ||
runWithAmplifyServerContext | ||
} from 'aws-amplify/adapter-core'; | ||
import { parseAmplifyConfig } from 'aws-amplify/utils'; | ||
import type { FetchAuthSessionOptions } from 'aws-amplify/auth'; | ||
import { | ||
fetchAuthSession, | ||
fetchUserAttributes, | ||
|
@@ -141,10 +138,10 @@ import { | |
import { list } from 'aws-amplify/storage/server'; | ||
import { generateClient } from 'aws-amplify/api/server'; | ||
|
||
import outputs from '../amplify_outputs.json'; | ||
import config from '../amplify_outputs.json'; | ||
AllanZhengYP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// parse the content of `amplify_outputs.json` into the shape of ResourceConfig | ||
const amplifyConfig = parseAmplifyConfig(outputs); | ||
const amplifyConfig = parseAmplifyConfig(config); | ||
|
||
// create the Amplify used token cookies names array | ||
const userPoolClientId = amplifyConfig.Auth!.Cognito.userPoolClientId; | ||
|
@@ -273,7 +270,7 @@ export default defineNuxtPlugin({ | |
); | ||
|
||
// Create the libraryOptions object | ||
const libraryOptions: LibraryOptions = { | ||
const libraryOptions = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this type available from the main package? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @josefaidt This type is not available in the main package. In this example it's not necessary, since |
||
Auth: { | ||
tokenProvider, | ||
credentialsProvider | ||
|
@@ -423,7 +420,7 @@ Example implementation: | |
|
||
```ts title="plugins/02.authRedirect.ts" | ||
import { Amplify } from 'aws-amplify'; | ||
import outputs from '~/amplify_outputs.json'; | ||
import config from '~/amplify_outputs.json'; | ||
|
||
// Amplify.configure() only needs to be called on the client side | ||
if (process.client) { | ||
|
@@ -494,8 +491,7 @@ import { | |
} from 'aws-amplify/adapter-core'; | ||
import { parseAmplifyConfig } from 'aws-amplify/utils'; | ||
|
||
import type { LibraryOptions } from '@aws-amplify/core'; | ||
import outputs from '~/amplify_outputs.json'; | ||
import config from '~/amplify_outputs.json'; | ||
|
||
const amplifyConfig = parseAmplifyConfig(config); | ||
|
||
|
@@ -527,7 +523,7 @@ const createCookieStorageAdapter = ( | |
|
||
const createLibraryOptions = ( | ||
event: H3Event<EventHandlerRequest> | ||
): LibraryOptions => { | ||
) => { | ||
const cookieStorage = createCookieStorageAdapter(event); | ||
const keyValueStorage = | ||
createKeyValueStorageFromCookieStorageAdapter(cookieStorage); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, can we move this type import above the value imports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josefaidt sorted & grouped all the imports.