-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.ts
27 lines (24 loc) · 854 Bytes
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { AzureStorage } from "azure_storage_client/storage.ts";
export type CreateProxyOptions = {
account: string; // Azure storage account name
key?: string; // Azure account key
containers: Set<string>; // Allowed containers
suffix: string; // Azure URL suffix
handlers: Map<string, StorageHandler>; // HTTP method handlers
fallback?: Handler; // Fallback request handler
auth?: Handler; // BYO authorization request handler
};
export type Handler = (request: Request) => Response | Promise<Response>;
export type StorageHandlerParams = {
account?: string;
key?: string;
suffix?: string;
request: Request;
storage: AzureStorage;
container: string;
path: string;
};
export type ResponseType = Promise<Response> | Response;
export type StorageHandler = (
params: StorageHandlerParams,
) => Response | Promise<Response>;