@depup/firebase__storage-compat 0.4.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.
@@ -0,0 +1,121 @@
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 { StorageReference, StringFormat } from '@firebase/storage';
18
+ import { StorageServiceCompat } from './service';
19
+ import * as types from '@firebase/storage-types';
20
+ import { Compat } from '@firebase/util';
21
+ export declare class ReferenceCompat implements types.Reference, Compat<StorageReference> {
22
+ readonly _delegate: StorageReference;
23
+ storage: StorageServiceCompat;
24
+ constructor(_delegate: StorageReference, storage: StorageServiceCompat);
25
+ get name(): string;
26
+ get bucket(): string;
27
+ get fullPath(): string;
28
+ toString(): string;
29
+ /**
30
+ * @returns A reference to the object obtained by
31
+ * appending childPath, removing any duplicate, beginning, or trailing
32
+ * slashes.
33
+ */
34
+ child(childPath: string): types.Reference;
35
+ get root(): types.Reference;
36
+ /**
37
+ * @returns A reference to the parent of the
38
+ * current object, or null if the current object is the root.
39
+ */
40
+ get parent(): types.Reference | null;
41
+ /**
42
+ * Uploads a blob to this object's location.
43
+ * @param data - The blob to upload.
44
+ * @returns An UploadTask that lets you control and
45
+ * observe the upload.
46
+ */
47
+ put(data: Blob | Uint8Array | ArrayBuffer, metadata?: types.FullMetadata): types.UploadTask;
48
+ /**
49
+ * Uploads a string to this object's location.
50
+ * @param value - The string to upload.
51
+ * @param format - The format of the string to upload.
52
+ * @returns An UploadTask that lets you control and
53
+ * observe the upload.
54
+ */
55
+ putString(value: string, format?: StringFormat, metadata?: types.UploadMetadata): types.UploadTask;
56
+ /**
57
+ * List all items (files) and prefixes (folders) under this storage reference.
58
+ *
59
+ * This is a helper method for calling list() repeatedly until there are
60
+ * no more results. The default pagination size is 1000.
61
+ *
62
+ * Note: The results may not be consistent if objects are changed while this
63
+ * operation is running.
64
+ *
65
+ * Warning: listAll may potentially consume too many resources if there are
66
+ * too many results.
67
+ *
68
+ * @returns A Promise that resolves with all the items and prefixes under
69
+ * the current storage reference. `prefixes` contains references to
70
+ * sub-directories and `items` contains references to objects in this
71
+ * folder. `nextPageToken` is never returned.
72
+ */
73
+ listAll(): Promise<types.ListResult>;
74
+ /**
75
+ * List items (files) and prefixes (folders) under this storage reference.
76
+ *
77
+ * List API is only available for Firebase Rules Version 2.
78
+ *
79
+ * GCS is a key-blob store. Firebase Storage imposes the semantic of '/'
80
+ * delimited folder structure. Refer to GCS's List API if you want to learn more.
81
+ *
82
+ * To adhere to Firebase Rules's Semantics, Firebase Storage does not
83
+ * support objects whose paths end with "/" or contain two consecutive
84
+ * "/"s. Firebase Storage List API will filter these unsupported objects.
85
+ * list() may fail if there are too many unsupported objects in the bucket.
86
+ *
87
+ * @param options - See ListOptions for details.
88
+ * @returns A Promise that resolves with the items and prefixes.
89
+ * `prefixes` contains references to sub-folders and `items`
90
+ * contains references to objects in this folder. `nextPageToken`
91
+ * can be used to get the rest of the results.
92
+ */
93
+ list(options?: types.ListOptions | null): Promise<types.ListResult>;
94
+ /**
95
+ * A `Promise` that resolves with the metadata for this object. If this
96
+ * object doesn't exist or metadata cannot be retrieved, the promise is
97
+ * rejected.
98
+ */
99
+ getMetadata(): Promise<types.FullMetadata>;
100
+ /**
101
+ * Updates the metadata for this object.
102
+ * @param metadata - The new metadata for the object.
103
+ * Only values that have been explicitly set will be changed. Explicitly
104
+ * setting a value to null will remove the metadata.
105
+ * @returns A `Promise` that resolves
106
+ * with the new metadata for this object.
107
+ * @see firebaseStorage.Reference.prototype.getMetadata
108
+ */
109
+ updateMetadata(metadata: types.SettableMetadata): Promise<types.FullMetadata>;
110
+ /**
111
+ * @returns A `Promise` that resolves with the download
112
+ * URL for this object.
113
+ */
114
+ getDownloadURL(): Promise<string>;
115
+ /**
116
+ * Deletes the object at this location.
117
+ * @returns A `Promise` that resolves if the deletion succeeds.
118
+ */
119
+ delete(): Promise<void>;
120
+ private _throwIfRoot;
121
+ }
@@ -0,0 +1,46 @@
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 * as types from '@firebase/storage-types';
18
+ import { FirebaseApp } from '@firebase/app-types';
19
+ import { FirebaseStorage } from '@firebase/storage';
20
+ import { Compat, EmulatorMockTokenOptions } from '@firebase/util';
21
+ /**
22
+ * A service that provides firebaseStorage.Reference instances.
23
+ * @param opt_url gs:// url to a custom Storage Bucket
24
+ */
25
+ export declare class StorageServiceCompat implements types.FirebaseStorage, Compat<FirebaseStorage> {
26
+ app: FirebaseApp;
27
+ readonly _delegate: FirebaseStorage;
28
+ constructor(app: FirebaseApp, _delegate: FirebaseStorage);
29
+ get maxOperationRetryTime(): number;
30
+ get maxUploadRetryTime(): number;
31
+ /**
32
+ * Returns a firebaseStorage.Reference for the given path in the default
33
+ * bucket.
34
+ */
35
+ ref(path?: string): types.Reference;
36
+ /**
37
+ * Returns a firebaseStorage.Reference object for the given absolute URL,
38
+ * which must be a gs:// or http[s]:// URL.
39
+ */
40
+ refFromURL(url: string): types.Reference;
41
+ setMaxUploadRetryTime(time: number): void;
42
+ setMaxOperationRetryTime(time: number): void;
43
+ useEmulator(host: string, port: number, options?: {
44
+ mockUserToken?: EmulatorMockTokenOptions | string;
45
+ }): void;
46
+ }
@@ -0,0 +1,54 @@
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 { UploadTask, StorageError, TaskEvent, StorageObserver } from '@firebase/storage';
18
+ import { UploadTaskSnapshotCompat } from './tasksnapshot';
19
+ import { ReferenceCompat } from './reference';
20
+ import * as types from '@firebase/storage-types';
21
+ import { Compat } from '@firebase/util';
22
+ export declare class UploadTaskCompat implements types.UploadTask, Compat<UploadTask> {
23
+ readonly _delegate: UploadTask;
24
+ private readonly _ref;
25
+ constructor(_delegate: UploadTask, _ref: ReferenceCompat);
26
+ get snapshot(): UploadTaskSnapshotCompat;
27
+ cancel: () => boolean;
28
+ catch: (onRejected: (error: StorageError) => unknown) => Promise<unknown>;
29
+ pause: () => boolean;
30
+ resume: () => boolean;
31
+ then(onFulfilled?: ((a: UploadTaskSnapshotCompat) => unknown) | null, onRejected?: ((a: StorageError) => unknown) | null): Promise<unknown>;
32
+ on(type: TaskEvent, nextOrObserver?: types.StorageObserver<UploadTaskSnapshotCompat> | null | ((a: UploadTaskSnapshotCompat) => unknown), error?: ((error: StorageError) => void) | null, completed?: () => void | null): Unsubscribe | Subscribe<UploadTaskSnapshotCompat>;
33
+ }
34
+ /**
35
+ * Subscribes to an event stream.
36
+ */
37
+ export type Subscribe<T> = (next?: NextFn<T> | StorageObserver<T>, error?: ErrorFn, complete?: CompleteFn) => Unsubscribe;
38
+ /**
39
+ * Unsubscribes from a stream.
40
+ */
41
+ export type Unsubscribe = () => void;
42
+ /**
43
+ * Function that is called once for each value in a stream of values.
44
+ */
45
+ export type NextFn<T> = (value: T) => void;
46
+ /**
47
+ * A function that is called with a `FirebaseStorageError`
48
+ * if the event stream ends due to an error.
49
+ */
50
+ export type ErrorFn = (error: StorageError) => void;
51
+ /**
52
+ * A function that is called if the event stream ends normally.
53
+ */
54
+ export type CompleteFn = () => void;
@@ -0,0 +1,31 @@
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 { UploadTaskSnapshot } from '@firebase/storage';
18
+ import { ReferenceCompat } from './reference';
19
+ import { UploadTaskCompat } from './task';
20
+ import * as types from '@firebase/storage-types';
21
+ import { Compat } from '@firebase/util';
22
+ export declare class UploadTaskSnapshotCompat implements types.UploadTaskSnapshot, Compat<UploadTaskSnapshot> {
23
+ readonly _delegate: UploadTaskSnapshot;
24
+ readonly task: UploadTaskCompat;
25
+ readonly ref: ReferenceCompat;
26
+ constructor(_delegate: UploadTaskSnapshot, task: UploadTaskCompat, ref: ReferenceCompat);
27
+ get bytesTransferred(): number;
28
+ get metadata(): types.FullMetadata;
29
+ get state(): string;
30
+ get totalBytes(): number;
31
+ }
@@ -0,0 +1,23 @@
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 '@firebase/auth-compat';
18
+ import * as storage from '@firebase/storage-types';
19
+ import '../../src/index';
20
+ export declare const PROJECT_ID: any;
21
+ export declare const STORAGE_BUCKET: any;
22
+ export declare const API_KEY: any;
23
+ export declare function withTestInstance(fn: (storage: storage.FirebaseStorage) => void | Promise<void>): Promise<void>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2019 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
+ export {};
@@ -0,0 +1,22 @@
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 '../setup';
18
+ import '../../src/index';
19
+ export declare const PROJECT_ID: any;
20
+ export declare const STORAGE_BUCKET: any;
21
+ export declare const API_KEY: any;
22
+ export declare const AUTH_DOMAIN: any;
@@ -0,0 +1,17 @@
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 '../setup';
@@ -0,0 +1,17 @@
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 '../setup';
@@ -0,0 +1,22 @@
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 { FirebaseApp } from '@firebase/app-types';
18
+ import { FirebaseStorage } from '@firebase/storage';
19
+ import { StorageServiceCompat } from '../src/service';
20
+ export declare function makeTestCompatStorage(app: FirebaseApp, storage: FirebaseStorage): StorageServiceCompat;
21
+ export declare const fakeApp: FirebaseApp;
22
+ export declare const fakeStorage: FirebaseStorage;