UNPKG

1.42 kBTypeScriptView Raw
1/// <reference types="node" />
2export interface DeployOptions {
3 apiKey: string;
4 accountId: string;
5 projectName: string;
6 branch?: string;
7 commitMessage?: string;
8 commitHash?: string;
9}
10export interface DeploymentFile {
11 filename: string;
12 content: Buffer | (() => Promise<Buffer>);
13 /** Leave blank to use mime on npm to get the type. */
14 contentType?: string;
15 /** Precompute yourself with `computeHash` or leave blank. */
16 hash?: string;
17}
18export interface Deployment {
19 id: string;
20 url: string;
21 hashes: Record<string, string>;
22}
23export interface DeploymentOptions {
24 branch?: string;
25 commitMessage?: string;
26 commitHash?: string;
27 headers?: string;
28 redirects?: string;
29 routes?: string;
30 worker?: string;
31 concurrency?: number;
32 log?: (msg: string) => unknown;
33}
34export interface CloudflarePagesDirectUploaderOptions {
35 apiKey: string;
36 accountId: string;
37 projectName: string;
38}
39export declare class CloudflarePagesDirectUploader {
40 private config;
41 constructor(config: CloudflarePagesDirectUploaderOptions);
42 deployDirectory(directoryPath: string, options?: DeploymentOptions): Promise<Deployment>;
43 deployFiles(files: DeploymentFile[], options?: DeploymentOptions): Promise<Deployment>;
44}
45export default CloudflarePagesDirectUploader;
46export declare function computeHash(content: Buffer, filename: string): string;