@databricks/sdk-postgres 0.1.0-dev.1 → 0.1.0-dev.3

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.
package/src/v1/client.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
2
 
3
3
  import {VERSION as AUTH_VERSION} from '@databricks/sdk-auth';
4
- import type {Call} from '@databricks/sdk-core/api';
5
- import {retryOn} from '@databricks/sdk-core/api';
6
4
  import {createDefault} from '@databricks/sdk-core/clientinfo';
7
5
  import type {Logger} from '@databricks/sdk-core/logger';
8
6
  import {NoOpLogger} from '@databricks/sdk-core/logger';
9
7
  import type {CallOptions} from '@databricks/sdk-options/call';
10
8
  import type {ClientOptions} from '@databricks/sdk-options/client';
9
+ import type {LroOptions} from '@databricks/sdk-options/lro';
11
10
  import type {HttpClient} from '@databricks/sdk-core/http';
12
11
  import {newHttpClient} from './transport';
13
12
  import {
@@ -16,6 +15,8 @@ import {
16
15
  executeHttpCall,
17
16
  marshalRequest,
18
17
  parseResponse,
18
+ executeWait,
19
+ StillRunningError,
19
20
  } from './utils';
20
21
  import pkgJson from '../../package.json' with {type: 'json'};
21
22
  import {z} from 'zod';
@@ -117,7 +118,7 @@ const PACKAGE_SEGMENT = {
117
118
  value: pkgJson.version,
118
119
  };
119
120
 
120
- export class Client {
121
+ export class PostgresClient {
121
122
  private readonly host: string;
122
123
  // Workspace ID used to route workspace-level calls on unified hosts (SPOG).
123
124
  // When set, workspace-level methods send X-Databricks-Org-Id on every
@@ -137,18 +138,16 @@ export class Client {
137
138
  this.host = options.host.replace(/\/$/, '');
138
139
  this.workspaceId = options.workspaceId;
139
140
  this.logger = options.logger ?? new NoOpLogger();
140
- let info = createDefault().with(PACKAGE_SEGMENT);
141
- if (options.credentials !== undefined) {
142
- info = info
143
- .with({key: 'sdk-js-auth', value: AUTH_VERSION})
144
- .with({key: 'auth', value: options.credentials.name()});
145
- }
141
+ const info = createDefault()
142
+ .with(PACKAGE_SEGMENT)
143
+ .with({key: 'sdk-js-auth', value: AUTH_VERSION})
144
+ .with({key: 'auth', value: options.credentials?.name() ?? 'default'});
146
145
  this.userAgent = info.toString();
147
146
  this.httpClient = newHttpClient(options);
148
147
  }
149
148
 
150
149
  /** Creates a new database branch in the project. */
151
- async createBranch(
150
+ private async createBranch(
152
151
  req: CreateBranchRequest,
153
152
  options?: CallOptions
154
153
  ): Promise<Operation> {
@@ -164,7 +163,7 @@ export class Client {
164
163
  const fullUrl = query !== '' ? `${url}?${query}` : url;
165
164
  const body = marshalRequest(req.branch, marshalBranchSchema);
166
165
  let resp: Operation | undefined;
167
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
166
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
168
167
  const headers = new Headers({'Content-Type': 'application/json'});
169
168
  if (this.workspaceId !== undefined) {
170
169
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -186,7 +185,7 @@ export class Client {
186
185
  };
187
186
  await executeCall(call, options);
188
187
  if (resp === undefined) {
189
- throw new Error('API call completed without a result.');
188
+ throw new Error('operation completed without a result.');
190
189
  }
191
190
  return resp;
192
191
  }
@@ -200,7 +199,7 @@ export class Client {
200
199
  }
201
200
 
202
201
  /** Register a Postgres database in the Unity Catalog. */
203
- async createCatalog(
202
+ private async createCatalog(
204
203
  req: CreateCatalogRequest,
205
204
  options?: CallOptions
206
205
  ): Promise<Operation> {
@@ -213,7 +212,7 @@ export class Client {
213
212
  const fullUrl = query !== '' ? `${url}?${query}` : url;
214
213
  const body = marshalRequest(req.catalog, marshalCatalogSchema);
215
214
  let resp: Operation | undefined;
216
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
215
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
217
216
  const headers = new Headers({'Content-Type': 'application/json'});
218
217
  if (this.workspaceId !== undefined) {
219
218
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -235,7 +234,7 @@ export class Client {
235
234
  };
236
235
  await executeCall(call, options);
237
236
  if (resp === undefined) {
238
- throw new Error('API call completed without a result.');
237
+ throw new Error('operation completed without a result.');
239
238
  }
240
239
  return resp;
241
240
  }
@@ -253,7 +252,7 @@ export class Client {
253
252
  *
254
253
  * Creates a database in the specified branch. A branch can have multiple databases.
255
254
  */
256
- async createDatabase(
255
+ private async createDatabase(
257
256
  req: CreateDatabaseRequest,
258
257
  options?: CallOptions
259
258
  ): Promise<Operation> {
@@ -266,7 +265,7 @@ export class Client {
266
265
  const fullUrl = query !== '' ? `${url}?${query}` : url;
267
266
  const body = marshalRequest(req.database, marshalDatabaseSchema);
268
267
  let resp: Operation | undefined;
269
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
268
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
270
269
  const headers = new Headers({'Content-Type': 'application/json'});
271
270
  if (this.workspaceId !== undefined) {
272
271
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -288,7 +287,7 @@ export class Client {
288
287
  };
289
288
  await executeCall(call, options);
290
289
  if (resp === undefined) {
291
- throw new Error('API call completed without a result.');
290
+ throw new Error('operation completed without a result.');
292
291
  }
293
292
  return resp;
294
293
  }
@@ -302,7 +301,7 @@ export class Client {
302
301
  }
303
302
 
304
303
  /** Creates a new compute endpoint in the branch. */
305
- async createEndpoint(
304
+ private async createEndpoint(
306
305
  req: CreateEndpointRequest,
307
306
  options?: CallOptions
308
307
  ): Promise<Operation> {
@@ -318,7 +317,7 @@ export class Client {
318
317
  const fullUrl = query !== '' ? `${url}?${query}` : url;
319
318
  const body = marshalRequest(req.endpoint, marshalEndpointSchema);
320
319
  let resp: Operation | undefined;
321
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
320
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
322
321
  const headers = new Headers({'Content-Type': 'application/json'});
323
322
  if (this.workspaceId !== undefined) {
324
323
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -340,7 +339,7 @@ export class Client {
340
339
  };
341
340
  await executeCall(call, options);
342
341
  if (resp === undefined) {
343
- throw new Error('API call completed without a result.');
342
+ throw new Error('operation completed without a result.');
344
343
  }
345
344
  return resp;
346
345
  }
@@ -354,7 +353,7 @@ export class Client {
354
353
  }
355
354
 
356
355
  /** Creates a new Lakebase Autoscaling Postgres database project, which contains branches and compute endpoints. */
357
- async createProject(
356
+ private async createProject(
358
357
  req: CreateProjectRequest,
359
358
  options?: CallOptions
360
359
  ): Promise<Operation> {
@@ -367,7 +366,7 @@ export class Client {
367
366
  const fullUrl = query !== '' ? `${url}?${query}` : url;
368
367
  const body = marshalRequest(req.project, marshalProjectSchema);
369
368
  let resp: Operation | undefined;
370
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
369
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
371
370
  const headers = new Headers({'Content-Type': 'application/json'});
372
371
  if (this.workspaceId !== undefined) {
373
372
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -389,7 +388,7 @@ export class Client {
389
388
  };
390
389
  await executeCall(call, options);
391
390
  if (resp === undefined) {
392
- throw new Error('API call completed without a result.');
391
+ throw new Error('operation completed without a result.');
393
392
  }
394
393
  return resp;
395
394
  }
@@ -403,7 +402,7 @@ export class Client {
403
402
  }
404
403
 
405
404
  /** Creates a new Postgres role in the branch. */
406
- async createRole(
405
+ private async createRole(
407
406
  req: CreateRoleRequest,
408
407
  options?: CallOptions
409
408
  ): Promise<Operation> {
@@ -416,7 +415,7 @@ export class Client {
416
415
  const fullUrl = query !== '' ? `${url}?${query}` : url;
417
416
  const body = marshalRequest(req.role, marshalRoleSchema);
418
417
  let resp: Operation | undefined;
419
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
418
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
420
419
  const headers = new Headers({'Content-Type': 'application/json'});
421
420
  if (this.workspaceId !== undefined) {
422
421
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -438,7 +437,7 @@ export class Client {
438
437
  };
439
438
  await executeCall(call, options);
440
439
  if (resp === undefined) {
441
- throw new Error('API call completed without a result.');
440
+ throw new Error('operation completed without a result.');
442
441
  }
443
442
  return resp;
444
443
  }
@@ -452,7 +451,7 @@ export class Client {
452
451
  }
453
452
 
454
453
  /** Create a Synced Table. */
455
- async createSyncedTable(
454
+ private async createSyncedTable(
456
455
  req: CreateSyncedTableRequest,
457
456
  options?: CallOptions
458
457
  ): Promise<Operation> {
@@ -465,7 +464,7 @@ export class Client {
465
464
  const fullUrl = query !== '' ? `${url}?${query}` : url;
466
465
  const body = marshalRequest(req.syncedTable, marshalSyncedTableSchema);
467
466
  let resp: Operation | undefined;
468
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
467
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
469
468
  const headers = new Headers({'Content-Type': 'application/json'});
470
469
  if (this.workspaceId !== undefined) {
471
470
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -487,7 +486,7 @@ export class Client {
487
486
  };
488
487
  await executeCall(call, options);
489
488
  if (resp === undefined) {
490
- throw new Error('API call completed without a result.');
489
+ throw new Error('operation completed without a result.');
491
490
  }
492
491
  return resp;
493
492
  }
@@ -501,7 +500,7 @@ export class Client {
501
500
  }
502
501
 
503
502
  /** Deletes the specified database branch. */
504
- async deleteBranch(
503
+ private async deleteBranch(
505
504
  req: DeleteBranchRequest,
506
505
  options?: CallOptions
507
506
  ): Promise<Operation> {
@@ -513,7 +512,7 @@ export class Client {
513
512
  const query = params.toString();
514
513
  const fullUrl = query !== '' ? `${url}?${query}` : url;
515
514
  let resp: Operation | undefined;
516
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
515
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
517
516
  const headers = new Headers();
518
517
  if (this.workspaceId !== undefined) {
519
518
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -529,7 +528,7 @@ export class Client {
529
528
  };
530
529
  await executeCall(call, options);
531
530
  if (resp === undefined) {
532
- throw new Error('API call completed without a result.');
531
+ throw new Error('operation completed without a result.');
533
532
  }
534
533
  return resp;
535
534
  }
@@ -543,13 +542,13 @@ export class Client {
543
542
  }
544
543
 
545
544
  /** Delete a Database Catalog. */
546
- async deleteCatalog(
545
+ private async deleteCatalog(
547
546
  req: DeleteCatalogRequest,
548
547
  options?: CallOptions
549
548
  ): Promise<Operation> {
550
549
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
551
550
  let resp: Operation | undefined;
552
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
551
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
553
552
  const headers = new Headers();
554
553
  if (this.workspaceId !== undefined) {
555
554
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -565,7 +564,7 @@ export class Client {
565
564
  };
566
565
  await executeCall(call, options);
567
566
  if (resp === undefined) {
568
- throw new Error('API call completed without a result.');
567
+ throw new Error('operation completed without a result.');
569
568
  }
570
569
  return resp;
571
570
  }
@@ -579,13 +578,13 @@ export class Client {
579
578
  }
580
579
 
581
580
  /** Delete a Database. */
582
- async deleteDatabase(
581
+ private async deleteDatabase(
583
582
  req: DeleteDatabaseRequest,
584
583
  options?: CallOptions
585
584
  ): Promise<Operation> {
586
585
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
587
586
  let resp: Operation | undefined;
588
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
587
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
589
588
  const headers = new Headers();
590
589
  if (this.workspaceId !== undefined) {
591
590
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -601,7 +600,7 @@ export class Client {
601
600
  };
602
601
  await executeCall(call, options);
603
602
  if (resp === undefined) {
604
- throw new Error('API call completed without a result.');
603
+ throw new Error('operation completed without a result.');
605
604
  }
606
605
  return resp;
607
606
  }
@@ -615,13 +614,13 @@ export class Client {
615
614
  }
616
615
 
617
616
  /** Deletes the specified compute endpoint. */
618
- async deleteEndpoint(
617
+ private async deleteEndpoint(
619
618
  req: DeleteEndpointRequest,
620
619
  options?: CallOptions
621
620
  ): Promise<Operation> {
622
621
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
623
622
  let resp: Operation | undefined;
624
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
623
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
625
624
  const headers = new Headers();
626
625
  if (this.workspaceId !== undefined) {
627
626
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -637,7 +636,7 @@ export class Client {
637
636
  };
638
637
  await executeCall(call, options);
639
638
  if (resp === undefined) {
640
- throw new Error('API call completed without a result.');
639
+ throw new Error('operation completed without a result.');
641
640
  }
642
641
  return resp;
643
642
  }
@@ -651,7 +650,7 @@ export class Client {
651
650
  }
652
651
 
653
652
  /** Deletes the specified database project. */
654
- async deleteProject(
653
+ private async deleteProject(
655
654
  req: DeleteProjectRequest,
656
655
  options?: CallOptions
657
656
  ): Promise<Operation> {
@@ -663,7 +662,7 @@ export class Client {
663
662
  const query = params.toString();
664
663
  const fullUrl = query !== '' ? `${url}?${query}` : url;
665
664
  let resp: Operation | undefined;
666
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
665
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
667
666
  const headers = new Headers();
668
667
  if (this.workspaceId !== undefined) {
669
668
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -679,7 +678,7 @@ export class Client {
679
678
  };
680
679
  await executeCall(call, options);
681
680
  if (resp === undefined) {
682
- throw new Error('API call completed without a result.');
681
+ throw new Error('operation completed without a result.');
683
682
  }
684
683
  return resp;
685
684
  }
@@ -693,7 +692,7 @@ export class Client {
693
692
  }
694
693
 
695
694
  /** Deletes the specified Postgres role. */
696
- async deleteRole(
695
+ private async deleteRole(
697
696
  req: DeleteRoleRequest,
698
697
  options?: CallOptions
699
698
  ): Promise<Operation> {
@@ -705,7 +704,7 @@ export class Client {
705
704
  const query = params.toString();
706
705
  const fullUrl = query !== '' ? `${url}?${query}` : url;
707
706
  let resp: Operation | undefined;
708
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
707
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
709
708
  const headers = new Headers();
710
709
  if (this.workspaceId !== undefined) {
711
710
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -721,7 +720,7 @@ export class Client {
721
720
  };
722
721
  await executeCall(call, options);
723
722
  if (resp === undefined) {
724
- throw new Error('API call completed without a result.');
723
+ throw new Error('operation completed without a result.');
725
724
  }
726
725
  return resp;
727
726
  }
@@ -735,13 +734,13 @@ export class Client {
735
734
  }
736
735
 
737
736
  /** Delete a Synced Table. */
738
- async deleteSyncedTable(
737
+ private async deleteSyncedTable(
739
738
  req: DeleteSyncedTableRequest,
740
739
  options?: CallOptions
741
740
  ): Promise<Operation> {
742
741
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
743
742
  let resp: Operation | undefined;
744
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
743
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
745
744
  const headers = new Headers();
746
745
  if (this.workspaceId !== undefined) {
747
746
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -757,7 +756,7 @@ export class Client {
757
756
  };
758
757
  await executeCall(call, options);
759
758
  if (resp === undefined) {
760
- throw new Error('API call completed without a result.');
759
+ throw new Error('operation completed without a result.');
761
760
  }
762
761
  return resp;
763
762
  }
@@ -781,7 +780,7 @@ export class Client {
781
780
  marshalGenerateDatabaseCredentialRequestSchema
782
781
  );
783
782
  let resp: DatabaseCredential | undefined;
784
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
783
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
785
784
  const headers = new Headers({'Content-Type': 'application/json'});
786
785
  if (this.workspaceId !== undefined) {
787
786
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -797,7 +796,7 @@ export class Client {
797
796
  };
798
797
  await executeCall(call, options);
799
798
  if (resp === undefined) {
800
- throw new Error('API call completed without a result.');
799
+ throw new Error('operation completed without a result.');
801
800
  }
802
801
  return resp;
803
802
  }
@@ -809,7 +808,7 @@ export class Client {
809
808
  ): Promise<Branch> {
810
809
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
811
810
  let resp: Branch | undefined;
812
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
811
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
813
812
  const headers = new Headers();
814
813
  if (this.workspaceId !== undefined) {
815
814
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -825,7 +824,7 @@ export class Client {
825
824
  };
826
825
  await executeCall(call, options);
827
826
  if (resp === undefined) {
828
- throw new Error('API call completed without a result.');
827
+ throw new Error('operation completed without a result.');
829
828
  }
830
829
  return resp;
831
830
  }
@@ -837,7 +836,7 @@ export class Client {
837
836
  ): Promise<Catalog> {
838
837
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
839
838
  let resp: Catalog | undefined;
840
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
839
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
841
840
  const headers = new Headers();
842
841
  if (this.workspaceId !== undefined) {
843
842
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -853,7 +852,7 @@ export class Client {
853
852
  };
854
853
  await executeCall(call, options);
855
854
  if (resp === undefined) {
856
- throw new Error('API call completed without a result.');
855
+ throw new Error('operation completed without a result.');
857
856
  }
858
857
  return resp;
859
858
  }
@@ -865,7 +864,7 @@ export class Client {
865
864
  ): Promise<Database> {
866
865
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
867
866
  let resp: Database | undefined;
868
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
867
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
869
868
  const headers = new Headers();
870
869
  if (this.workspaceId !== undefined) {
871
870
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -881,7 +880,7 @@ export class Client {
881
880
  };
882
881
  await executeCall(call, options);
883
882
  if (resp === undefined) {
884
- throw new Error('API call completed without a result.');
883
+ throw new Error('operation completed without a result.');
885
884
  }
886
885
  return resp;
887
886
  }
@@ -893,7 +892,7 @@ export class Client {
893
892
  ): Promise<Endpoint> {
894
893
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
895
894
  let resp: Endpoint | undefined;
896
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
895
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
897
896
  const headers = new Headers();
898
897
  if (this.workspaceId !== undefined) {
899
898
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -909,7 +908,7 @@ export class Client {
909
908
  };
910
909
  await executeCall(call, options);
911
910
  if (resp === undefined) {
912
- throw new Error('API call completed without a result.');
911
+ throw new Error('operation completed without a result.');
913
912
  }
914
913
  return resp;
915
914
  }
@@ -921,7 +920,7 @@ export class Client {
921
920
  ): Promise<Operation> {
922
921
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
923
922
  let resp: Operation | undefined;
924
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
923
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
925
924
  const headers = new Headers();
926
925
  if (this.workspaceId !== undefined) {
927
926
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -937,7 +936,7 @@ export class Client {
937
936
  };
938
937
  await executeCall(call, options);
939
938
  if (resp === undefined) {
940
- throw new Error('API call completed without a result.');
939
+ throw new Error('operation completed without a result.');
941
940
  }
942
941
  return resp;
943
942
  }
@@ -949,7 +948,7 @@ export class Client {
949
948
  ): Promise<Project> {
950
949
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
951
950
  let resp: Project | undefined;
952
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
951
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
953
952
  const headers = new Headers();
954
953
  if (this.workspaceId !== undefined) {
955
954
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -965,7 +964,7 @@ export class Client {
965
964
  };
966
965
  await executeCall(call, options);
967
966
  if (resp === undefined) {
968
- throw new Error('API call completed without a result.');
967
+ throw new Error('operation completed without a result.');
969
968
  }
970
969
  return resp;
971
970
  }
@@ -974,7 +973,7 @@ export class Client {
974
973
  async getRole(req: GetRoleRequest, options?: CallOptions): Promise<Role> {
975
974
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
976
975
  let resp: Role | undefined;
977
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
976
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
978
977
  const headers = new Headers();
979
978
  if (this.workspaceId !== undefined) {
980
979
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -990,7 +989,7 @@ export class Client {
990
989
  };
991
990
  await executeCall(call, options);
992
991
  if (resp === undefined) {
993
- throw new Error('API call completed without a result.');
992
+ throw new Error('operation completed without a result.');
994
993
  }
995
994
  return resp;
996
995
  }
@@ -1002,7 +1001,7 @@ export class Client {
1002
1001
  ): Promise<SyncedTable> {
1003
1002
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}`;
1004
1003
  let resp: SyncedTable | undefined;
1005
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1004
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1006
1005
  const headers = new Headers();
1007
1006
  if (this.workspaceId !== undefined) {
1008
1007
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1018,7 +1017,7 @@ export class Client {
1018
1017
  };
1019
1018
  await executeCall(call, options);
1020
1019
  if (resp === undefined) {
1021
- throw new Error('API call completed without a result.');
1020
+ throw new Error('operation completed without a result.');
1022
1021
  }
1023
1022
  return resp;
1024
1023
  }
@@ -1042,7 +1041,7 @@ export class Client {
1042
1041
  const query = params.toString();
1043
1042
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1044
1043
  let resp: ListBranchesResponse | undefined;
1045
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1044
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1046
1045
  const headers = new Headers();
1047
1046
  if (this.workspaceId !== undefined) {
1048
1047
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1058,7 +1057,7 @@ export class Client {
1058
1057
  };
1059
1058
  await executeCall(call, options);
1060
1059
  if (resp === undefined) {
1061
- throw new Error('API call completed without a result.');
1060
+ throw new Error('operation completed without a result.');
1062
1061
  }
1063
1062
  return resp;
1064
1063
  }
@@ -1096,7 +1095,7 @@ export class Client {
1096
1095
  const query = params.toString();
1097
1096
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1098
1097
  let resp: ListDatabasesResponse | undefined;
1099
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1098
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1100
1099
  const headers = new Headers();
1101
1100
  if (this.workspaceId !== undefined) {
1102
1101
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1112,7 +1111,7 @@ export class Client {
1112
1111
  };
1113
1112
  await executeCall(call, options);
1114
1113
  if (resp === undefined) {
1115
- throw new Error('API call completed without a result.');
1114
+ throw new Error('operation completed without a result.');
1116
1115
  }
1117
1116
  return resp;
1118
1117
  }
@@ -1150,7 +1149,7 @@ export class Client {
1150
1149
  const query = params.toString();
1151
1150
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1152
1151
  let resp: ListEndpointsResponse | undefined;
1153
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1152
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1154
1153
  const headers = new Headers();
1155
1154
  if (this.workspaceId !== undefined) {
1156
1155
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1166,7 +1165,7 @@ export class Client {
1166
1165
  };
1167
1166
  await executeCall(call, options);
1168
1167
  if (resp === undefined) {
1169
- throw new Error('API call completed without a result.');
1168
+ throw new Error('operation completed without a result.');
1170
1169
  }
1171
1170
  return resp;
1172
1171
  }
@@ -1207,7 +1206,7 @@ export class Client {
1207
1206
  const query = params.toString();
1208
1207
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1209
1208
  let resp: ListProjectsResponse | undefined;
1210
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1209
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1211
1210
  const headers = new Headers();
1212
1211
  if (this.workspaceId !== undefined) {
1213
1212
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1223,7 +1222,7 @@ export class Client {
1223
1222
  };
1224
1223
  await executeCall(call, options);
1225
1224
  if (resp === undefined) {
1226
- throw new Error('API call completed without a result.');
1225
+ throw new Error('operation completed without a result.');
1227
1226
  }
1228
1227
  return resp;
1229
1228
  }
@@ -1261,7 +1260,7 @@ export class Client {
1261
1260
  const query = params.toString();
1262
1261
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1263
1262
  let resp: ListRolesResponse | undefined;
1264
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1263
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1265
1264
  const headers = new Headers();
1266
1265
  if (this.workspaceId !== undefined) {
1267
1266
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1277,7 +1276,7 @@ export class Client {
1277
1276
  };
1278
1277
  await executeCall(call, options);
1279
1278
  if (resp === undefined) {
1280
- throw new Error('API call completed without a result.');
1279
+ throw new Error('operation completed without a result.');
1281
1280
  }
1282
1281
  return resp;
1283
1282
  }
@@ -1300,14 +1299,14 @@ export class Client {
1300
1299
  }
1301
1300
 
1302
1301
  /** Undeletes the specified database branch. */
1303
- async undeleteBranch(
1302
+ private async undeleteBranch(
1304
1303
  req: UndeleteBranchRequest,
1305
1304
  options?: CallOptions
1306
1305
  ): Promise<Operation> {
1307
1306
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
1308
1307
  const body = marshalRequest(req, marshalUndeleteBranchRequestSchema);
1309
1308
  let resp: Operation | undefined;
1310
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1309
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1311
1310
  const headers = new Headers({'Content-Type': 'application/json'});
1312
1311
  if (this.workspaceId !== undefined) {
1313
1312
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1323,7 +1322,7 @@ export class Client {
1323
1322
  };
1324
1323
  await executeCall(call, options);
1325
1324
  if (resp === undefined) {
1326
- throw new Error('API call completed without a result.');
1325
+ throw new Error('operation completed without a result.');
1327
1326
  }
1328
1327
  return resp;
1329
1328
  }
@@ -1337,14 +1336,14 @@ export class Client {
1337
1336
  }
1338
1337
 
1339
1338
  /** Undeletes a soft-deleted project. */
1340
- async undeleteProject(
1339
+ private async undeleteProject(
1341
1340
  req: UndeleteProjectRequest,
1342
1341
  options?: CallOptions
1343
1342
  ): Promise<Operation> {
1344
1343
  const url = `${this.host}/api/2.0/postgres/${req.name ?? ''}/undelete`;
1345
1344
  const body = marshalRequest(req, marshalUndeleteProjectRequestSchema);
1346
1345
  let resp: Operation | undefined;
1347
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1346
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1348
1347
  const headers = new Headers({'Content-Type': 'application/json'});
1349
1348
  if (this.workspaceId !== undefined) {
1350
1349
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1360,7 +1359,7 @@ export class Client {
1360
1359
  };
1361
1360
  await executeCall(call, options);
1362
1361
  if (resp === undefined) {
1363
- throw new Error('API call completed without a result.');
1362
+ throw new Error('operation completed without a result.');
1364
1363
  }
1365
1364
  return resp;
1366
1365
  }
@@ -1374,7 +1373,7 @@ export class Client {
1374
1373
  }
1375
1374
 
1376
1375
  /** Updates the specified database branch. You can set this branch as the project's default branch, or protect/unprotect it. */
1377
- async updateBranch(
1376
+ private async updateBranch(
1378
1377
  req: UpdateBranchRequest,
1379
1378
  options?: CallOptions
1380
1379
  ): Promise<Operation> {
@@ -1387,7 +1386,7 @@ export class Client {
1387
1386
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1388
1387
  const body = marshalRequest(req.branch, marshalBranchSchema);
1389
1388
  let resp: Operation | undefined;
1390
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1389
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1391
1390
  const headers = new Headers({'Content-Type': 'application/json'});
1392
1391
  if (this.workspaceId !== undefined) {
1393
1392
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1409,7 +1408,7 @@ export class Client {
1409
1408
  };
1410
1409
  await executeCall(call, options);
1411
1410
  if (resp === undefined) {
1412
- throw new Error('API call completed without a result.');
1411
+ throw new Error('operation completed without a result.');
1413
1412
  }
1414
1413
  return resp;
1415
1414
  }
@@ -1423,7 +1422,7 @@ export class Client {
1423
1422
  }
1424
1423
 
1425
1424
  /** Update a Database. */
1426
- async updateDatabase(
1425
+ private async updateDatabase(
1427
1426
  req: UpdateDatabaseRequest,
1428
1427
  options?: CallOptions
1429
1428
  ): Promise<Operation> {
@@ -1436,7 +1435,7 @@ export class Client {
1436
1435
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1437
1436
  const body = marshalRequest(req.database, marshalDatabaseSchema);
1438
1437
  let resp: Operation | undefined;
1439
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1438
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1440
1439
  const headers = new Headers({'Content-Type': 'application/json'});
1441
1440
  if (this.workspaceId !== undefined) {
1442
1441
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1458,7 +1457,7 @@ export class Client {
1458
1457
  };
1459
1458
  await executeCall(call, options);
1460
1459
  if (resp === undefined) {
1461
- throw new Error('API call completed without a result.');
1460
+ throw new Error('operation completed without a result.');
1462
1461
  }
1463
1462
  return resp;
1464
1463
  }
@@ -1472,7 +1471,7 @@ export class Client {
1472
1471
  }
1473
1472
 
1474
1473
  /** Updates the specified compute endpoint. You can update autoscaling limits, suspend timeout, or enable/disable the compute endpoint. */
1475
- async updateEndpoint(
1474
+ private async updateEndpoint(
1476
1475
  req: UpdateEndpointRequest,
1477
1476
  options?: CallOptions
1478
1477
  ): Promise<Operation> {
@@ -1485,7 +1484,7 @@ export class Client {
1485
1484
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1486
1485
  const body = marshalRequest(req.endpoint, marshalEndpointSchema);
1487
1486
  let resp: Operation | undefined;
1488
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1487
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1489
1488
  const headers = new Headers({'Content-Type': 'application/json'});
1490
1489
  if (this.workspaceId !== undefined) {
1491
1490
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1507,7 +1506,7 @@ export class Client {
1507
1506
  };
1508
1507
  await executeCall(call, options);
1509
1508
  if (resp === undefined) {
1510
- throw new Error('API call completed without a result.');
1509
+ throw new Error('operation completed without a result.');
1511
1510
  }
1512
1511
  return resp;
1513
1512
  }
@@ -1521,7 +1520,7 @@ export class Client {
1521
1520
  }
1522
1521
 
1523
1522
  /** Updates the specified database project. */
1524
- async updateProject(
1523
+ private async updateProject(
1525
1524
  req: UpdateProjectRequest,
1526
1525
  options?: CallOptions
1527
1526
  ): Promise<Operation> {
@@ -1534,7 +1533,7 @@ export class Client {
1534
1533
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1535
1534
  const body = marshalRequest(req.project, marshalProjectSchema);
1536
1535
  let resp: Operation | undefined;
1537
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1536
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1538
1537
  const headers = new Headers({'Content-Type': 'application/json'});
1539
1538
  if (this.workspaceId !== undefined) {
1540
1539
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1556,7 +1555,7 @@ export class Client {
1556
1555
  };
1557
1556
  await executeCall(call, options);
1558
1557
  if (resp === undefined) {
1559
- throw new Error('API call completed without a result.');
1558
+ throw new Error('operation completed without a result.');
1560
1559
  }
1561
1560
  return resp;
1562
1561
  }
@@ -1570,7 +1569,7 @@ export class Client {
1570
1569
  }
1571
1570
 
1572
1571
  /** Update a role for a branch. */
1573
- async updateRole(
1572
+ private async updateRole(
1574
1573
  req: UpdateRoleRequest,
1575
1574
  options?: CallOptions
1576
1575
  ): Promise<Operation> {
@@ -1583,7 +1582,7 @@ export class Client {
1583
1582
  const fullUrl = query !== '' ? `${url}?${query}` : url;
1584
1583
  const body = marshalRequest(req.role, marshalRoleSchema);
1585
1584
  let resp: Operation | undefined;
1586
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1585
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1587
1586
  const headers = new Headers({'Content-Type': 'application/json'});
1588
1587
  if (this.workspaceId !== undefined) {
1589
1588
  headers.set('X-Databricks-Org-Id', this.workspaceId);
@@ -1605,7 +1604,7 @@ export class Client {
1605
1604
  };
1606
1605
  await executeCall(call, options);
1607
1606
  if (resp === undefined) {
1608
- throw new Error('API call completed without a result.');
1607
+ throw new Error('operation completed without a result.');
1609
1608
  }
1610
1609
  return resp;
1611
1610
  }
@@ -1621,7 +1620,7 @@ export class Client {
1621
1620
 
1622
1621
  export class CreateBranchOperation {
1623
1622
  constructor(
1624
- private readonly client: Client,
1623
+ private readonly client: PostgresClient,
1625
1624
  private operation: Operation
1626
1625
  ) {}
1627
1626
 
@@ -1647,23 +1646,22 @@ export class CreateBranchOperation {
1647
1646
  *
1648
1647
  * Throws if the operation failed.
1649
1648
  */
1650
- async wait(options?: CallOptions): Promise<Branch> {
1651
- const errStillRunning = new Error('operation still in progress');
1649
+ async wait(options?: LroOptions): Promise<Branch> {
1652
1650
  let result: Branch | undefined;
1653
1651
 
1654
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1652
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1655
1653
  const op = await this.client.getOperation(
1656
1654
  {
1657
1655
  name: this.operation.name,
1658
1656
  },
1659
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
1657
+ callSignal !== undefined ? {signal: callSignal} : undefined
1660
1658
  );
1661
1659
  this.operation = op;
1662
1660
  if (op.done === undefined) {
1663
1661
  throw new Error('operation is missing the done field');
1664
1662
  }
1665
1663
  if (!op.done) {
1666
- throw errStillRunning;
1664
+ throw new StillRunningError();
1667
1665
  }
1668
1666
 
1669
1667
  if (op.result?.$case === 'error') {
@@ -1686,16 +1684,9 @@ export class CreateBranchOperation {
1686
1684
  result = z.lazy(() => unmarshalBranchSchema).parse(op.result.response);
1687
1685
  };
1688
1686
 
1689
- const retryOptions: CallOptions = {
1690
- ...(options?.signal !== undefined && {signal: options.signal}),
1691
- retrier: () =>
1692
- retryOn({}, (err: Error) => {
1693
- return err.message.includes('operation still in progress');
1694
- }),
1695
- };
1696
- await executeCall(call, retryOptions);
1687
+ await executeWait(call, options);
1697
1688
  if (result === undefined) {
1698
- throw new Error('API call completed without a result.');
1689
+ throw new Error('operation completed without a result.');
1699
1690
  }
1700
1691
  return result;
1701
1692
  }
@@ -1713,7 +1704,7 @@ export class CreateBranchOperation {
1713
1704
 
1714
1705
  export class CreateCatalogOperation {
1715
1706
  constructor(
1716
- private readonly client: Client,
1707
+ private readonly client: PostgresClient,
1717
1708
  private operation: Operation
1718
1709
  ) {}
1719
1710
 
@@ -1739,23 +1730,22 @@ export class CreateCatalogOperation {
1739
1730
  *
1740
1731
  * Throws if the operation failed.
1741
1732
  */
1742
- async wait(options?: CallOptions): Promise<Catalog> {
1743
- const errStillRunning = new Error('operation still in progress');
1733
+ async wait(options?: LroOptions): Promise<Catalog> {
1744
1734
  let result: Catalog | undefined;
1745
1735
 
1746
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1736
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1747
1737
  const op = await this.client.getOperation(
1748
1738
  {
1749
1739
  name: this.operation.name,
1750
1740
  },
1751
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
1741
+ callSignal !== undefined ? {signal: callSignal} : undefined
1752
1742
  );
1753
1743
  this.operation = op;
1754
1744
  if (op.done === undefined) {
1755
1745
  throw new Error('operation is missing the done field');
1756
1746
  }
1757
1747
  if (!op.done) {
1758
- throw errStillRunning;
1748
+ throw new StillRunningError();
1759
1749
  }
1760
1750
 
1761
1751
  if (op.result?.$case === 'error') {
@@ -1778,16 +1768,9 @@ export class CreateCatalogOperation {
1778
1768
  result = z.lazy(() => unmarshalCatalogSchema).parse(op.result.response);
1779
1769
  };
1780
1770
 
1781
- const retryOptions: CallOptions = {
1782
- ...(options?.signal !== undefined && {signal: options.signal}),
1783
- retrier: () =>
1784
- retryOn({}, (err: Error) => {
1785
- return err.message.includes('operation still in progress');
1786
- }),
1787
- };
1788
- await executeCall(call, retryOptions);
1771
+ await executeWait(call, options);
1789
1772
  if (result === undefined) {
1790
- throw new Error('API call completed without a result.');
1773
+ throw new Error('operation completed without a result.');
1791
1774
  }
1792
1775
  return result;
1793
1776
  }
@@ -1805,7 +1788,7 @@ export class CreateCatalogOperation {
1805
1788
 
1806
1789
  export class CreateDatabaseOperation {
1807
1790
  constructor(
1808
- private readonly client: Client,
1791
+ private readonly client: PostgresClient,
1809
1792
  private operation: Operation
1810
1793
  ) {}
1811
1794
 
@@ -1831,23 +1814,22 @@ export class CreateDatabaseOperation {
1831
1814
  *
1832
1815
  * Throws if the operation failed.
1833
1816
  */
1834
- async wait(options?: CallOptions): Promise<Database> {
1835
- const errStillRunning = new Error('operation still in progress');
1817
+ async wait(options?: LroOptions): Promise<Database> {
1836
1818
  let result: Database | undefined;
1837
1819
 
1838
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1820
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1839
1821
  const op = await this.client.getOperation(
1840
1822
  {
1841
1823
  name: this.operation.name,
1842
1824
  },
1843
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
1825
+ callSignal !== undefined ? {signal: callSignal} : undefined
1844
1826
  );
1845
1827
  this.operation = op;
1846
1828
  if (op.done === undefined) {
1847
1829
  throw new Error('operation is missing the done field');
1848
1830
  }
1849
1831
  if (!op.done) {
1850
- throw errStillRunning;
1832
+ throw new StillRunningError();
1851
1833
  }
1852
1834
 
1853
1835
  if (op.result?.$case === 'error') {
@@ -1870,16 +1852,9 @@ export class CreateDatabaseOperation {
1870
1852
  result = z.lazy(() => unmarshalDatabaseSchema).parse(op.result.response);
1871
1853
  };
1872
1854
 
1873
- const retryOptions: CallOptions = {
1874
- ...(options?.signal !== undefined && {signal: options.signal}),
1875
- retrier: () =>
1876
- retryOn({}, (err: Error) => {
1877
- return err.message.includes('operation still in progress');
1878
- }),
1879
- };
1880
- await executeCall(call, retryOptions);
1855
+ await executeWait(call, options);
1881
1856
  if (result === undefined) {
1882
- throw new Error('API call completed without a result.');
1857
+ throw new Error('operation completed without a result.');
1883
1858
  }
1884
1859
  return result;
1885
1860
  }
@@ -1897,7 +1872,7 @@ export class CreateDatabaseOperation {
1897
1872
 
1898
1873
  export class CreateEndpointOperation {
1899
1874
  constructor(
1900
- private readonly client: Client,
1875
+ private readonly client: PostgresClient,
1901
1876
  private operation: Operation
1902
1877
  ) {}
1903
1878
 
@@ -1923,23 +1898,22 @@ export class CreateEndpointOperation {
1923
1898
  *
1924
1899
  * Throws if the operation failed.
1925
1900
  */
1926
- async wait(options?: CallOptions): Promise<Endpoint> {
1927
- const errStillRunning = new Error('operation still in progress');
1901
+ async wait(options?: LroOptions): Promise<Endpoint> {
1928
1902
  let result: Endpoint | undefined;
1929
1903
 
1930
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1904
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
1931
1905
  const op = await this.client.getOperation(
1932
1906
  {
1933
1907
  name: this.operation.name,
1934
1908
  },
1935
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
1909
+ callSignal !== undefined ? {signal: callSignal} : undefined
1936
1910
  );
1937
1911
  this.operation = op;
1938
1912
  if (op.done === undefined) {
1939
1913
  throw new Error('operation is missing the done field');
1940
1914
  }
1941
1915
  if (!op.done) {
1942
- throw errStillRunning;
1916
+ throw new StillRunningError();
1943
1917
  }
1944
1918
 
1945
1919
  if (op.result?.$case === 'error') {
@@ -1962,16 +1936,9 @@ export class CreateEndpointOperation {
1962
1936
  result = z.lazy(() => unmarshalEndpointSchema).parse(op.result.response);
1963
1937
  };
1964
1938
 
1965
- const retryOptions: CallOptions = {
1966
- ...(options?.signal !== undefined && {signal: options.signal}),
1967
- retrier: () =>
1968
- retryOn({}, (err: Error) => {
1969
- return err.message.includes('operation still in progress');
1970
- }),
1971
- };
1972
- await executeCall(call, retryOptions);
1939
+ await executeWait(call, options);
1973
1940
  if (result === undefined) {
1974
- throw new Error('API call completed without a result.');
1941
+ throw new Error('operation completed without a result.');
1975
1942
  }
1976
1943
  return result;
1977
1944
  }
@@ -1989,7 +1956,7 @@ export class CreateEndpointOperation {
1989
1956
 
1990
1957
  export class CreateProjectOperation {
1991
1958
  constructor(
1992
- private readonly client: Client,
1959
+ private readonly client: PostgresClient,
1993
1960
  private operation: Operation
1994
1961
  ) {}
1995
1962
 
@@ -2015,23 +1982,22 @@ export class CreateProjectOperation {
2015
1982
  *
2016
1983
  * Throws if the operation failed.
2017
1984
  */
2018
- async wait(options?: CallOptions): Promise<Project> {
2019
- const errStillRunning = new Error('operation still in progress');
1985
+ async wait(options?: LroOptions): Promise<Project> {
2020
1986
  let result: Project | undefined;
2021
1987
 
2022
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
1988
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2023
1989
  const op = await this.client.getOperation(
2024
1990
  {
2025
1991
  name: this.operation.name,
2026
1992
  },
2027
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
1993
+ callSignal !== undefined ? {signal: callSignal} : undefined
2028
1994
  );
2029
1995
  this.operation = op;
2030
1996
  if (op.done === undefined) {
2031
1997
  throw new Error('operation is missing the done field');
2032
1998
  }
2033
1999
  if (!op.done) {
2034
- throw errStillRunning;
2000
+ throw new StillRunningError();
2035
2001
  }
2036
2002
 
2037
2003
  if (op.result?.$case === 'error') {
@@ -2054,16 +2020,9 @@ export class CreateProjectOperation {
2054
2020
  result = z.lazy(() => unmarshalProjectSchema).parse(op.result.response);
2055
2021
  };
2056
2022
 
2057
- const retryOptions: CallOptions = {
2058
- ...(options?.signal !== undefined && {signal: options.signal}),
2059
- retrier: () =>
2060
- retryOn({}, (err: Error) => {
2061
- return err.message.includes('operation still in progress');
2062
- }),
2063
- };
2064
- await executeCall(call, retryOptions);
2023
+ await executeWait(call, options);
2065
2024
  if (result === undefined) {
2066
- throw new Error('API call completed without a result.');
2025
+ throw new Error('operation completed without a result.');
2067
2026
  }
2068
2027
  return result;
2069
2028
  }
@@ -2081,7 +2040,7 @@ export class CreateProjectOperation {
2081
2040
 
2082
2041
  export class CreateRoleOperation {
2083
2042
  constructor(
2084
- private readonly client: Client,
2043
+ private readonly client: PostgresClient,
2085
2044
  private operation: Operation
2086
2045
  ) {}
2087
2046
 
@@ -2107,23 +2066,22 @@ export class CreateRoleOperation {
2107
2066
  *
2108
2067
  * Throws if the operation failed.
2109
2068
  */
2110
- async wait(options?: CallOptions): Promise<Role> {
2111
- const errStillRunning = new Error('operation still in progress');
2069
+ async wait(options?: LroOptions): Promise<Role> {
2112
2070
  let result: Role | undefined;
2113
2071
 
2114
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2072
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2115
2073
  const op = await this.client.getOperation(
2116
2074
  {
2117
2075
  name: this.operation.name,
2118
2076
  },
2119
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2077
+ callSignal !== undefined ? {signal: callSignal} : undefined
2120
2078
  );
2121
2079
  this.operation = op;
2122
2080
  if (op.done === undefined) {
2123
2081
  throw new Error('operation is missing the done field');
2124
2082
  }
2125
2083
  if (!op.done) {
2126
- throw errStillRunning;
2084
+ throw new StillRunningError();
2127
2085
  }
2128
2086
 
2129
2087
  if (op.result?.$case === 'error') {
@@ -2146,16 +2104,9 @@ export class CreateRoleOperation {
2146
2104
  result = z.lazy(() => unmarshalRoleSchema).parse(op.result.response);
2147
2105
  };
2148
2106
 
2149
- const retryOptions: CallOptions = {
2150
- ...(options?.signal !== undefined && {signal: options.signal}),
2151
- retrier: () =>
2152
- retryOn({}, (err: Error) => {
2153
- return err.message.includes('operation still in progress');
2154
- }),
2155
- };
2156
- await executeCall(call, retryOptions);
2107
+ await executeWait(call, options);
2157
2108
  if (result === undefined) {
2158
- throw new Error('API call completed without a result.');
2109
+ throw new Error('operation completed without a result.');
2159
2110
  }
2160
2111
  return result;
2161
2112
  }
@@ -2173,7 +2124,7 @@ export class CreateRoleOperation {
2173
2124
 
2174
2125
  export class CreateSyncedTableOperation {
2175
2126
  constructor(
2176
- private readonly client: Client,
2127
+ private readonly client: PostgresClient,
2177
2128
  private operation: Operation
2178
2129
  ) {}
2179
2130
 
@@ -2199,23 +2150,22 @@ export class CreateSyncedTableOperation {
2199
2150
  *
2200
2151
  * Throws if the operation failed.
2201
2152
  */
2202
- async wait(options?: CallOptions): Promise<SyncedTable> {
2203
- const errStillRunning = new Error('operation still in progress');
2153
+ async wait(options?: LroOptions): Promise<SyncedTable> {
2204
2154
  let result: SyncedTable | undefined;
2205
2155
 
2206
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2156
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2207
2157
  const op = await this.client.getOperation(
2208
2158
  {
2209
2159
  name: this.operation.name,
2210
2160
  },
2211
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2161
+ callSignal !== undefined ? {signal: callSignal} : undefined
2212
2162
  );
2213
2163
  this.operation = op;
2214
2164
  if (op.done === undefined) {
2215
2165
  throw new Error('operation is missing the done field');
2216
2166
  }
2217
2167
  if (!op.done) {
2218
- throw errStillRunning;
2168
+ throw new StillRunningError();
2219
2169
  }
2220
2170
 
2221
2171
  if (op.result?.$case === 'error') {
@@ -2240,16 +2190,9 @@ export class CreateSyncedTableOperation {
2240
2190
  .parse(op.result.response);
2241
2191
  };
2242
2192
 
2243
- const retryOptions: CallOptions = {
2244
- ...(options?.signal !== undefined && {signal: options.signal}),
2245
- retrier: () =>
2246
- retryOn({}, (err: Error) => {
2247
- return err.message.includes('operation still in progress');
2248
- }),
2249
- };
2250
- await executeCall(call, retryOptions);
2193
+ await executeWait(call, options);
2251
2194
  if (result === undefined) {
2252
- throw new Error('API call completed without a result.');
2195
+ throw new Error('operation completed without a result.');
2253
2196
  }
2254
2197
  return result;
2255
2198
  }
@@ -2267,7 +2210,7 @@ export class CreateSyncedTableOperation {
2267
2210
 
2268
2211
  export class DeleteBranchOperation {
2269
2212
  constructor(
2270
- private readonly client: Client,
2213
+ private readonly client: PostgresClient,
2271
2214
  private operation: Operation
2272
2215
  ) {}
2273
2216
 
@@ -2293,22 +2236,20 @@ export class DeleteBranchOperation {
2293
2236
  *
2294
2237
  * Throws if the operation failed.
2295
2238
  */
2296
- async wait(options?: CallOptions): Promise<void> {
2297
- const errStillRunning = new Error('operation still in progress');
2298
-
2299
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2239
+ async wait(options?: LroOptions): Promise<void> {
2240
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2300
2241
  const op = await this.client.getOperation(
2301
2242
  {
2302
2243
  name: this.operation.name,
2303
2244
  },
2304
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2245
+ callSignal !== undefined ? {signal: callSignal} : undefined
2305
2246
  );
2306
2247
  this.operation = op;
2307
2248
  if (op.done === undefined) {
2308
2249
  throw new Error('operation is missing the done field');
2309
2250
  }
2310
2251
  if (!op.done) {
2311
- throw errStillRunning;
2252
+ throw new StillRunningError();
2312
2253
  }
2313
2254
 
2314
2255
  if (op.result?.$case === 'error') {
@@ -2325,14 +2266,7 @@ export class DeleteBranchOperation {
2325
2266
  }
2326
2267
  };
2327
2268
 
2328
- const retryOptions: CallOptions = {
2329
- ...(options?.signal !== undefined && {signal: options.signal}),
2330
- retrier: () =>
2331
- retryOn({}, (err: Error) => {
2332
- return err.message.includes('operation still in progress');
2333
- }),
2334
- };
2335
- await executeCall(call, retryOptions);
2269
+ await executeWait(call, options);
2336
2270
  }
2337
2271
 
2338
2272
  /** Checks whether the operation has completed */
@@ -2348,7 +2282,7 @@ export class DeleteBranchOperation {
2348
2282
 
2349
2283
  export class DeleteCatalogOperation {
2350
2284
  constructor(
2351
- private readonly client: Client,
2285
+ private readonly client: PostgresClient,
2352
2286
  private operation: Operation
2353
2287
  ) {}
2354
2288
 
@@ -2374,22 +2308,20 @@ export class DeleteCatalogOperation {
2374
2308
  *
2375
2309
  * Throws if the operation failed.
2376
2310
  */
2377
- async wait(options?: CallOptions): Promise<void> {
2378
- const errStillRunning = new Error('operation still in progress');
2379
-
2380
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2311
+ async wait(options?: LroOptions): Promise<void> {
2312
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2381
2313
  const op = await this.client.getOperation(
2382
2314
  {
2383
2315
  name: this.operation.name,
2384
2316
  },
2385
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2317
+ callSignal !== undefined ? {signal: callSignal} : undefined
2386
2318
  );
2387
2319
  this.operation = op;
2388
2320
  if (op.done === undefined) {
2389
2321
  throw new Error('operation is missing the done field');
2390
2322
  }
2391
2323
  if (!op.done) {
2392
- throw errStillRunning;
2324
+ throw new StillRunningError();
2393
2325
  }
2394
2326
 
2395
2327
  if (op.result?.$case === 'error') {
@@ -2406,14 +2338,7 @@ export class DeleteCatalogOperation {
2406
2338
  }
2407
2339
  };
2408
2340
 
2409
- const retryOptions: CallOptions = {
2410
- ...(options?.signal !== undefined && {signal: options.signal}),
2411
- retrier: () =>
2412
- retryOn({}, (err: Error) => {
2413
- return err.message.includes('operation still in progress');
2414
- }),
2415
- };
2416
- await executeCall(call, retryOptions);
2341
+ await executeWait(call, options);
2417
2342
  }
2418
2343
 
2419
2344
  /** Checks whether the operation has completed */
@@ -2429,7 +2354,7 @@ export class DeleteCatalogOperation {
2429
2354
 
2430
2355
  export class DeleteDatabaseOperation {
2431
2356
  constructor(
2432
- private readonly client: Client,
2357
+ private readonly client: PostgresClient,
2433
2358
  private operation: Operation
2434
2359
  ) {}
2435
2360
 
@@ -2455,22 +2380,20 @@ export class DeleteDatabaseOperation {
2455
2380
  *
2456
2381
  * Throws if the operation failed.
2457
2382
  */
2458
- async wait(options?: CallOptions): Promise<void> {
2459
- const errStillRunning = new Error('operation still in progress');
2460
-
2461
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2383
+ async wait(options?: LroOptions): Promise<void> {
2384
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2462
2385
  const op = await this.client.getOperation(
2463
2386
  {
2464
2387
  name: this.operation.name,
2465
2388
  },
2466
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2389
+ callSignal !== undefined ? {signal: callSignal} : undefined
2467
2390
  );
2468
2391
  this.operation = op;
2469
2392
  if (op.done === undefined) {
2470
2393
  throw new Error('operation is missing the done field');
2471
2394
  }
2472
2395
  if (!op.done) {
2473
- throw errStillRunning;
2396
+ throw new StillRunningError();
2474
2397
  }
2475
2398
 
2476
2399
  if (op.result?.$case === 'error') {
@@ -2487,14 +2410,7 @@ export class DeleteDatabaseOperation {
2487
2410
  }
2488
2411
  };
2489
2412
 
2490
- const retryOptions: CallOptions = {
2491
- ...(options?.signal !== undefined && {signal: options.signal}),
2492
- retrier: () =>
2493
- retryOn({}, (err: Error) => {
2494
- return err.message.includes('operation still in progress');
2495
- }),
2496
- };
2497
- await executeCall(call, retryOptions);
2413
+ await executeWait(call, options);
2498
2414
  }
2499
2415
 
2500
2416
  /** Checks whether the operation has completed */
@@ -2510,7 +2426,7 @@ export class DeleteDatabaseOperation {
2510
2426
 
2511
2427
  export class DeleteEndpointOperation {
2512
2428
  constructor(
2513
- private readonly client: Client,
2429
+ private readonly client: PostgresClient,
2514
2430
  private operation: Operation
2515
2431
  ) {}
2516
2432
 
@@ -2536,22 +2452,20 @@ export class DeleteEndpointOperation {
2536
2452
  *
2537
2453
  * Throws if the operation failed.
2538
2454
  */
2539
- async wait(options?: CallOptions): Promise<void> {
2540
- const errStillRunning = new Error('operation still in progress');
2541
-
2542
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2455
+ async wait(options?: LroOptions): Promise<void> {
2456
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2543
2457
  const op = await this.client.getOperation(
2544
2458
  {
2545
2459
  name: this.operation.name,
2546
2460
  },
2547
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2461
+ callSignal !== undefined ? {signal: callSignal} : undefined
2548
2462
  );
2549
2463
  this.operation = op;
2550
2464
  if (op.done === undefined) {
2551
2465
  throw new Error('operation is missing the done field');
2552
2466
  }
2553
2467
  if (!op.done) {
2554
- throw errStillRunning;
2468
+ throw new StillRunningError();
2555
2469
  }
2556
2470
 
2557
2471
  if (op.result?.$case === 'error') {
@@ -2568,14 +2482,7 @@ export class DeleteEndpointOperation {
2568
2482
  }
2569
2483
  };
2570
2484
 
2571
- const retryOptions: CallOptions = {
2572
- ...(options?.signal !== undefined && {signal: options.signal}),
2573
- retrier: () =>
2574
- retryOn({}, (err: Error) => {
2575
- return err.message.includes('operation still in progress');
2576
- }),
2577
- };
2578
- await executeCall(call, retryOptions);
2485
+ await executeWait(call, options);
2579
2486
  }
2580
2487
 
2581
2488
  /** Checks whether the operation has completed */
@@ -2591,7 +2498,7 @@ export class DeleteEndpointOperation {
2591
2498
 
2592
2499
  export class DeleteProjectOperation {
2593
2500
  constructor(
2594
- private readonly client: Client,
2501
+ private readonly client: PostgresClient,
2595
2502
  private operation: Operation
2596
2503
  ) {}
2597
2504
 
@@ -2617,22 +2524,20 @@ export class DeleteProjectOperation {
2617
2524
  *
2618
2525
  * Throws if the operation failed.
2619
2526
  */
2620
- async wait(options?: CallOptions): Promise<void> {
2621
- const errStillRunning = new Error('operation still in progress');
2622
-
2623
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2527
+ async wait(options?: LroOptions): Promise<void> {
2528
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2624
2529
  const op = await this.client.getOperation(
2625
2530
  {
2626
2531
  name: this.operation.name,
2627
2532
  },
2628
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2533
+ callSignal !== undefined ? {signal: callSignal} : undefined
2629
2534
  );
2630
2535
  this.operation = op;
2631
2536
  if (op.done === undefined) {
2632
2537
  throw new Error('operation is missing the done field');
2633
2538
  }
2634
2539
  if (!op.done) {
2635
- throw errStillRunning;
2540
+ throw new StillRunningError();
2636
2541
  }
2637
2542
 
2638
2543
  if (op.result?.$case === 'error') {
@@ -2649,14 +2554,7 @@ export class DeleteProjectOperation {
2649
2554
  }
2650
2555
  };
2651
2556
 
2652
- const retryOptions: CallOptions = {
2653
- ...(options?.signal !== undefined && {signal: options.signal}),
2654
- retrier: () =>
2655
- retryOn({}, (err: Error) => {
2656
- return err.message.includes('operation still in progress');
2657
- }),
2658
- };
2659
- await executeCall(call, retryOptions);
2557
+ await executeWait(call, options);
2660
2558
  }
2661
2559
 
2662
2560
  /** Checks whether the operation has completed */
@@ -2672,7 +2570,7 @@ export class DeleteProjectOperation {
2672
2570
 
2673
2571
  export class DeleteRoleOperation {
2674
2572
  constructor(
2675
- private readonly client: Client,
2573
+ private readonly client: PostgresClient,
2676
2574
  private operation: Operation
2677
2575
  ) {}
2678
2576
 
@@ -2698,22 +2596,20 @@ export class DeleteRoleOperation {
2698
2596
  *
2699
2597
  * Throws if the operation failed.
2700
2598
  */
2701
- async wait(options?: CallOptions): Promise<void> {
2702
- const errStillRunning = new Error('operation still in progress');
2703
-
2704
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2599
+ async wait(options?: LroOptions): Promise<void> {
2600
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2705
2601
  const op = await this.client.getOperation(
2706
2602
  {
2707
2603
  name: this.operation.name,
2708
2604
  },
2709
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2605
+ callSignal !== undefined ? {signal: callSignal} : undefined
2710
2606
  );
2711
2607
  this.operation = op;
2712
2608
  if (op.done === undefined) {
2713
2609
  throw new Error('operation is missing the done field');
2714
2610
  }
2715
2611
  if (!op.done) {
2716
- throw errStillRunning;
2612
+ throw new StillRunningError();
2717
2613
  }
2718
2614
 
2719
2615
  if (op.result?.$case === 'error') {
@@ -2730,14 +2626,7 @@ export class DeleteRoleOperation {
2730
2626
  }
2731
2627
  };
2732
2628
 
2733
- const retryOptions: CallOptions = {
2734
- ...(options?.signal !== undefined && {signal: options.signal}),
2735
- retrier: () =>
2736
- retryOn({}, (err: Error) => {
2737
- return err.message.includes('operation still in progress');
2738
- }),
2739
- };
2740
- await executeCall(call, retryOptions);
2629
+ await executeWait(call, options);
2741
2630
  }
2742
2631
 
2743
2632
  /** Checks whether the operation has completed */
@@ -2753,7 +2642,7 @@ export class DeleteRoleOperation {
2753
2642
 
2754
2643
  export class DeleteSyncedTableOperation {
2755
2644
  constructor(
2756
- private readonly client: Client,
2645
+ private readonly client: PostgresClient,
2757
2646
  private operation: Operation
2758
2647
  ) {}
2759
2648
 
@@ -2779,22 +2668,20 @@ export class DeleteSyncedTableOperation {
2779
2668
  *
2780
2669
  * Throws if the operation failed.
2781
2670
  */
2782
- async wait(options?: CallOptions): Promise<void> {
2783
- const errStillRunning = new Error('operation still in progress');
2784
-
2785
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2671
+ async wait(options?: LroOptions): Promise<void> {
2672
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2786
2673
  const op = await this.client.getOperation(
2787
2674
  {
2788
2675
  name: this.operation.name,
2789
2676
  },
2790
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2677
+ callSignal !== undefined ? {signal: callSignal} : undefined
2791
2678
  );
2792
2679
  this.operation = op;
2793
2680
  if (op.done === undefined) {
2794
2681
  throw new Error('operation is missing the done field');
2795
2682
  }
2796
2683
  if (!op.done) {
2797
- throw errStillRunning;
2684
+ throw new StillRunningError();
2798
2685
  }
2799
2686
 
2800
2687
  if (op.result?.$case === 'error') {
@@ -2811,14 +2698,7 @@ export class DeleteSyncedTableOperation {
2811
2698
  }
2812
2699
  };
2813
2700
 
2814
- const retryOptions: CallOptions = {
2815
- ...(options?.signal !== undefined && {signal: options.signal}),
2816
- retrier: () =>
2817
- retryOn({}, (err: Error) => {
2818
- return err.message.includes('operation still in progress');
2819
- }),
2820
- };
2821
- await executeCall(call, retryOptions);
2701
+ await executeWait(call, options);
2822
2702
  }
2823
2703
 
2824
2704
  /** Checks whether the operation has completed */
@@ -2834,7 +2714,7 @@ export class DeleteSyncedTableOperation {
2834
2714
 
2835
2715
  export class UndeleteBranchOperation {
2836
2716
  constructor(
2837
- private readonly client: Client,
2717
+ private readonly client: PostgresClient,
2838
2718
  private operation: Operation
2839
2719
  ) {}
2840
2720
 
@@ -2860,22 +2740,20 @@ export class UndeleteBranchOperation {
2860
2740
  *
2861
2741
  * Throws if the operation failed.
2862
2742
  */
2863
- async wait(options?: CallOptions): Promise<void> {
2864
- const errStillRunning = new Error('operation still in progress');
2865
-
2866
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2743
+ async wait(options?: LroOptions): Promise<void> {
2744
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2867
2745
  const op = await this.client.getOperation(
2868
2746
  {
2869
2747
  name: this.operation.name,
2870
2748
  },
2871
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2749
+ callSignal !== undefined ? {signal: callSignal} : undefined
2872
2750
  );
2873
2751
  this.operation = op;
2874
2752
  if (op.done === undefined) {
2875
2753
  throw new Error('operation is missing the done field');
2876
2754
  }
2877
2755
  if (!op.done) {
2878
- throw errStillRunning;
2756
+ throw new StillRunningError();
2879
2757
  }
2880
2758
 
2881
2759
  if (op.result?.$case === 'error') {
@@ -2892,14 +2770,7 @@ export class UndeleteBranchOperation {
2892
2770
  }
2893
2771
  };
2894
2772
 
2895
- const retryOptions: CallOptions = {
2896
- ...(options?.signal !== undefined && {signal: options.signal}),
2897
- retrier: () =>
2898
- retryOn({}, (err: Error) => {
2899
- return err.message.includes('operation still in progress');
2900
- }),
2901
- };
2902
- await executeCall(call, retryOptions);
2773
+ await executeWait(call, options);
2903
2774
  }
2904
2775
 
2905
2776
  /** Checks whether the operation has completed */
@@ -2915,7 +2786,7 @@ export class UndeleteBranchOperation {
2915
2786
 
2916
2787
  export class UndeleteProjectOperation {
2917
2788
  constructor(
2918
- private readonly client: Client,
2789
+ private readonly client: PostgresClient,
2919
2790
  private operation: Operation
2920
2791
  ) {}
2921
2792
 
@@ -2941,22 +2812,20 @@ export class UndeleteProjectOperation {
2941
2812
  *
2942
2813
  * Throws if the operation failed.
2943
2814
  */
2944
- async wait(options?: CallOptions): Promise<void> {
2945
- const errStillRunning = new Error('operation still in progress');
2946
-
2947
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2815
+ async wait(options?: LroOptions): Promise<void> {
2816
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
2948
2817
  const op = await this.client.getOperation(
2949
2818
  {
2950
2819
  name: this.operation.name,
2951
2820
  },
2952
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2821
+ callSignal !== undefined ? {signal: callSignal} : undefined
2953
2822
  );
2954
2823
  this.operation = op;
2955
2824
  if (op.done === undefined) {
2956
2825
  throw new Error('operation is missing the done field');
2957
2826
  }
2958
2827
  if (!op.done) {
2959
- throw errStillRunning;
2828
+ throw new StillRunningError();
2960
2829
  }
2961
2830
 
2962
2831
  if (op.result?.$case === 'error') {
@@ -2973,14 +2842,7 @@ export class UndeleteProjectOperation {
2973
2842
  }
2974
2843
  };
2975
2844
 
2976
- const retryOptions: CallOptions = {
2977
- ...(options?.signal !== undefined && {signal: options.signal}),
2978
- retrier: () =>
2979
- retryOn({}, (err: Error) => {
2980
- return err.message.includes('operation still in progress');
2981
- }),
2982
- };
2983
- await executeCall(call, retryOptions);
2845
+ await executeWait(call, options);
2984
2846
  }
2985
2847
 
2986
2848
  /** Checks whether the operation has completed */
@@ -2996,7 +2858,7 @@ export class UndeleteProjectOperation {
2996
2858
 
2997
2859
  export class UpdateBranchOperation {
2998
2860
  constructor(
2999
- private readonly client: Client,
2861
+ private readonly client: PostgresClient,
3000
2862
  private operation: Operation
3001
2863
  ) {}
3002
2864
 
@@ -3022,23 +2884,22 @@ export class UpdateBranchOperation {
3022
2884
  *
3023
2885
  * Throws if the operation failed.
3024
2886
  */
3025
- async wait(options?: CallOptions): Promise<Branch> {
3026
- const errStillRunning = new Error('operation still in progress');
2887
+ async wait(options?: LroOptions): Promise<Branch> {
3027
2888
  let result: Branch | undefined;
3028
2889
 
3029
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2890
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
3030
2891
  const op = await this.client.getOperation(
3031
2892
  {
3032
2893
  name: this.operation.name,
3033
2894
  },
3034
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2895
+ callSignal !== undefined ? {signal: callSignal} : undefined
3035
2896
  );
3036
2897
  this.operation = op;
3037
2898
  if (op.done === undefined) {
3038
2899
  throw new Error('operation is missing the done field');
3039
2900
  }
3040
2901
  if (!op.done) {
3041
- throw errStillRunning;
2902
+ throw new StillRunningError();
3042
2903
  }
3043
2904
 
3044
2905
  if (op.result?.$case === 'error') {
@@ -3061,16 +2922,9 @@ export class UpdateBranchOperation {
3061
2922
  result = z.lazy(() => unmarshalBranchSchema).parse(op.result.response);
3062
2923
  };
3063
2924
 
3064
- const retryOptions: CallOptions = {
3065
- ...(options?.signal !== undefined && {signal: options.signal}),
3066
- retrier: () =>
3067
- retryOn({}, (err: Error) => {
3068
- return err.message.includes('operation still in progress');
3069
- }),
3070
- };
3071
- await executeCall(call, retryOptions);
2925
+ await executeWait(call, options);
3072
2926
  if (result === undefined) {
3073
- throw new Error('API call completed without a result.');
2927
+ throw new Error('operation completed without a result.');
3074
2928
  }
3075
2929
  return result;
3076
2930
  }
@@ -3088,7 +2942,7 @@ export class UpdateBranchOperation {
3088
2942
 
3089
2943
  export class UpdateDatabaseOperation {
3090
2944
  constructor(
3091
- private readonly client: Client,
2945
+ private readonly client: PostgresClient,
3092
2946
  private operation: Operation
3093
2947
  ) {}
3094
2948
 
@@ -3114,23 +2968,22 @@ export class UpdateDatabaseOperation {
3114
2968
  *
3115
2969
  * Throws if the operation failed.
3116
2970
  */
3117
- async wait(options?: CallOptions): Promise<Database> {
3118
- const errStillRunning = new Error('operation still in progress');
2971
+ async wait(options?: LroOptions): Promise<Database> {
3119
2972
  let result: Database | undefined;
3120
2973
 
3121
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
2974
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
3122
2975
  const op = await this.client.getOperation(
3123
2976
  {
3124
2977
  name: this.operation.name,
3125
2978
  },
3126
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
2979
+ callSignal !== undefined ? {signal: callSignal} : undefined
3127
2980
  );
3128
2981
  this.operation = op;
3129
2982
  if (op.done === undefined) {
3130
2983
  throw new Error('operation is missing the done field');
3131
2984
  }
3132
2985
  if (!op.done) {
3133
- throw errStillRunning;
2986
+ throw new StillRunningError();
3134
2987
  }
3135
2988
 
3136
2989
  if (op.result?.$case === 'error') {
@@ -3153,16 +3006,9 @@ export class UpdateDatabaseOperation {
3153
3006
  result = z.lazy(() => unmarshalDatabaseSchema).parse(op.result.response);
3154
3007
  };
3155
3008
 
3156
- const retryOptions: CallOptions = {
3157
- ...(options?.signal !== undefined && {signal: options.signal}),
3158
- retrier: () =>
3159
- retryOn({}, (err: Error) => {
3160
- return err.message.includes('operation still in progress');
3161
- }),
3162
- };
3163
- await executeCall(call, retryOptions);
3009
+ await executeWait(call, options);
3164
3010
  if (result === undefined) {
3165
- throw new Error('API call completed without a result.');
3011
+ throw new Error('operation completed without a result.');
3166
3012
  }
3167
3013
  return result;
3168
3014
  }
@@ -3180,7 +3026,7 @@ export class UpdateDatabaseOperation {
3180
3026
 
3181
3027
  export class UpdateEndpointOperation {
3182
3028
  constructor(
3183
- private readonly client: Client,
3029
+ private readonly client: PostgresClient,
3184
3030
  private operation: Operation
3185
3031
  ) {}
3186
3032
 
@@ -3206,23 +3052,22 @@ export class UpdateEndpointOperation {
3206
3052
  *
3207
3053
  * Throws if the operation failed.
3208
3054
  */
3209
- async wait(options?: CallOptions): Promise<Endpoint> {
3210
- const errStillRunning = new Error('operation still in progress');
3055
+ async wait(options?: LroOptions): Promise<Endpoint> {
3211
3056
  let result: Endpoint | undefined;
3212
3057
 
3213
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
3058
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
3214
3059
  const op = await this.client.getOperation(
3215
3060
  {
3216
3061
  name: this.operation.name,
3217
3062
  },
3218
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
3063
+ callSignal !== undefined ? {signal: callSignal} : undefined
3219
3064
  );
3220
3065
  this.operation = op;
3221
3066
  if (op.done === undefined) {
3222
3067
  throw new Error('operation is missing the done field');
3223
3068
  }
3224
3069
  if (!op.done) {
3225
- throw errStillRunning;
3070
+ throw new StillRunningError();
3226
3071
  }
3227
3072
 
3228
3073
  if (op.result?.$case === 'error') {
@@ -3245,16 +3090,9 @@ export class UpdateEndpointOperation {
3245
3090
  result = z.lazy(() => unmarshalEndpointSchema).parse(op.result.response);
3246
3091
  };
3247
3092
 
3248
- const retryOptions: CallOptions = {
3249
- ...(options?.signal !== undefined && {signal: options.signal}),
3250
- retrier: () =>
3251
- retryOn({}, (err: Error) => {
3252
- return err.message.includes('operation still in progress');
3253
- }),
3254
- };
3255
- await executeCall(call, retryOptions);
3093
+ await executeWait(call, options);
3256
3094
  if (result === undefined) {
3257
- throw new Error('API call completed without a result.');
3095
+ throw new Error('operation completed without a result.');
3258
3096
  }
3259
3097
  return result;
3260
3098
  }
@@ -3272,7 +3110,7 @@ export class UpdateEndpointOperation {
3272
3110
 
3273
3111
  export class UpdateProjectOperation {
3274
3112
  constructor(
3275
- private readonly client: Client,
3113
+ private readonly client: PostgresClient,
3276
3114
  private operation: Operation
3277
3115
  ) {}
3278
3116
 
@@ -3298,23 +3136,22 @@ export class UpdateProjectOperation {
3298
3136
  *
3299
3137
  * Throws if the operation failed.
3300
3138
  */
3301
- async wait(options?: CallOptions): Promise<Project> {
3302
- const errStillRunning = new Error('operation still in progress');
3139
+ async wait(options?: LroOptions): Promise<Project> {
3303
3140
  let result: Project | undefined;
3304
3141
 
3305
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
3142
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
3306
3143
  const op = await this.client.getOperation(
3307
3144
  {
3308
3145
  name: this.operation.name,
3309
3146
  },
3310
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
3147
+ callSignal !== undefined ? {signal: callSignal} : undefined
3311
3148
  );
3312
3149
  this.operation = op;
3313
3150
  if (op.done === undefined) {
3314
3151
  throw new Error('operation is missing the done field');
3315
3152
  }
3316
3153
  if (!op.done) {
3317
- throw errStillRunning;
3154
+ throw new StillRunningError();
3318
3155
  }
3319
3156
 
3320
3157
  if (op.result?.$case === 'error') {
@@ -3337,16 +3174,9 @@ export class UpdateProjectOperation {
3337
3174
  result = z.lazy(() => unmarshalProjectSchema).parse(op.result.response);
3338
3175
  };
3339
3176
 
3340
- const retryOptions: CallOptions = {
3341
- ...(options?.signal !== undefined && {signal: options.signal}),
3342
- retrier: () =>
3343
- retryOn({}, (err: Error) => {
3344
- return err.message.includes('operation still in progress');
3345
- }),
3346
- };
3347
- await executeCall(call, retryOptions);
3177
+ await executeWait(call, options);
3348
3178
  if (result === undefined) {
3349
- throw new Error('API call completed without a result.');
3179
+ throw new Error('operation completed without a result.');
3350
3180
  }
3351
3181
  return result;
3352
3182
  }
@@ -3364,7 +3194,7 @@ export class UpdateProjectOperation {
3364
3194
 
3365
3195
  export class UpdateRoleOperation {
3366
3196
  constructor(
3367
- private readonly client: Client,
3197
+ private readonly client: PostgresClient,
3368
3198
  private operation: Operation
3369
3199
  ) {}
3370
3200
 
@@ -3390,23 +3220,22 @@ export class UpdateRoleOperation {
3390
3220
  *
3391
3221
  * Throws if the operation failed.
3392
3222
  */
3393
- async wait(options?: CallOptions): Promise<Role> {
3394
- const errStillRunning = new Error('operation still in progress');
3223
+ async wait(options?: LroOptions): Promise<Role> {
3395
3224
  let result: Role | undefined;
3396
3225
 
3397
- const call: Call = async (callSignal?: AbortSignal): Promise<void> => {
3226
+ const call = async (callSignal?: AbortSignal): Promise<void> => {
3398
3227
  const op = await this.client.getOperation(
3399
3228
  {
3400
3229
  name: this.operation.name,
3401
3230
  },
3402
- {...options, ...(callSignal !== undefined && {signal: callSignal})}
3231
+ callSignal !== undefined ? {signal: callSignal} : undefined
3403
3232
  );
3404
3233
  this.operation = op;
3405
3234
  if (op.done === undefined) {
3406
3235
  throw new Error('operation is missing the done field');
3407
3236
  }
3408
3237
  if (!op.done) {
3409
- throw errStillRunning;
3238
+ throw new StillRunningError();
3410
3239
  }
3411
3240
 
3412
3241
  if (op.result?.$case === 'error') {
@@ -3429,16 +3258,9 @@ export class UpdateRoleOperation {
3429
3258
  result = z.lazy(() => unmarshalRoleSchema).parse(op.result.response);
3430
3259
  };
3431
3260
 
3432
- const retryOptions: CallOptions = {
3433
- ...(options?.signal !== undefined && {signal: options.signal}),
3434
- retrier: () =>
3435
- retryOn({}, (err: Error) => {
3436
- return err.message.includes('operation still in progress');
3437
- }),
3438
- };
3439
- await executeCall(call, retryOptions);
3261
+ await executeWait(call, options);
3440
3262
  if (result === undefined) {
3441
- throw new Error('API call completed without a result.');
3263
+ throw new Error('operation completed without a result.');
3442
3264
  }
3443
3265
  return result;
3444
3266
  }