@aziontech/opennextjs-azion
Version:
Azion builder for Next.js apps
43 lines (42 loc) • 1.64 kB
TypeScript
/**
* This code was originally copied and modified from the @opennextjs/cloudflare repository.
* Significant changes have been made to adapt it for use with Azion.
*/
declare global {
interface ExecutionContext {
waitUntil(promise: Promise<any>): void;
passThroughOnException(): void;
props: Record<string, unknown>;
request: Request;
}
interface AzionEnv {
ASSETS?: {
fetch: (request: Request | URL) => Promise<Response>;
};
NEXTJS_ENV?: string;
AZION?: {
BUCKET_NAME: string;
BUCKET_PREFIX: string;
CACHE_API_STORAGE_NAME: string;
Storage: {
get: (key: string) => Promise<{
arrayBuffer: () => Promise<ArrayBuffer>;
} | null>;
put: (key: string, value: Uint8Array<ArrayBufferLike>, options: Record<string, unknown>) => Promise<void>;
delete: (key: string) => Promise<void>;
};
};
WORKER_SELF_REFERENCE: any;
}
}
export type AzionContext<AzProperties extends Record<string, unknown> = any, Context = ExecutionContext> = {
env: AzionEnv;
ctx: Context;
az: AzProperties | undefined;
};
export declare function getAzionContext<AzProperties extends Record<string, unknown> = any, Context = ExecutionContext>(options: {
async: true;
}): Promise<AzionContext<AzProperties, Context>>;
export declare function getAzionContext<AzProperties extends Record<string, unknown> = any, Context = ExecutionContext>(options?: {
async: false;
}): AzionContext<AzProperties, Context>;