Skip to content

Commit 556a4d3

Browse files
committed
Start fixing up annotations and generate API report
1 parent 765c410 commit 556a4d3

File tree

15 files changed

+123
-42
lines changed

15 files changed

+123
-42
lines changed

common/api-review/storage.api.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## API Report File for "@firebase/storage"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
import { FirebaseApp } from '@firebase/app-types';
8+
import { FirebaseAuthInternalName } from '@firebase/auth-interop-types';
9+
import { FirebaseError } from '@firebase/util';
10+
import { _FirebaseService } from '@firebase/app-types';
11+
import { Provider } from '@firebase/component';
12+
import * as types from '@firebase/storage-types';
13+
14+
// Warning: (ae-forgotten-export) The symbol "Reference" needs to be exported by the entry point index.d.ts
15+
//
16+
// @public
17+
export function deleteObject(ref: Reference): Promise<void>;
18+
19+
// @public
20+
export function getDownloadURL(ref: Reference): Promise<string>;
21+
22+
// Warning: (ae-forgotten-export) The symbol "Metadata" needs to be exported by the entry point index.d.ts
23+
//
24+
// @public
25+
export function getMetadata(ref: Reference): Promise<Metadata>;
26+
27+
// Warning: (ae-forgotten-export) The symbol "ListOptions" needs to be exported by the entry point index.d.ts
28+
// Warning: (ae-forgotten-export) The symbol "ListResult" needs to be exported by the entry point index.d.ts
29+
//
30+
// @public
31+
export function list(ref: Reference, options?: ListOptions | null): Promise<ListResult>;
32+
33+
// @public
34+
export function listAll(ref: Reference): Promise<ListResult>;
35+
36+
// Warning: (ae-forgotten-export) The symbol "StorageService" needs to be exported by the entry point index.d.ts
37+
//
38+
// @public
39+
export function ref(storage: StorageService, url?: string): Reference;
40+
41+
// @public
42+
export function ref(storageOrRef: StorageService | Reference, path?: string): Reference;
43+
44+
// @public
45+
export function updateMetadata(ref: Reference, metadata: Metadata): Promise<Metadata>;
46+
47+
// Warning: (ae-forgotten-export) The symbol "UploadTask" needs to be exported by the entry point index.d.ts
48+
//
49+
// @public
50+
export function uploadBytesResumable(ref: Reference, data: Blob | Uint8Array | ArrayBuffer, metadata?: Metadata | null): UploadTask;
51+
52+
// Warning: (ae-forgotten-export) The symbol "StringFormat" needs to be exported by the entry point index.d.ts
53+
//
54+
// @public
55+
export function uploadString(ref: Reference, value: string, format?: StringFormat, metadata?: Metadata): UploadTask;
56+
57+
58+
// (No @packageDocumentation comment for this package)
59+
60+
```

packages/storage/exp/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@firebase/storage/exp",
33
"description": "A tree-shakeable version of the Storage SDK",
4-
"main": "../dist/exp/index.browser.cjs.js",
5-
"module": "../dist/exp/index.browser.esm2017.js",
6-
"browser": "../dist/exp/index.browser.esm2017.js",
7-
"typings": "./dist/exp/index.d.ts",
4+
"main": "./dist/index.browser.cjs.js",
5+
"module": "./dist/index.browser.esm2017.js",
6+
"browser": "./dist/index.browser.esm2017.js",
7+
"typings": "./dist/index.d.ts",
88
"private": true,
99
"dependencies": {
1010
"@firebase/app-exp": "0.0.800"

packages/storage/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"module": "dist/index.esm.js",
88
"esm2017": "dist/index.esm2017.js",
99
"files": [
10-
"dist"
10+
"dist",
11+
"exp/dist"
1112
],
1213
"scripts": {
1314
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",

packages/storage/src/implementation/blob.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { StringFormat, dataFromString } from './string';
2525
import * as type from './type';
2626

2727
/**
28-
* @param opt_elideCopy If true, doesn't copy mutable input data
28+
* @param opt_elideCopy - If true, doesn't copy mutable input data
2929
* (e.g. Uint8Arrays). Pass true only if you know the objects will not be
3030
* modified after this blob's construction.
3131
*/

packages/storage/src/implementation/error.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ export class FirebaseStorageError extends FirebaseError {
5353

5454
export const errors = {};
5555

56-
/**
57-
* @enum {string}
58-
*/
5956
export type Code = string;
6057
export const Code = {
6158
// Shared between all platforms
@@ -288,7 +285,7 @@ export function appDeleted(): FirebaseStorageError {
288285
}
289286

290287
/**
291-
* @param name The name of the operation that was invalid.
288+
* @param name - The name of the operation that was invalid.
292289
*/
293290
export function invalidRootOperation(name: string): FirebaseStorageError {
294291
return new FirebaseStorageError(
@@ -301,8 +298,8 @@ export function invalidRootOperation(name: string): FirebaseStorageError {
301298
}
302299

303300
/**
304-
* @param format The format that was not valid.
305-
* @param message A message describing the format violation.
301+
* @param format - The format that was not valid.
302+
* @param message - A message describing the format violation.
306303
*/
307304
export function invalidFormat(
308305
format: string,
@@ -315,7 +312,7 @@ export function invalidFormat(
315312
}
316313

317314
/**
318-
* @param message A message describing the internal error.
315+
* @param message - A message describing the internal error.
319316
*/
320317
export function internalError(message: string): FirebaseStorageError {
321318
throw new FirebaseStorageError(

packages/storage/src/implementation/location.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@
1919
* @fileoverview Functionality related to the parsing/composition of bucket/
2020
* object location.
2121
*/
22+
2223
import { invalidDefaultBucket, invalidUrl } from './error';
2324
import { DEFAULT_HOST } from './constants';
2425

26+
/**
27+
* @public
28+
*/
2529
export class Location {
2630
private path_: string;
2731

packages/storage/src/implementation/request.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export interface Request<T> {
4343
* appropriate value (if the request is finished before you call this method,
4444
* but the promise has not yet been resolved), so don't just assume it will be
4545
* rejected if you call this function.
46-
* @param appDelete True if the cancelation came from the app being deleted.
46+
* @param appDelete - True if the cancelation came from the app being deleted.
4747
*/
4848
cancel(appDelete?: boolean): void;
4949
}
@@ -157,7 +157,7 @@ class NetworkRequest<T> implements Request<T> {
157157
}
158158

159159
/**
160-
* @param requestWentThrough True if the request eventually went
160+
* @param requestWentThrough - True if the request eventually went
161161
* through, false if it hit the retry limit or was canceled.
162162
*/
163163
function backoffDone(
@@ -241,7 +241,7 @@ class NetworkRequest<T> implements Request<T> {
241241

242242
/**
243243
* A collection of information about the result of a network request.
244-
* @param opt_canceled Defaults to false.
244+
* @param opt_canceled - Defaults to false.
245245
*/
246246
export class RequestEndStatus {
247247
/**

packages/storage/src/implementation/string.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import { unknown, invalidFormat } from './error';
1919

2020
/**
21-
* @enum {string}
21+
* An enumeration of the possible string formats for upload.
2222
*/
2323
export type StringFormat = string;
2424
export const StringFormat = {
@@ -28,6 +28,9 @@ export const StringFormat = {
2828
DATA_URL: 'data_url'
2929
};
3030

31+
/**
32+
* @internal
33+
*/
3134
export class StringData {
3235
contentType: string | null;
3336

packages/storage/src/implementation/taskenums.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
/**
2323
* Enum for task events.
24-
* @enum {string}
2524
*/
2625
export type TaskEvent = string;
2726
export const TaskEvent = {
@@ -31,7 +30,6 @@ export const TaskEvent = {
3130

3231
/**
3332
* Internal enum for task state.
34-
* @enum {string}
3533
*/
3634
export type InternalTaskState = string;
3735
export const InternalTaskState = {
@@ -46,7 +44,6 @@ export const InternalTaskState = {
4644

4745
/**
4846
* External (API-surfaced) enum for task state.
49-
* @enum {string}
5047
*/
5148
export type TaskState = string;
5249
export const TaskState = {

packages/storage/src/implementation/xhrio.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
* goog.net.XhrIo-like interface.
2121
*/
2222

23+
/**
24+
* XHR headers
25+
*/
2326
export interface Headers {
2427
[name: string]: string | number;
2528
}
@@ -50,9 +53,6 @@ export interface XhrIo {
5053
removeUploadProgressListener(listener: (p1: ProgressEvent) => void): void;
5154
}
5255

53-
/**
54-
* @enum{number}
55-
*/
5656
export enum ErrorCode {
5757
NO_ERROR = 0,
5858
NETWORK_ERROR = 1,

packages/storage/src/list.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@ import { Reference } from './reference';
2121
/**
2222
* @fileoverview Documentation for ListOptions and ListResult format.
2323
*/
24+
25+
/**
26+
* The options `list()` accepts.
27+
*/
2428
export interface ListOptions extends types.ListOptions {}
2529

30+
/**
31+
* Result returned by list().
32+
*/
2633
export interface ListResult {
2734
prefixes: Reference[];
2835
items: Reference[];

packages/storage/src/metadata.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import { Reference } from './reference';
2121
/**
2222
* @fileoverview Documentation for the metadata format.
2323
*/
24+
25+
/**
26+
* The full set of object metadata, including read-only properties.
27+
*/
2428
interface Metadata extends types.FullMetadata {
2529
type: string | undefined;
2630
md5Hash: string | undefined;

packages/storage/src/reference.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
/**
1919
* @fileoverview Defines the Firebase Storage Reference class.
2020
*/
21+
2122
import { FbsBlob } from './implementation/blob';
2223
import { Location } from './implementation/location';
2324
import { getMappings } from './implementation/metadata';
@@ -296,7 +297,7 @@ export async function getMetadata(ref: Reference): Promise<Metadata> {
296297
* setting a value to null will remove the metadata.
297298
* @returns A promise that resolves
298299
* with the new metadata for this object.
299-
* @see firebaseStorage.Reference.prototype.getMetadata
300+
* See `firebaseStorage.Reference.prototype.getMetadata`
300301
*/
301302
export async function updateMetadata(
302303
ref: Reference,

packages/storage/src/service.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,25 @@ function refFromPath(
7979
}
8080
}
8181

82+
/**
83+
* Returns a storage Reference for the given url.
84+
* @param storage - `Storage` instance.
85+
* @param url - URL. If empty, returns root reference.
86+
* @public
87+
*/
8288
export function ref(storage: StorageService, url?: string): Reference;
83-
export function ref(
84-
storageOrRef: StorageService | Reference,
85-
path?: string
86-
): Reference;
8789
/**
88-
* Returns a storage Reference for the given url, or given path in the
90+
* Returns a storage Reference for the given path in the
8991
* default bucket.
90-
* @param serviceOrRef - `Storage` instance or storage `Reference`.
91-
* @param pathOrUrlStorage - path, or URL. If empty, returns root reference (if Storage
92+
* @param storageOrRef - `Storage` service or storage `Reference`.
93+
* @param pathOrUrlStorage - path. If empty, returns root reference (if Storage
9294
* instance provided) or returns same reference (if Reference provided).
95+
* @public
9396
*/
97+
export function ref(
98+
storageOrRef: StorageService | Reference,
99+
path?: string
100+
): Reference;
94101
export function ref(
95102
serviceOrRef: StorageService | Reference,
96103
pathOrUrl?: string
@@ -118,7 +125,7 @@ function extractBucket(config?: FirebaseOptions): Location | null {
118125

119126
/**
120127
* A service that provides Firebase Storage Reference instances.
121-
* @param opt_url gs:// url to a custom Storage Bucket
128+
* @param opt_url - gs:// url to a custom Storage Bucket
122129
*/
123130
export class StorageService implements _FirebaseService {
124131
/**
@@ -216,8 +223,8 @@ export class StorageService implements _FirebaseService {
216223

217224
/**
218225
* @internal
219-
* @param requestInfo
220-
* @param authToken
226+
* @param requestInfo - HTTP RequestInfo object
227+
* @param authToken - Firebase auth token
221228
*/
222229
makeRequest<T>(
223230
requestInfo: RequestInfo<T>,

packages/storage/src/task.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ export class UploadTask {
8181
private _promise: Promise<UploadTaskSnapshot>;
8282

8383
/**
84-
* @param ref The firebaseStorage.Reference object this task came
84+
* @param ref - The firebaseStorage.Reference object this task came
8585
* from, untyped to avoid cyclic dependencies.
86-
* @param blob The blob to upload.
86+
* @param blob - The blob to upload.
8787
*/
8888
constructor(ref: Reference, blob: FbsBlob, metadata: Metadata | null = null) {
8989
this._ref = ref;
@@ -443,7 +443,7 @@ export class UploadTask {
443443

444444
/**
445445
* Adds a callback for an event.
446-
* @param type The type of event to listen for.
446+
* @param type - The type of event to listen for.
447447
*/
448448
on(
449449
type: TaskEvent,
@@ -463,8 +463,8 @@ export class UploadTask {
463463
/**
464464
* This object behaves like a Promise, and resolves with its snapshot data
465465
* when the upload completes.
466-
* @param onFulfilled The fulfillment callback. Promise chaining works as normal.
467-
* @param onRejected The rejection callback.
466+
* @param onFulfilled - The fulfillment callback. Promise chaining works as normal.
467+
* @param onRejected - The rejection callback.
468468
*/
469469
then<U>(
470470
onFulfilled?: ((value: UploadTaskSnapshot) => U | Promise<U>) | null,
@@ -570,7 +570,7 @@ export class UploadTask {
570570

571571
/**
572572
* Resumes a paused task. Has no effect on a currently running or failed task.
573-
* @return True if the operation took effect, false if ignored.
573+
* @returns True if the operation took effect, false if ignored.
574574
*/
575575
resume(): boolean {
576576
const valid =
@@ -584,7 +584,7 @@ export class UploadTask {
584584

585585
/**
586586
* Pauses a currently running task. Has no effect on a paused or failed task.
587-
* @return True if the operation took effect, false if ignored.
587+
* @returns True if the operation took effect, false if ignored.
588588
*/
589589
pause(): boolean {
590590
const valid = this._state === InternalTaskState.RUNNING;
@@ -597,7 +597,7 @@ export class UploadTask {
597597
/**
598598
* Cancels a currently running or paused task. Has no effect on a complete or
599599
* failed task.
600-
* @return True if the operation took effect, false if ignored.
600+
* @returns True if the operation took effect, false if ignored.
601601
*/
602602
cancel(): boolean {
603603
const valid =

0 commit comments

Comments
 (0)