@depup/firebase__storage 0.14.1-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +31 -0
  2. package/changes.json +10 -0
  3. package/dist/index.browser.cjs.js +3685 -0
  4. package/dist/index.browser.cjs.js.map +1 -0
  5. package/dist/index.cjs.js +3685 -0
  6. package/dist/index.cjs.js.map +1 -0
  7. package/dist/index.esm.js +3656 -0
  8. package/dist/index.esm.js.map +1 -0
  9. package/dist/index.node.cjs.js +3710 -0
  10. package/dist/index.node.cjs.js.map +1 -0
  11. package/dist/node-esm/index.node.esm.js +3681 -0
  12. package/dist/node-esm/index.node.esm.js.map +1 -0
  13. package/dist/node-esm/package.json +1 -0
  14. package/dist/node-esm/src/api.browser.d.ts +47 -0
  15. package/dist/node-esm/src/api.d.ts +200 -0
  16. package/dist/node-esm/src/api.node.d.ts +47 -0
  17. package/dist/node-esm/src/constants.d.ts +20 -0
  18. package/dist/node-esm/src/implementation/async.d.ts +22 -0
  19. package/dist/node-esm/src/implementation/backoff.d.ts +43 -0
  20. package/dist/node-esm/src/implementation/blob.d.ts +34 -0
  21. package/dist/node-esm/src/implementation/connection.d.ts +56 -0
  22. package/dist/node-esm/src/implementation/constants.d.ts +48 -0
  23. package/dist/node-esm/src/implementation/error.d.ts +126 -0
  24. package/dist/node-esm/src/implementation/failrequest.d.ts +29 -0
  25. package/dist/node-esm/src/implementation/fs.d.ts +17 -0
  26. package/dist/node-esm/src/implementation/json.d.ts +7 -0
  27. package/dist/node-esm/src/implementation/list.d.ts +19 -0
  28. package/dist/node-esm/src/implementation/location.d.ts +32 -0
  29. package/dist/node-esm/src/implementation/metadata.d.ts +40 -0
  30. package/dist/node-esm/src/implementation/observer.d.ts +47 -0
  31. package/dist/node-esm/src/implementation/path.d.ts +31 -0
  32. package/dist/node-esm/src/implementation/request.d.ts +47 -0
  33. package/dist/node-esm/src/implementation/requestinfo.d.ts +73 -0
  34. package/dist/node-esm/src/implementation/requests.d.ts +84 -0
  35. package/dist/node-esm/src/implementation/string.d.ts +73 -0
  36. package/dist/node-esm/src/implementation/taskenums.d.ts +77 -0
  37. package/dist/node-esm/src/implementation/type.d.ts +23 -0
  38. package/dist/node-esm/src/implementation/url.d.ts +22 -0
  39. package/dist/node-esm/src/implementation/utils.d.ts +23 -0
  40. package/dist/node-esm/src/index.d.ts +7 -0
  41. package/dist/node-esm/src/index.node.d.ts +7 -0
  42. package/dist/node-esm/src/list.d.ts +41 -0
  43. package/dist/node-esm/src/metadata.d.ts +27 -0
  44. package/dist/node-esm/src/platform/base64.d.ts +20 -0
  45. package/dist/node-esm/src/platform/browser/base64.d.ts +19 -0
  46. package/dist/node-esm/src/platform/browser/connection.d.ts +55 -0
  47. package/dist/node-esm/src/platform/connection.d.ts +22 -0
  48. package/dist/node-esm/src/platform/node/base64.d.ts +19 -0
  49. package/dist/node-esm/src/platform/node/connection.d.ts +58 -0
  50. package/dist/node-esm/src/public-types.d.ts +424 -0
  51. package/dist/node-esm/src/reference.d.ts +208 -0
  52. package/dist/node-esm/src/service.d.ts +131 -0
  53. package/dist/node-esm/src/task.d.ts +148 -0
  54. package/dist/node-esm/test/unit/connection.d.ts +47 -0
  55. package/dist/node-esm/test/unit/testshared.d.ts +60 -0
  56. package/dist/src/api.browser.d.ts +47 -0
  57. package/dist/src/api.d.ts +200 -0
  58. package/dist/src/api.node.d.ts +47 -0
  59. package/dist/src/constants.d.ts +20 -0
  60. package/dist/src/implementation/async.d.ts +22 -0
  61. package/dist/src/implementation/backoff.d.ts +43 -0
  62. package/dist/src/implementation/blob.d.ts +34 -0
  63. package/dist/src/implementation/connection.d.ts +56 -0
  64. package/dist/src/implementation/constants.d.ts +48 -0
  65. package/dist/src/implementation/error.d.ts +126 -0
  66. package/dist/src/implementation/failrequest.d.ts +29 -0
  67. package/dist/src/implementation/fs.d.ts +17 -0
  68. package/dist/src/implementation/json.d.ts +7 -0
  69. package/dist/src/implementation/list.d.ts +19 -0
  70. package/dist/src/implementation/location.d.ts +32 -0
  71. package/dist/src/implementation/metadata.d.ts +40 -0
  72. package/dist/src/implementation/observer.d.ts +47 -0
  73. package/dist/src/implementation/path.d.ts +31 -0
  74. package/dist/src/implementation/request.d.ts +47 -0
  75. package/dist/src/implementation/requestinfo.d.ts +73 -0
  76. package/dist/src/implementation/requests.d.ts +84 -0
  77. package/dist/src/implementation/string.d.ts +73 -0
  78. package/dist/src/implementation/taskenums.d.ts +77 -0
  79. package/dist/src/implementation/type.d.ts +23 -0
  80. package/dist/src/implementation/url.d.ts +22 -0
  81. package/dist/src/implementation/utils.d.ts +23 -0
  82. package/dist/src/index.d.ts +7 -0
  83. package/dist/src/index.node.d.ts +7 -0
  84. package/dist/src/list.d.ts +41 -0
  85. package/dist/src/metadata.d.ts +27 -0
  86. package/dist/src/platform/base64.d.ts +20 -0
  87. package/dist/src/platform/browser/base64.d.ts +19 -0
  88. package/dist/src/platform/browser/connection.d.ts +55 -0
  89. package/dist/src/platform/connection.d.ts +22 -0
  90. package/dist/src/platform/node/base64.d.ts +19 -0
  91. package/dist/src/platform/node/connection.d.ts +58 -0
  92. package/dist/src/public-types.d.ts +424 -0
  93. package/dist/src/reference.d.ts +208 -0
  94. package/dist/src/service.d.ts +131 -0
  95. package/dist/src/task.d.ts +148 -0
  96. package/dist/src/tsdoc-metadata.json +11 -0
  97. package/dist/storage-public.d.ts +725 -0
  98. package/dist/storage.d.ts +1391 -0
  99. package/dist/test/unit/connection.d.ts +47 -0
  100. package/dist/test/unit/testshared.d.ts +60 -0
  101. package/package.json +98 -0
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { StorageReference } from './public-types';
18
+ /**
19
+ * Downloads the data at the object's location. Returns an error if the object
20
+ * is not found.
21
+ *
22
+ * To use this functionality, you have to whitelist your app's origin in your
23
+ * Cloud Storage bucket. See also
24
+ * https://cloud.google.com/storage/docs/configuring-cors
25
+ *
26
+ * This API is not available in Node.
27
+ *
28
+ * @public
29
+ * @param ref - StorageReference where data should be downloaded.
30
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
31
+ * retrieve.
32
+ * @returns A Promise that resolves with a Blob containing the object's bytes
33
+ */
34
+ export declare function getBlob(ref: StorageReference, maxDownloadSizeBytes?: number): Promise<Blob>;
35
+ /**
36
+ * Downloads the data at the object's location. Raises an error event if the
37
+ * object is not found.
38
+ *
39
+ * This API is only available in Node.
40
+ *
41
+ * @public
42
+ * @param ref - StorageReference where data should be downloaded.
43
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
44
+ * retrieve.
45
+ * @returns A stream with the object's data as bytes
46
+ */
47
+ export declare function getStream(ref: StorageReference, maxDownloadSizeBytes?: number): ReadableStream;
@@ -0,0 +1,200 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseApp } from '@firebase/app';
18
+ import { StorageReference, FirebaseStorage, UploadResult, ListOptions, ListResult, UploadTask, SettableMetadata, UploadMetadata, FullMetadata } from './public-types';
19
+ import { Reference } from './reference';
20
+ import { EmulatorMockTokenOptions } from '@firebase/util';
21
+ import { StringFormat } from './implementation/string';
22
+ export { EmulatorMockTokenOptions } from '@firebase/util';
23
+ export { StorageError, StorageErrorCode } from './implementation/error';
24
+ /**
25
+ * Public types.
26
+ */
27
+ export * from './public-types';
28
+ export { Location as _Location } from './implementation/location';
29
+ export { UploadTask as _UploadTask } from './task';
30
+ export type { Reference as _Reference } from './reference';
31
+ export type { FirebaseStorageImpl as _FirebaseStorageImpl } from './service';
32
+ export { FbsBlob as _FbsBlob } from './implementation/blob';
33
+ export { dataFromString as _dataFromString } from './implementation/string';
34
+ export { invalidRootOperation as _invalidRootOperation, invalidArgument as _invalidArgument } from './implementation/error';
35
+ export { TaskEvent as _TaskEvent, TaskState as _TaskState } from './implementation/taskenums';
36
+ export { StringFormat };
37
+ /**
38
+ * Downloads the data at the object's location. Returns an error if the object
39
+ * is not found.
40
+ *
41
+ * To use this functionality, you have to whitelist your app's origin in your
42
+ * Cloud Storage bucket. See also
43
+ * https://cloud.google.com/storage/docs/configuring-cors
44
+ *
45
+ * @public
46
+ * @param ref - StorageReference where data should be downloaded.
47
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
48
+ * retrieve.
49
+ * @returns A Promise containing the object's bytes
50
+ */
51
+ export declare function getBytes(ref: StorageReference, maxDownloadSizeBytes?: number): Promise<ArrayBuffer>;
52
+ /**
53
+ * Uploads data to this object's location.
54
+ * The upload is not resumable.
55
+ * @public
56
+ * @param ref - {@link StorageReference} where data should be uploaded.
57
+ * @param data - The data to upload.
58
+ * @param metadata - Metadata for the data to upload.
59
+ * @returns A Promise containing an UploadResult
60
+ */
61
+ export declare function uploadBytes(ref: StorageReference, data: Blob | Uint8Array | ArrayBuffer, metadata?: UploadMetadata): Promise<UploadResult>;
62
+ /**
63
+ * Uploads a string to this object's location.
64
+ * The upload is not resumable.
65
+ * @public
66
+ * @param ref - {@link StorageReference} where string should be uploaded.
67
+ * @param value - The string to upload.
68
+ * @param format - The format of the string to upload.
69
+ * @param metadata - Metadata for the string to upload.
70
+ * @returns A Promise containing an UploadResult
71
+ */
72
+ export declare function uploadString(ref: StorageReference, value: string, format?: StringFormat, metadata?: UploadMetadata): Promise<UploadResult>;
73
+ /**
74
+ * Uploads data to this object's location.
75
+ * The upload can be paused and resumed, and exposes progress updates.
76
+ * @public
77
+ * @param ref - {@link StorageReference} where data should be uploaded.
78
+ * @param data - The data to upload.
79
+ * @param metadata - Metadata for the data to upload.
80
+ * @returns An UploadTask
81
+ */
82
+ export declare function uploadBytesResumable(ref: StorageReference, data: Blob | Uint8Array | ArrayBuffer, metadata?: UploadMetadata): UploadTask;
83
+ /**
84
+ * A `Promise` that resolves with the metadata for this object. If this
85
+ * object doesn't exist or metadata cannot be retrieved, the promise is
86
+ * rejected.
87
+ * @public
88
+ * @param ref - {@link StorageReference} to get metadata from.
89
+ */
90
+ export declare function getMetadata(ref: StorageReference): Promise<FullMetadata>;
91
+ /**
92
+ * Updates the metadata for this object.
93
+ * @public
94
+ * @param ref - {@link StorageReference} to update metadata for.
95
+ * @param metadata - The new metadata for the object.
96
+ * Only values that have been explicitly set will be changed. Explicitly
97
+ * setting a value to null will remove the metadata.
98
+ * @returns A `Promise` that resolves with the new metadata for this object.
99
+ */
100
+ export declare function updateMetadata(ref: StorageReference, metadata: SettableMetadata): Promise<FullMetadata>;
101
+ /**
102
+ * List items (files) and prefixes (folders) under this storage reference.
103
+ *
104
+ * List API is only available for Firebase Rules Version 2.
105
+ *
106
+ * GCS is a key-blob store. Firebase Storage imposes the semantic of '/'
107
+ * delimited folder structure.
108
+ * Refer to GCS's List API if you want to learn more.
109
+ *
110
+ * To adhere to Firebase Rules's Semantics, Firebase Storage does not
111
+ * support objects whose paths end with "/" or contain two consecutive
112
+ * "/"s. Firebase Storage List API will filter these unsupported objects.
113
+ * list() may fail if there are too many unsupported objects in the bucket.
114
+ * @public
115
+ *
116
+ * @param ref - {@link StorageReference} to get list from.
117
+ * @param options - See {@link ListOptions} for details.
118
+ * @returns A `Promise` that resolves with the items and prefixes.
119
+ * `prefixes` contains references to sub-folders and `items`
120
+ * contains references to objects in this folder. `nextPageToken`
121
+ * can be used to get the rest of the results.
122
+ */
123
+ export declare function list(ref: StorageReference, options?: ListOptions): Promise<ListResult>;
124
+ /**
125
+ * List all items (files) and prefixes (folders) under this storage reference.
126
+ *
127
+ * This is a helper method for calling list() repeatedly until there are
128
+ * no more results. The default pagination size is 1000.
129
+ *
130
+ * Note: The results may not be consistent if objects are changed while this
131
+ * operation is running.
132
+ *
133
+ * Warning: `listAll` may potentially consume too many resources if there are
134
+ * too many results.
135
+ * @public
136
+ * @param ref - {@link StorageReference} to get list from.
137
+ *
138
+ * @returns A `Promise` that resolves with all the items and prefixes under
139
+ * the current storage reference. `prefixes` contains references to
140
+ * sub-directories and `items` contains references to objects in this
141
+ * folder. `nextPageToken` is never returned.
142
+ */
143
+ export declare function listAll(ref: StorageReference): Promise<ListResult>;
144
+ /**
145
+ * Returns the download URL for the given {@link StorageReference}.
146
+ * @public
147
+ * @param ref - {@link StorageReference} to get the download URL for.
148
+ * @returns A `Promise` that resolves with the download
149
+ * URL for this object.
150
+ */
151
+ export declare function getDownloadURL(ref: StorageReference): Promise<string>;
152
+ /**
153
+ * Deletes the object at this location.
154
+ * @public
155
+ * @param ref - {@link StorageReference} for object to delete.
156
+ * @returns A `Promise` that resolves if the deletion succeeds.
157
+ */
158
+ export declare function deleteObject(ref: StorageReference): Promise<void>;
159
+ /**
160
+ * Returns a {@link StorageReference} for the given url.
161
+ * @param storage - {@link FirebaseStorage} instance.
162
+ * @param url - URL. If empty, returns root reference.
163
+ * @public
164
+ */
165
+ export declare function ref(storage: FirebaseStorage, url?: string): StorageReference;
166
+ /**
167
+ * Returns a {@link StorageReference} for the given path in the
168
+ * default bucket.
169
+ * @param storageOrRef - {@link FirebaseStorage} or {@link StorageReference}.
170
+ * @param pathOrUrlStorage - path. If empty, returns root reference (if {@link FirebaseStorage}
171
+ * instance provided) or returns same reference (if {@link StorageReference} provided).
172
+ * @public
173
+ */
174
+ export declare function ref(storageOrRef: FirebaseStorage | StorageReference, path?: string): StorageReference;
175
+ /**
176
+ * @internal
177
+ */
178
+ export declare function _getChild(ref: StorageReference, childPath: string): Reference;
179
+ /**
180
+ * Gets a {@link FirebaseStorage} instance for the given Firebase app.
181
+ * @public
182
+ * @param app - Firebase app to get {@link FirebaseStorage} instance for.
183
+ * @param bucketUrl - The gs:// url to your Firebase Storage Bucket.
184
+ * If not passed, uses the app's default Storage Bucket.
185
+ * @returns A {@link FirebaseStorage} instance.
186
+ */
187
+ export declare function getStorage(app?: FirebaseApp, bucketUrl?: string): FirebaseStorage;
188
+ /**
189
+ * Modify this {@link FirebaseStorage} instance to communicate with the Cloud Storage emulator.
190
+ *
191
+ * @param storage - The {@link FirebaseStorage} instance
192
+ * @param host - The emulator host (ex: localhost)
193
+ * @param port - The emulator port (ex: 5001)
194
+ * @param options - Emulator options. `options.mockUserToken` is the mock auth
195
+ * token to use for unit testing Security Rules.
196
+ * @public
197
+ */
198
+ export declare function connectStorageEmulator(storage: FirebaseStorage, host: string, port: number, options?: {
199
+ mockUserToken?: EmulatorMockTokenOptions | string;
200
+ }): void;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2021 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { StorageReference } from './public-types';
18
+ /**
19
+ * Downloads the data at the object's location. Returns an error if the object
20
+ * is not found.
21
+ *
22
+ * To use this functionality, you have to whitelist your app's origin in your
23
+ * Cloud Storage bucket. See also
24
+ * https://cloud.google.com/storage/docs/configuring-cors
25
+ *
26
+ * This API is not available in Node.
27
+ *
28
+ * @public
29
+ * @param ref - StorageReference where data should be downloaded.
30
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
31
+ * retrieve.
32
+ * @returns A Promise that resolves with a Blob containing the object's bytes
33
+ */
34
+ export declare function getBlob(ref: StorageReference, maxDownloadSizeBytes?: number): Promise<Blob>;
35
+ /**
36
+ * Downloads the data at the object's location. Raises an error event if the
37
+ * object is not found.
38
+ *
39
+ * This API is only available in Node.
40
+ *
41
+ * @public
42
+ * @param ref - StorageReference where data should be downloaded.
43
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
44
+ * retrieve.
45
+ * @returns A stream with the object's data as bytes
46
+ */
47
+ export declare function getStream(ref: StorageReference, maxDownloadSizeBytes?: number): ReadableStream;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2020 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Type constant for Firebase Storage.
19
+ */
20
+ export declare const STORAGE_TYPE = "storage";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Returns a function that invokes f with its arguments asynchronously as a
19
+ * microtask, i.e. as soon as possible after the current script returns back
20
+ * into browser code.
21
+ */
22
+ export declare function async(f: Function): Function;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * @fileoverview Provides a method for running a function with exponential
19
+ * backoff.
20
+ */
21
+ type id = (p1: boolean) => void;
22
+ export { id };
23
+ /**
24
+ * Accepts a callback for an action to perform (`doRequest`),
25
+ * and then a callback for when the backoff has completed (`backoffCompleteCb`).
26
+ * The callback sent to start requires an argument to call (`onRequestComplete`).
27
+ * When `start` calls `doRequest`, it passes a callback for when the request has
28
+ * completed, `onRequestComplete`. Based on this, the backoff continues, with
29
+ * another call to `doRequest` and the above loop continues until the timeout
30
+ * is hit, or a successful response occurs.
31
+ * @description
32
+ * @param doRequest Callback to perform request
33
+ * @param backoffCompleteCb Callback to call when backoff has been completed
34
+ */
35
+ export declare function start(doRequest: (onRequestComplete: (success: boolean) => void, canceled: boolean) => void, backoffCompleteCb: (...args: any[]) => unknown, timeout: number): id;
36
+ /**
37
+ * Stops the retry loop from repeating.
38
+ * If the function is currently "in between" retries, it is invoked immediately
39
+ * with the second parameter as "true". Otherwise, it will be invoked once more
40
+ * after the current invocation finishes iff the current invocation would have
41
+ * triggered another retry.
42
+ */
43
+ export declare function stop(id: id): void;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * @param opt_elideCopy - If true, doesn't copy mutable input data
19
+ * (e.g. Uint8Arrays). Pass true only if you know the objects will not be
20
+ * modified after this blob's construction.
21
+ *
22
+ * @internal
23
+ */
24
+ export declare class FbsBlob {
25
+ private data_;
26
+ private size_;
27
+ private type_;
28
+ constructor(data: Blob | Uint8Array | ArrayBuffer, elideCopy?: boolean);
29
+ size(): number;
30
+ type(): string;
31
+ slice(startByte: number, endByte: number): FbsBlob | null;
32
+ static getBlob(...args: Array<string | FbsBlob>): FbsBlob | null;
33
+ uploadData(): Blob | Uint8Array;
34
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /** Network headers */
18
+ export type Headers = Record<string, string>;
19
+ /** Response type exposed by the networking APIs. */
20
+ export type ConnectionType = string | ArrayBuffer | Blob | ReadableStream<Uint8Array>;
21
+ /**
22
+ * A lightweight wrapper around XMLHttpRequest with a
23
+ * goog.net.XhrIo-like interface.
24
+ *
25
+ * You can create a new connection by invoking `newTextConnection()`,
26
+ * `newBytesConnection()` or `newStreamConnection()`.
27
+ */
28
+ export interface Connection<T extends ConnectionType> {
29
+ /**
30
+ * Sends a request to the provided URL.
31
+ *
32
+ * This method never rejects its promise. In case of encountering an error,
33
+ * it sets an error code internally which can be accessed by calling
34
+ * getErrorCode() by callers.
35
+ */
36
+ send(url: string, method: string, isUsingEmulator: boolean, body?: ArrayBufferView | Blob | string | null, headers?: Headers): Promise<void>;
37
+ getErrorCode(): ErrorCode;
38
+ getStatus(): number;
39
+ getResponse(): T;
40
+ getErrorText(): string;
41
+ /**
42
+ * Abort the request.
43
+ */
44
+ abort(): void;
45
+ getResponseHeader(header: string): string | null;
46
+ addUploadProgressListener(listener: (p1: ProgressEvent) => void): void;
47
+ removeUploadProgressListener(listener: (p1: ProgressEvent) => void): void;
48
+ }
49
+ /**
50
+ * Error codes for requests made by the XhrIo wrapper.
51
+ */
52
+ export declare enum ErrorCode {
53
+ NO_ERROR = 0,
54
+ NETWORK_ERROR = 1,
55
+ ABORT = 2
56
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * @fileoverview Constants used in the Firebase Storage library.
19
+ */
20
+ /**
21
+ * Domain name for firebase storage.
22
+ */
23
+ export declare const DEFAULT_HOST = "firebasestorage.googleapis.com";
24
+ /**
25
+ * The key in Firebase config json for the storage bucket.
26
+ */
27
+ export declare const CONFIG_STORAGE_BUCKET_KEY = "storageBucket";
28
+ /**
29
+ * 2 minutes
30
+ *
31
+ * The timeout for all operations except upload.
32
+ */
33
+ export declare const DEFAULT_MAX_OPERATION_RETRY_TIME: number;
34
+ /**
35
+ * 10 minutes
36
+ *
37
+ * The timeout for upload.
38
+ */
39
+ export declare const DEFAULT_MAX_UPLOAD_RETRY_TIME: number;
40
+ /**
41
+ * 1 second
42
+ */
43
+ export declare const DEFAULT_MIN_SLEEP_TIME_MILLIS = 1000;
44
+ /**
45
+ * This is the value of Number.MIN_SAFE_INTEGER, which is not well supported
46
+ * enough for us to use it directly.
47
+ */
48
+ export declare const MIN_SAFE_INTEGER = -9007199254740991;
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { FirebaseError } from '@firebase/util';
18
+ /**
19
+ * An error returned by the Firebase Storage SDK.
20
+ * @public
21
+ */
22
+ export declare class StorageError extends FirebaseError {
23
+ private status_;
24
+ private readonly _baseMessage;
25
+ /**
26
+ * Stores custom error data unique to the `StorageError`.
27
+ */
28
+ customData: {
29
+ serverResponse: string | null;
30
+ };
31
+ /**
32
+ * @param code - A `StorageErrorCode` string to be prefixed with 'storage/' and
33
+ * added to the end of the message.
34
+ * @param message - Error message.
35
+ * @param status_ - Corresponding HTTP Status Code
36
+ */
37
+ constructor(code: StorageErrorCode, message: string, status_?: number);
38
+ get status(): number;
39
+ set status(status: number);
40
+ /**
41
+ * Compares a `StorageErrorCode` against this error's code, filtering out the prefix.
42
+ */
43
+ _codeEquals(code: StorageErrorCode): boolean;
44
+ /**
45
+ * Optional response message that was added by the server.
46
+ */
47
+ get serverResponse(): null | string;
48
+ set serverResponse(serverResponse: string | null);
49
+ }
50
+ export declare const errors: {};
51
+ /**
52
+ * @public
53
+ * Error codes that can be attached to `StorageError` objects.
54
+ */
55
+ export declare enum StorageErrorCode {
56
+ UNKNOWN = "unknown",
57
+ OBJECT_NOT_FOUND = "object-not-found",
58
+ BUCKET_NOT_FOUND = "bucket-not-found",
59
+ PROJECT_NOT_FOUND = "project-not-found",
60
+ QUOTA_EXCEEDED = "quota-exceeded",
61
+ UNAUTHENTICATED = "unauthenticated",
62
+ UNAUTHORIZED = "unauthorized",
63
+ UNAUTHORIZED_APP = "unauthorized-app",
64
+ RETRY_LIMIT_EXCEEDED = "retry-limit-exceeded",
65
+ INVALID_CHECKSUM = "invalid-checksum",
66
+ CANCELED = "canceled",
67
+ INVALID_EVENT_NAME = "invalid-event-name",
68
+ INVALID_URL = "invalid-url",
69
+ INVALID_DEFAULT_BUCKET = "invalid-default-bucket",
70
+ NO_DEFAULT_BUCKET = "no-default-bucket",
71
+ CANNOT_SLICE_BLOB = "cannot-slice-blob",
72
+ SERVER_FILE_WRONG_SIZE = "server-file-wrong-size",
73
+ NO_DOWNLOAD_URL = "no-download-url",
74
+ INVALID_ARGUMENT = "invalid-argument",
75
+ INVALID_ARGUMENT_COUNT = "invalid-argument-count",
76
+ APP_DELETED = "app-deleted",
77
+ INVALID_ROOT_OPERATION = "invalid-root-operation",
78
+ INVALID_FORMAT = "invalid-format",
79
+ INTERNAL_ERROR = "internal-error",
80
+ UNSUPPORTED_ENVIRONMENT = "unsupported-environment"
81
+ }
82
+ export declare function prependCode(code: StorageErrorCode): string;
83
+ export declare function unknown(): StorageError;
84
+ export declare function objectNotFound(path: string): StorageError;
85
+ export declare function bucketNotFound(bucket: string): StorageError;
86
+ export declare function projectNotFound(project: string): StorageError;
87
+ export declare function quotaExceeded(bucket: string): StorageError;
88
+ export declare function unauthenticated(): StorageError;
89
+ export declare function unauthorizedApp(): StorageError;
90
+ export declare function unauthorized(path: string): StorageError;
91
+ export declare function retryLimitExceeded(): StorageError;
92
+ export declare function invalidChecksum(path: string, checksum: string, calculated: string): StorageError;
93
+ export declare function canceled(): StorageError;
94
+ export declare function invalidEventName(name: string): StorageError;
95
+ export declare function invalidUrl(url: string): StorageError;
96
+ export declare function invalidDefaultBucket(bucket: string): StorageError;
97
+ export declare function noDefaultBucket(): StorageError;
98
+ export declare function cannotSliceBlob(): StorageError;
99
+ export declare function serverFileWrongSize(): StorageError;
100
+ export declare function noDownloadURL(): StorageError;
101
+ export declare function missingPolyFill(polyFill: string): StorageError;
102
+ /**
103
+ * @internal
104
+ */
105
+ export declare function invalidArgument(message: string): StorageError;
106
+ export declare function invalidArgumentCount(argMin: number, argMax: number, fnName: string, real: number): StorageError;
107
+ export declare function appDeleted(): StorageError;
108
+ /**
109
+ * @param name - The name of the operation that was invalid.
110
+ *
111
+ * @internal
112
+ */
113
+ export declare function invalidRootOperation(name: string): StorageError;
114
+ /**
115
+ * @param format - The format that was not valid.
116
+ * @param message - A message describing the format violation.
117
+ */
118
+ export declare function invalidFormat(format: string, message: string): StorageError;
119
+ /**
120
+ * @param message - A message describing the internal error.
121
+ */
122
+ export declare function unsupportedEnvironment(message: string): StorageError;
123
+ /**
124
+ * @param message - A message describing the internal error.
125
+ */
126
+ export declare function internalError(message: string): StorageError;