Skip to content

Commit bd3dac2

Browse files
committed
Prefix ref.location with _
1 parent 556a4d3 commit bd3dac2

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

packages/storage/compat/reference.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ export class ReferenceCompat implements types.Reference {
208208
}
209209

210210
private _throwIfRoot(name: string): void {
211-
if (this._delegate.location.path === '') {
211+
if (this._delegate._location.path === '') {
212212
throw invalidRootOperation(name);
213213
}
214214
}

packages/storage/src/reference.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ export class Reference {
5757
/**
5858
* @internal
5959
*/
60-
location: Location;
60+
_location: Location;
6161

6262
constructor(private _service: StorageService, location: string | Location) {
6363
if (location instanceof Location) {
64-
this.location = location;
64+
this._location = location;
6565
} else {
66-
this.location = Location.makeFromUrl(location);
66+
this._location = Location.makeFromUrl(location);
6767
}
6868
}
6969

@@ -73,7 +73,7 @@ export class Reference {
7373
* @override
7474
*/
7575
toString(): string {
76-
return 'gs://' + this.location.bucket + '/' + this.location.path;
76+
return 'gs://' + this._location.bucket + '/' + this._location.path;
7777
}
7878

7979
protected newRef(service: StorageService, location: Location): Reference {
@@ -85,37 +85,37 @@ export class Reference {
8585
* object's bucket.
8686
*/
8787
get root(): Reference {
88-
const location = new Location(this.location.bucket, '');
88+
const location = new Location(this._location.bucket, '');
8989
return this.newRef(this._service, location);
9090
}
9191

9292
get bucket(): string {
93-
return this.location.bucket;
93+
return this._location.bucket;
9494
}
9595

9696
get fullPath(): string {
97-
return this.location.path;
97+
return this._location.path;
9898
}
9999

100100
get name(): string {
101-
return lastComponent(this.location.path);
101+
return lastComponent(this._location.path);
102102
}
103103

104104
get storage(): StorageService {
105105
return this._service;
106106
}
107107

108108
get parent(): Reference | null {
109-
const newPath = parent(this.location.path);
109+
const newPath = parent(this._location.path);
110110
if (newPath === null) {
111111
return null;
112112
}
113-
const location = new Location(this.location.bucket, newPath);
113+
const location = new Location(this._location.bucket, newPath);
114114
return new Reference(this._service, location);
115115
}
116116

117117
_throwIfRoot(name: string): void {
118-
if (this.location.path === '') {
118+
if (this._location.path === '') {
119119
throw invalidRootOperation(name);
120120
}
121121
}
@@ -262,7 +262,7 @@ export async function list(
262262
const op = options || {};
263263
const requestInfo = requestsList(
264264
ref.storage,
265-
ref.location,
265+
ref._location,
266266
/*delimiter= */ '/',
267267
op.pageToken,
268268
op.maxResults
@@ -282,7 +282,7 @@ export async function getMetadata(ref: Reference): Promise<Metadata> {
282282
const authToken = await ref.storage.getAuthToken();
283283
const requestInfo = requestsGetMetadata(
284284
ref.storage,
285-
ref.location,
285+
ref._location,
286286
getMappings()
287287
);
288288
return ref.storage.makeRequest(requestInfo, authToken).getPromise();
@@ -307,7 +307,7 @@ export async function updateMetadata(
307307
const authToken = await ref.storage.getAuthToken();
308308
const requestInfo = requestsUpdateMetadata(
309309
ref.storage,
310-
ref.location,
310+
ref._location,
311311
metadata,
312312
getMappings()
313313
);
@@ -325,7 +325,7 @@ export async function getDownloadURL(ref: Reference): Promise<string> {
325325
const authToken = await ref.storage.getAuthToken();
326326
const requestInfo = requestsGetDownloadUrl(
327327
ref.storage,
328-
ref.location,
328+
ref._location,
329329
getMappings()
330330
);
331331
return ref.storage
@@ -348,7 +348,7 @@ export async function getDownloadURL(ref: Reference): Promise<string> {
348348
export async function deleteObject(ref: Reference): Promise<void> {
349349
ref._throwIfRoot('deleteObject');
350350
const authToken = await ref.storage.getAuthToken();
351-
const requestInfo = requestsDeleteObject(ref.storage, ref.location);
351+
const requestInfo = requestsDeleteObject(ref.storage, ref._location);
352352
return ref.storage.makeRequest(requestInfo, authToken).getPromise();
353353
}
354354

@@ -363,7 +363,7 @@ export async function deleteObject(ref: Reference): Promise<void> {
363363
* slashes.
364364
*/
365365
export function getChild(ref: Reference, childPath: string): Reference {
366-
const newPath = child(ref.location.path, childPath);
367-
const location = new Location(ref.location.bucket, newPath);
366+
const newPath = child(ref._location.path, childPath);
367+
const location = new Location(ref._location.bucket, newPath);
368368
return new Reference(ref.storage, location);
369369
}

packages/storage/src/task.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export class UploadTask {
184184
this._resolveToken(authToken => {
185185
const requestInfo = fbsRequests.createResumableUpload(
186186
this._ref.storage,
187-
this._ref.location,
187+
this._ref._location,
188188
this._mappings,
189189
this._blob,
190190
this._metadata
@@ -209,7 +209,7 @@ export class UploadTask {
209209
this._resolveToken(authToken => {
210210
const requestInfo = fbsRequests.getResumableUploadStatus(
211211
this._ref.storage,
212-
this._ref.location,
212+
this._ref._location,
213213
url,
214214
this._blob
215215
);
@@ -245,7 +245,7 @@ export class UploadTask {
245245
let requestInfo;
246246
try {
247247
requestInfo = fbsRequests.continueResumableUpload(
248-
this._ref.location,
248+
this._ref._location,
249249
this._ref.storage,
250250
url,
251251
this._blob,
@@ -294,7 +294,7 @@ export class UploadTask {
294294
this._resolveToken(authToken => {
295295
const requestInfo = fbsRequests.getMetadata(
296296
this._ref.storage,
297-
this._ref.location,
297+
this._ref._location,
298298
this._mappings
299299
);
300300
const metadataRequest = this._ref.storage.makeRequest(
@@ -314,7 +314,7 @@ export class UploadTask {
314314
this._resolveToken(authToken => {
315315
const requestInfo = fbsRequests.multipartUpload(
316316
this._ref.storage,
317-
this._ref.location,
317+
this._ref._location,
318318
this._mappings,
319319
this._blob,
320320
this._metadata

0 commit comments

Comments
 (0)