import { AmplifyContext } from '../../context/AmplifyContext';
import { LibraryOptions, ResourcesConfig } from '../../singleton/types';
import { AmplifyServer } from '../AmplifyServer';
/**
 * The legacy `AmplifyClass`-shaped surface exposed on
 * {@link LegacyAmplifyServerContext.amplify}.
 *
 * It is a *reverse bridge*: a full, **branded** {@link AmplifyContext}
 * (delegating to the real per-request context) that additionally exposes the
 * `AmplifyClass` members old published consumers — notably
 * `@aws-amplify/adapter-nextjs` ≤ 1.7.3 and the code it hands the instance to —
 * touch at runtime:
 *
 * - `getConfig()` → the context's frozen `resourcesConfig`
 * - `libraryOptions` → the context's `libraryOptions`
 * - `Auth.fetchAuthSession` / `Auth.clearCredentials` / `Auth.getTokens` →
 *   delegate to the context's auth closures
 *
 * Because it is branded, new context-first internals (e.g.
 * `generateClientWithAmplifyInstance` in `@aws-amplify/api-graphql`, which the
 * old adapter passes this object to) accept it as a regular
 * {@link AmplifyContext} without re-bridging.
 *
 * Members of the old `AmplifyClass` that cannot be meaningfully supported in
 * the singleton-free model (`configure`) throw a descriptive
 * {@link AmplifyServerContextError} instead of failing with an opaque
 * `TypeError`.
 *
 * @deprecated Exists solely so OLD published `@aws-amplify/adapter-nextjs`
 * versions (≤ 1.7.3) keep working against this version of `aws-amplify`. It
 * will be removed in the next major version.
 */
export interface LegacyBridgedAmplify extends AmplifyContext {
    /** @deprecated Read {@link AmplifyContext.resourcesConfig} instead. */
    getConfig(): Readonly<ResourcesConfig>;
    /** @deprecated Call the context's auth methods directly instead. */
    readonly Auth: Pick<AmplifyContext, 'fetchAuthSession' | 'clearCredentials' | 'getTokens'>;
    /**
     * @deprecated Not supported on a per-request server context; always throws
     * an {@link AmplifyServerContextError}.
     */
    configure(): never;
}
/**
 * The envelope returned by the deprecated {@link getAmplifyServerContext},
 * mirroring the shape of the removed `AmplifyServer.Context`
 * (`{ amplify: AmplifyClass }`) with the `amplify` member replaced by the
 * {@link LegacyBridgedAmplify} reverse bridge.
 *
 * @deprecated See {@link getAmplifyServerContext}.
 */
export interface LegacyAmplifyServerContext {
    amplify: LegacyBridgedAmplify;
}
/**
 * Creates an Amplify server context.
 *
 * @deprecated This registry-backed API exists solely so OLD published
 * `@aws-amplify/adapter-nextjs` versions (≤ 1.7.3, peer `aws-amplify: ^6.16.4`)
 * — which call it (via `runWithAmplifyServerContext`) at runtime — keep working
 * against this version of `aws-amplify`. It will be removed in the next major
 * version. New code should use `createAmplifyContext()` and pass the context
 * to category APIs directly.
 *
 * Unlike the removed original (which registered a per-request `AmplifyClass`),
 * this shim builds a REAL branded `AmplifyContext` via `createAmplifyContext`
 * and returns it as the context spec: the branded context structurally
 * satisfies the legacy `ContextSpec` shape (`{ token: { value: symbol } }`),
 * so old adapter code can hand it BOTH to new context-first APIs (e.g.
 * `fetchAuthSession(contextSpec)` from `aws-amplify/auth/server`) and to the
 * legacy {@link getAmplifyServerContext} lookup.
 *
 * @param amplifyConfig The Amplify resource config.
 * @param libraryOptions The Amplify library options (the old adapter supplies
 *   cookie-backed `Auth.tokenProvider` / `Auth.credentialsProvider` here).
 * @returns The branded {@link AmplifyContext}, usable as the legacy context
 *   spec.
 */
export declare const createAmplifyServerContext: (amplifyConfig: ResourcesConfig, libraryOptions: LibraryOptions) => AmplifyContext;
/**
 * Returns an Amplify server context.
 *
 * @deprecated See {@link createAmplifyServerContext}; retained solely for OLD
 * published `@aws-amplify/adapter-nextjs` versions (≤ 1.7.3) and removed in
 * the next major version. The returned envelope's `amplify` member is a
 * {@link LegacyBridgedAmplify} reverse bridge, not an `AmplifyClass`.
 *
 * @param contextSpec The context spec used to get the Amplify server context.
 * @returns The Amplify server context.
 */
export declare const getAmplifyServerContext: (contextSpec: AmplifyServer.ContextSpec) => LegacyAmplifyServerContext;
/**
 * Destroys an Amplify server context.
 *
 * @deprecated See {@link createAmplifyServerContext}; retained solely for OLD
 * published `@aws-amplify/adapter-nextjs` versions (≤ 1.7.3) and removed in
 * the next major version.
 *
 * @param contextSpec The context spec used to destroy the Amplify server
 *   context.
 */
export declare const destroyAmplifyServerContext: (contextSpec: AmplifyServer.ContextSpec) => void;
