-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
61 lines (61 loc) · 2 KB
/
index.d.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/**
* cloudflare workers handler for proxying requests to backblaze b2
*
* @function
* @param {object} params - function params
* @param {object} params.event - fetch event
* @param {string} params.bucketKey - b2 bucket key
* @param {string} params.bucketKeyId - b2 bucket key id
* @param {string} params.bucketPrefix - b2 bucket prefix
* @param {number} params.cacheTtl - cloudflare cache ttl
* @param {string} params.publicPrefix - public prefix
* @returns {Response}
*/
export default function backblazeB2ProxyHandler({ event, bucketKey, bucketKeyId, bucketPrefix, cacheTtl, publicPrefix, }?: {
event: object;
bucketKey: string;
bucketKeyId: string;
bucketPrefix: string;
cacheTtl: number;
publicPrefix: string;
}): Response;
/**
* enhance response by adding cache headers and removing unnecessary header entries
*
* @function
* @param {Response} immRes - immutable response
* @returns {Response} enhanced response
*/
export function enhanceResponse(immRes: Response): Response;
/**
* authorize access to b2 bucket
*
* @function
* @param {object} params - function params
* @param {string} params.bucketKey - b2 bucket key
* @param {string} params.bucketKeyId - b2 bucket key id
* @param {object} params.cache - worker cache
*/
export function getBucketAuth({ bucketKey, bucketKeyId, cache, }: {
bucketKey: string;
bucketKeyId: string;
cache: object;
}): Promise<any>;
/**
* translate public url to private b2 bucket url
*
* @function
* @param {object} params - function params
* @param {string} params.bucketName - b2 bucket name
* @param {string} params.bucketPrefix - b2 bucket prefix
* @param {string} params.bucketURL - b2 bucket url
* @param {string} params.publicPrefix - public prefix
* @param {string} params.publicURL - public url
*/
export function getBucketURL({ bucketName, bucketPrefix, bucketURL, publicPrefix, publicURL, }: {
bucketName: string;
bucketPrefix: string;
bucketURL: string;
publicPrefix: string;
publicURL: string;
}): URL;