Skip to content

Commit 2941f2f

Browse files
authored
fix(cloud-rad): move comments for TSDoc (#896)
As we move our ref docs to cloud.google.com, we rely on TSDoc rather JSDoc. TSDoc expects comments before the first overloaded function, we currently have those on the last function. Those comments don't make it into the d.ts files. We need to move comments to the first overloaded function rather than the last one. Internally b/190631834 Script used: https://github.com/fhinkel/cloud-rad-script/blob/main/moveComments.js
1 parent 9c9913f commit 2941f2f

File tree

5 files changed

+100
-100
lines changed

5 files changed

+100
-100
lines changed

src/index-class.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ export class Index {
7878
this.id = id.split('/').pop()!;
7979
}
8080

81-
get(gaxOptions?: CallOptions): Promise<GetIndexResponse>;
82-
get(callback: GetIndexCallback): void;
83-
get(gaxOptions: CallOptions, callback: GetIndexCallback): void;
8481
/**
8582
* Get an index if it exists.
8683
*
@@ -91,6 +88,9 @@ export class Index {
9188
* @param {Index} callback.index The Index instance.
9289
* @param {object} callback.apiResponse The full API response.
9390
*/
91+
get(gaxOptions?: CallOptions): Promise<GetIndexResponse>;
92+
get(callback: GetIndexCallback): void;
93+
get(gaxOptions: CallOptions, callback: GetIndexCallback): void;
9494
get(
9595
gaxOptionsOrCallback?: CallOptions | GetIndexCallback,
9696
cb?: GetIndexCallback
@@ -105,12 +105,6 @@ export class Index {
105105
});
106106
}
107107

