///
import { ProtoFab } from './models/ProtoFab';
import { ConfigTypes } from './constants';
export interface PluginArgs {
[arg_name: string]: any;
}
export interface BuildConfig {
[plugin_name: string]: PluginArgs;
}
export declare type FabSettings = {
[var_name: string]: string | boolean;
};
export declare type DeployConfig = {
'cf-workers'?: ConfigTypes.CFWorkers;
'aws-lambda-edge'?: ConfigTypes.AwsLambda;
'aws-s3'?: ConfigTypes.AwsS3;
};
export declare type DeployProviders = keyof DeployConfig;
export interface FabConfig {
plugins: BuildConfig;
settings?: {
[env_name: string]: FabSettings;
};
deploy?: DeployConfig;
}
export interface PluginMetadataContent {
args: T;
[metadata_name: string]: any;
}
export interface PluginMetadata {
[plugin_name: string]: PluginMetadataContent;
}
export declare type FabBuildStep = (args: T, proto_fab: ProtoFab, config_path: string, skip_cache?: boolean) => Promise;
export declare type FabResponderMutableContext = {
[key: string]: any;
};
export declare type FabResponderArgs = {
request: Request;
settings: FabSettings;
url: URL;
context: FabResponderMutableContext;
};
export declare type FabRequestResponder = (context: FabResponderArgs) => Promise;
export declare type MatchParams = {
[match_name: string]: string;
};
export declare type FabRequestResponderWithParams = (contextWithParams: FabResponderArgs & {
params: MatchParams;
}) => ReturnType;
export declare type ResponseInterceptor = (response: Response) => Promise;
export declare type Directive = {
interceptResponse?: ResponseInterceptor;
replaceRequest?: Request;
};
export declare type FabFilesObject = {
[k: string]: string;
};
export declare type FabFiles = Map;
export declare type FabFileMetadata = {
[filename: string]: {
content_type: string;
content_length: number;
};
};
export declare type FabMetadata = {
file_metadata: FabFileMetadata;
plugin_metadata: PluginMetadata;
};
export declare type FabCacheValue = string | number | ArrayBuffer | ReadableStream;
export declare type FabCache = {
set: (key: string, value: FabCacheValue, ttl_seconds?: number) => Promise;
setJSON: (key: string, value: any, ttl_seconds?: number) => Promise;
get: (key: string) => Promise;
getJSON: (key: string) => Promise;
getNumber: (key: string) => Promise;
getArrayBuffer: (key: string) => Promise;
getStream: (key: string) => Promise;
};
export declare type FABServerContext = {
bundle_id: string;
cache?: FabCache;
};
export declare type ServerConstructor = (filename: string, args: ServerArgs) => ServerType;
export interface ServerType {
serve(runtimeType: SandboxType): Promise;
}
export declare type ServerArgs = {
port: string;
cert: string | undefined;
key: string | undefined;
env: string | undefined;
config: string;
};
export declare enum SandboxType {
v8isolate = 0,
nodeVm = 1
}
export declare type FabSpecRender = (request: Request, settings: FabSettings) => Promise;
export declare type FabSpecMetadata = {
production_settings: FabSettings;
fab_version: string;
};
export declare type FabSpecExports = {
render: FabSpecRender;
metadata: FabSpecMetadata;
initialize: (server_context: FABServerContext) => void;
};
export declare type FetchApi = (url: string | Request, init?: RequestInit) => Promise;
export declare type FabServerDeployer = (fab_path: string, working_dir: string, config: T, env_overrides: FabSettings, assets_url: string) => Promise;
export declare type FabAssetsDeployer = (fab_path: string, working_dir: string, config: T) => Promise;
export declare type FabDeployer = (fab_path: string, working_dir: string, config: T, env_overrides: FabSettings) => Promise;
export declare type FabDeployerExports = {
deployServer?: FabServerDeployer;
deployAssets?: FabAssetsDeployer;
deployBoth?: FabDeployer;
};
export declare type FabPackager = (fab_path: string, package_path: string, config: T, env_overrides: FabSettings, assets_url: string) => Promise;
export declare type FabPackagerExports = {
createPackage: FabPackager;
};
export interface JSON5ConfigI {
data: FabConfig;
str_contents: string;
write(file_path: string): Promise;
}
export declare type PackageFn = (file_path: string, config: FabConfig, target: DeployProviders, output_path: string | undefined, assets_url: string, env: string | undefined) => Promise;
export declare type DeployFn = (config: JSON5ConfigI, file_path: string, package_dir: string, server_host: DeployProviders | undefined, assets_host: DeployProviders | undefined, env: string | undefined, assets_only: boolean, assets_already_deployed_at: string | undefined, auto_install: boolean) => Promise;
export declare type BuildFn = (config_path: string, config: FabConfig, skip_cache: boolean) => Promise;
export declare type FabActionsExports = {
Packager: {
package: PackageFn;
};
Deployer: {
deploy: DeployFn;
};
Builder: {
build: BuildFn;
};
};
export declare type FabServerExports = {
createServer: ServerConstructor;
};