108-
getMetadata(gaxOptions?: CallOptions): Promise<IndexGetMetadataResponse>;
109-
getMetadata(callback: IndexGetMetadataCallback): void;
110-
getMetadata(
111-
gaxOptions: CallOptions,
112-
callback: IndexGetMetadataCallback
113-
): void;
114108
/**
115109
* Get the metadata of this index.
116110
*
@@ -120,6 +114,12 @@ export class Index {
120114
* @param {?error} callback.err An error returned while making this request.
121115
* @param {object} callback.metadata The metadata.
122116
*/
117+
getMetadata(gaxOptions?: CallOptions): Promise<IndexGetMetadataResponse>;
118+
getMetadata(callback: IndexGetMetadataCallback): void;
119+
getMetadata(
120+
gaxOptions: CallOptions,
121+
callback: IndexGetMetadataCallback
122+
): void;
123123
getMetadata(
124124
gaxOptionsOrCallback?: CallOptions | IndexGetMetadataCallback,
125125
cb?: IndexGetMetadataCallback

src/index.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,6 @@ class Datastore extends DatastoreRequest {
509509
this.auth = new GoogleAuth(this.options);
510510
}
511511

512-
export(config: ExportEntitiesConfig): Promise<LongRunningResponse>;
513-
export(config: ExportEntitiesConfig, callback: LongRunningCallback): void;
514512
/**
515513
* Export entities from this project to a Google Cloud Storage bucket.
516514
*
@@ -527,6 +525,8 @@ class Datastore extends DatastoreRequest {
527525
* @param {Operation} callback.operation An operation object that can be used
528526
* to check the status of the request.
529527
*/
528+
export(config: ExportEntitiesConfig): Promise<LongRunningResponse>;
529+
export(config: ExportEntitiesConfig, callback: LongRunningCallback): void;
530530
export(
531531
config: ExportEntitiesConfig,
532532
callback?: LongRunningCallback
@@ -581,9 +581,6 @@ class Datastore extends DatastoreRequest {
581581
);
582582
}
583583

584-
getIndexes(options?: GetIndexesOptions): Promise<GetIndexesResponse>;
585-
getIndexes(options: GetIndexesOptions, callback: GetIndexesCallback): void;
586-
getIndexes(callback: GetIndexesCallback): void;
587584
/**
588585
* Get all of the indexes in this project.
589586
*
@@ -597,6 +594,9 @@ class Datastore extends DatastoreRequest {
597594
* @param {object} callback.apiResponse The full API response.
598595
* @return {void | Promise<GetIndexesResponse>}
599596
*/
597+
getIndexes(options?: GetIndexesOptions): Promise<GetIndexesResponse>;
598+
getIndexes(options: GetIndexesOptions, callback: GetIndexesCallback): void;
599+
getIndexes(callback: GetIndexesCallback): void;
600600
getIndexes(
601601
optionsOrCallback?: GetIndexesOptions | GetIndexesCallback,
602602
cb?: GetIndexesCallback
@@ -687,8 +687,6 @@ class Datastore extends DatastoreRequest {
687687
return this.auth.getProjectId();
688688
}
689689

690-
import(config: ImportEntitiesConfig): Promise<LongRunningResponse>;
691-
import(config: ImportEntitiesConfig, callback: LongRunningCallback): void;
692690
/**
693691
* Import entities into this project from a remote file.
694692
*
@@ -705,6 +703,8 @@ class Datastore extends DatastoreRequest {
705703
* @param {Operation} callback.operation An operation object that can be used
706704
* to check the status of the request.
707705
*/
706+
import(config: ImportEntitiesConfig): Promise<LongRunningResponse>;
707+
import(config: ImportEntitiesConfig, callback: LongRunningCallback): void;
708708
import(
709709
config: ImportEntitiesConfig,
710710
callback?: LongRunningCallback
@@ -769,8 +769,6 @@ class Datastore extends DatastoreRequest {
769769
return new Index(this, id);
770770
}
771771

772-
insert(entities: Entities): Promise<InsertResponse>;
773-
insert(entities: Entities, callback: InsertCallback): void;
774772
/**
775773
* Maps to {@link Datastore#save}, forcing the method to be `insert`.
776774
*
@@ -785,6 +783,8 @@ class Datastore extends DatastoreRequest {
785783
* @param {?error} callback.err An error returned while making this request
786784
* @param {object} callback.apiResponse The full API response.
787785
*/
786+
insert(entities: Entities): Promise<InsertResponse>;
787+
insert(entities: Entities, callback: InsertCallback): void;
788788
insert(
789789
entities: Entities,
790790
callback?: InsertCallback
@@ -799,13 +799,6 @@ class Datastore extends DatastoreRequest {
799799
this.save(entities, callback!);
800800
}
801801

802-
save(entities: Entities, gaxOptions?: CallOptions): Promise<SaveResponse>;
803-
save(
804-
entities: Entities,
805-
gaxOptions: CallOptions,
806-
callback: SaveCallback
807-
): void;
808-
save(entities: Entities, callback: SaveCallback): void;
809802
/**
810803
* Insert or update the specified object(s). If a key is incomplete, its
811804
* associated object is inserted and the original Key object is updated to
@@ -1041,6 +1034,13 @@ class Datastore extends DatastoreRequest {
10411034
* });
10421035
* ```
10431036
*/
1037+
save(entities: Entities, gaxOptions?: CallOptions): Promise<SaveResponse>;
1038+
save(
1039+
entities: Entities,
1040+
gaxOptions: CallOptions,
1041+
callback: SaveCallback
1042+
): void;
1043+
save(entities: Entities, callback: SaveCallback): void;
10441044
save(
10451045
entities: Entities,
10461046
gaxOptionsOrCallback?: CallOptions | SaveCallback,
@@ -1178,8 +1178,6 @@ class Datastore extends DatastoreRequest {
11781178
);
11791179
}
11801180

1181-
update(entities: Entities): Promise<UpdateResponse>;
1182-
update(entities: Entities, callback: UpdateCallback): void;
11831181
/**
11841182
* Maps to {@link Datastore#save}, forcing the method to be `update`.
11851183
*
@@ -1194,6 +1192,8 @@ class Datastore extends DatastoreRequest {
11941192
* @param {?error} callback.err An error returned while making this request
11951193
* @param {object} callback.apiResponse The full API response.
11961194
*/
1195+
update(entities: Entities): Promise<UpdateResponse>;
1196+
update(entities: Entities, callback: UpdateCallback): void;
11971197
update(
11981198
entities: Entities,
11991199
callback?: UpdateCallback
@@ -1208,8 +1208,6 @@ class Datastore extends DatastoreRequest {
12081208
this.save(entities, callback!);
12091209
}
12101210

1211-
upsert(entities: Entities): Promise<UpsertResponse>;
1212-
upsert(entities: Entities, callback: UpsertCallback): void;
12131211
/**
12141212
* Maps to {@link Datastore#save}, forcing the method to be `upsert`.
12151213
*
@@ -1224,6 +1222,8 @@ class Datastore extends DatastoreRequest {
12241222
* @param {?error} callback.err An error returned while making this request
12251223
* @param {object} callback.apiResponse The full API response.
12261224
*/
1225+
upsert(entities: Entities): Promise<UpsertResponse>;
1226+
upsert(entities: Entities, callback: UpsertCallback): void;
12271227
upsert(
12281228
entities: Entities,
12291229
callback?: UpsertCallback
@@ -1450,10 +1450,6 @@ class Datastore extends DatastoreRequest {
14501450
static NO_MORE_RESULTS = 'NO_MORE_RESULTS';
14511451
NO_MORE_RESULTS = Datastore.NO_MORE_RESULTS;
14521452

1453-
createQuery(kind?: string): Query;
1454-
createQuery(kind?: string[]): Query;
1455-
createQuery(namespace: string, kind: string): Query;
1456-
createQuery(namespace: string, kind: string[]): Query;
14571453
/**
14581454
* Create a query for the specified kind. See {@link Query} for all
14591455
* of the available methods.
@@ -1472,6 +1468,10 @@ class Datastore extends DatastoreRequest {
14721468
* const query = datastore.createQuery('Company');
14731469
* ```
14741470
*/
1471+
createQuery(kind?: string): Query;
1472+
createQuery(kind?: string[]): Query;
1473+
createQuery(namespace: string, kind: string): Query;
1474+
createQuery(namespace: string, kind: string[]): Query;
14751475
createQuery(
14761476
namespaceOrKind?: string | string[],
14771477
kind?: string | string[]
@@ -1484,9 +1484,6 @@ class Datastore extends DatastoreRequest {
14841484
return new Query(this, namespace, arrify(kind) as string[]);
14851485
}
14861486

1487-
key(options: entity.KeyOptions): entity.Key;
1488-
key(path: PathType[]): entity.Key;
1489-
key(path: string): entity.Key;
14901487
/**
14911488
* Helper to create a Key object, scoped to the instance's namespace by
14921489
* default.
@@ -1567,6 +1564,9 @@ class Datastore extends DatastoreRequest {
15671564
* const key = datastore.key(['Company', 'Google', 'Employee']);
15681565
* ```
15691566
*/
1567+
key(options: entity.KeyOptions): entity.Key;
1568+
key(path: PathType[]): entity.Key;
1569+
key(path: string): entity.Key;
15701570
key(options: string | entity.KeyOptions | PathType[]): entity.Key {
15711571
const keyOptions = is.object(options)
15721572
? (options as entity.KeyOptions)
@@ -1598,16 +1598,6 @@ class Datastore extends DatastoreRequest {
15981598
return Datastore.isKey(value);
15991599
}
16001600

1601-
keyToLegacyUrlSafe(key: entity.Key, locationPrefix?: string): Promise<string>;
1602-
keyToLegacyUrlSafe(
1603-
key: entity.Key,
1604-
callback: KeyToLegacyUrlSafeCallback
1605-
): void;
1606-
keyToLegacyUrlSafe(
1607-
key: entity.Key,
1608-
locationPrefix: string,
1609-
callback: KeyToLegacyUrlSafeCallback
1610-
): void;
16111601
/**
16121602
* Helper to create a URL safe key.
16131603
*
@@ -1660,6 +1650,16 @@ class Datastore extends DatastoreRequest {
16601650
* });
16611651
* ```
16621652
*/
1653+
keyToLegacyUrlSafe(key: entity.Key, locationPrefix?: string): Promise<string>;
1654+
keyToLegacyUrlSafe(
1655+
key: entity.Key,
1656+
callback: KeyToLegacyUrlSafeCallback
1657+
): void;
1658+
keyToLegacyUrlSafe(
1659+
key: entity.Key,
1660+
locationPrefix: string,
1661+
callback: KeyToLegacyUrlSafeCallback
1662+
): void;
16631663
keyToLegacyUrlSafe(
16641664
key: entity.Key,
16651665
locationPrefixOrCallback?: string | KeyToLegacyUrlSafeCallback,

src/query.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ class Query {
152152
this.offsetVal = -1;
153153
}
154154

155-
filter(property: string, value: {}): Query;
156-
filter(property: string, operator: Operator, value: {}): Query;
157155
/**
158156
* Datastore allows querying on properties. Supported comparison operators
159157
* are `=`, `<`, `>`, `<=`, and `>=`. "Not equal" and `IN` operators are
@@ -194,6 +192,8 @@ class Query {
194192
* const keyQuery = query.filter('__key__', key);
195193
* ```
196194
*/
195+
filter(property: string, value: {}): Query;
196+
filter(property: string, operator: Operator, value: {}): Query;
197197
filter(property: string, operatorOrValue: Operator, value?: {}): Query {
198198
let operator = operatorOrValue as Operator;
199199
if (arguments.length === 2) {
@@ -407,9 +407,6 @@ class Query {
407407
return this;
408408
}
409409

410-
run(options?: RunQueryOptions): Promise<RunQueryResponse>;
411-
run(options: RunQueryOptions, callback: RunQueryCallback): void;
412-
run(callback: RunQueryCallback): void;
413410
/**
414411
* Run the query.
415412
*
@@ -475,6 +472,9 @@ class Query {
475472
* });
476473
* ```
477474
*/
475+
run(options?: RunQueryOptions): Promise<RunQueryResponse>;
476+
run(options: RunQueryOptions, callback: RunQueryCallback): void;
477+
run(callback: RunQueryCallback): void;
478478
run(
479479
optionsOrCallback?: RunQueryOptions | RunQueryCallback,
480480
cb?: RunQueryCallback

0 commit comments

Comments
 (0)