Showing 2 of 9 files from the diff.

@@ -23,7 +23,7 @@
Loading
23 23
} from '@google-cloud/common';
24 24
// eslint-disable-next-line @typescript-eslint/no-var-requires
25 25
const common = require('./common-grpc/service-object');
26 -
import {promisify, promisifyAll} from '@google-cloud/promisify';
26 +
import {promisify, promisifyAll, callbackifyAll} from '@google-cloud/promisify';
27 27
import * as extend from 'extend';
28 28
import * as r from 'teeny-request';
29 29
import * as streamEvents from 'stream-events';
@@ -42,6 +42,7 @@
Loading
42 42
  GetDatabaseOperationsOptions,
43 43
  GetDatabaseOperationsResponse,
44 44
  Instance,
45 +
  GetDatabaseOperationsCallback,
45 46
} from './instance';
46 47
import {PartialResultStream, Row} from './partial-result-stream';
47 48
import {Session} from './session';
@@ -219,6 +220,11 @@
Loading
219 220
  databaseAdmin.longrunning.IOperation
220 221
];
221 222
223 +
export type GetRestoreInfoCallback = NormalCallback<IRestoreInfoTranslatedEnum>;
224 +
export type GetStateCallback = NormalCallback<
225 +
  EnumKey<typeof databaseAdmin.spanner.admin.database.v1.Database.State>
226 +
>;
227 +
222 228
interface DatabaseRequest {
223 229
  (
224 230
    config: RequestConfig,
@@ -1137,6 +1143,11 @@
Loading
1137 1143
    );
1138 1144
  }
1139 1145
1146 +
  getRestoreInfo(
1147 +
    options?: CallOptions
1148 +
  ): Promise<IRestoreInfoTranslatedEnum | undefined>;
1149 +
  getRestoreInfo(callback: GetRestoreInfoCallback): void;
1150 +
  getRestoreInfo(options: CallOptions, callback: GetRestoreInfoCallback): void;
1140 1151
  /**
1141 1152
   * {@link google.spanner.admin.database.v1#RestoreInfo} structure with restore
1142 1153
   * source type enum translated to string form.
@@ -1151,6 +1162,7 @@
Loading
1151 1162
   * @method Database#getRestoreInfo
1152 1163
   * @param {object} [gaxOptions] Request configuration options, outlined here:
1153 1164
   *     https://googleapis.github.io/gax-nodejs/classes/CallSettings.html.
1165 +
   * @param {GetRestoreInfoCallback} [callback] Callback function.
1154 1166
   * @returns {Promise<IRestoreInfoTranslatedEnum | undefined>} When resolved,
1155 1167
   *     contains the restore information for the database if it was restored
1156 1168
   *     from a backup.
@@ -1164,12 +1176,23 @@
Loading
1164 1176
   * console.log(`Database restored from ${restoreInfo.backupInfo.backup}`);
1165 1177
   */
1166 1178
  async getRestoreInfo(
1167 -
    options?: CallOptions
1179 +
    optionsOrCallback?: CallOptions | GetRestoreInfoCallback
1168 1180
  ): Promise<IRestoreInfoTranslatedEnum | undefined> {
1169 -
    const [metadata] = await this.getMetadata(options);
1181 +
    const gaxOptions =
1182 +
      typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
1183 +
1184 +
    const [metadata] = await this.getMetadata(gaxOptions);
1170 1185
    return metadata.restoreInfo ? metadata.restoreInfo : undefined;
1171 1186
  }
1172 1187
1188 +
  getState(
1189 +
    options?: CallOptions
1190 +
  ): Promise<
1191 +
    | EnumKey<typeof databaseAdmin.spanner.admin.database.v1.Database.State>
1192 +
    | undefined
1193 +
  >;
1194 +
  getState(callback: GetStateCallback): void;
1195 +
  getState(options: CallOptions, callback: GetStateCallback): void;
1173 1196
  /**
1174 1197
   * Retrieves the state of the database.
1175 1198
   *
@@ -1181,6 +1204,7 @@
Loading
1181 1204
   * @method Database#getState
1182 1205
   * @param {object} [gaxOptions] Request configuration options, outlined here:
1183 1206
   *     https://googleapis.github.io/gax-nodejs/classes/CallSettings.html.
1207 +
   * @param {GetStateCallback} [callback] Callback function.
1184 1208
   * @returns {Promise<EnumKey<typeof, databaseAdmin.spanner.admin.database.v1.Database.State> | undefined>}
1185 1209
   *     When resolved, contains the current state of the database if the state
1186 1210
   *     is defined.
@@ -1194,12 +1218,15 @@
Loading
1194 1218
   * const isReady = (state === 'READY');
1195 1219
   */
1196 1220
  async getState(
1197 -
    options?: CallOptions
1221 +
    optionsOrCallback?: CallOptions | GetStateCallback
1198 1222
  ): Promise<
1199 1223
    | EnumKey<typeof databaseAdmin.spanner.admin.database.v1.Database.State>
1200 1224
    | undefined
1201 1225
  > {
1202 -
    const [metadata] = await this.getMetadata(options);
1226 +
    const gaxOptions =
1227 +
      typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
1228 +
1229 +
    const [metadata] = await this.getMetadata(gaxOptions);
1203 1230
    return metadata.state || undefined;
1204 1231
  }
1205 1232
@@ -1643,6 +1670,14 @@
Loading
1643 1670
    });
1644 1671
  }
1645 1672
1673 +
  getOperations(
1674 +
    options?: GetDatabaseOperationsOptions
1675 +
  ): Promise<GetDatabaseOperationsResponse>;
1676 +
  getOperations(callback: GetDatabaseOperationsCallback): void;
1677 +
  getOperations(
1678 +
    options: GetDatabaseOperationsOptions,
1679 +
    callback: GetDatabaseOperationsCallback
1680 +
  ): void;
1646 1681
  /**
1647 1682
   * Query object for listing database operations.
1648 1683
   *
@@ -1653,6 +1688,9 @@
Loading
1653 1688
   * @property {number} [pageSize] Maximum number of results per page.
1654 1689
   * @property {string} [pageToken] A previously-returned page token
1655 1690
   *     representing part of the larger set of results to view.
1691 +
   * @property {object} [gaxOptions] Request configuration options, outlined
1692 +
   *     here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.
1693 +
   * @param {GetDatabaseOperationsCallback} [callback] Callback function.
1656 1694
   */
1657 1695
  /**
1658 1696
   * @typedef {array} GetDatabaseOperationsResponse
@@ -1694,8 +1732,12 @@
Loading
1694 1732
   * } while (pageToken);
1695 1733
   */
1696 1734
  async getOperations(
1697 -
    options?: GetDatabaseOperationsOptions
1735 +
    optionsOrCallback?:
1736 +
      | GetDatabaseOperationsOptions
1737 +
      | GetDatabaseOperationsCallback
1698 1738
  ): Promise<GetDatabaseOperationsResponse> {
1739 +
    const options =
1740 +
      typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
1699 1741
    // Create a query that lists database operations only on this database from
1700 1742
    // the instance. Operation name will be prefixed with the database path for
1701 1743
    // all operations on this database
@@ -2727,6 +2769,39 @@
Loading
2727 2769
  ],
2728 2770
});
2729 2771
2772 +
/*! Developer Documentation
2773 +
 *
2774 +
 * All async methods (except for streams) will return a Promise in the event
2775 +
 * that a callback is omitted.
2776 +
 */
2777 +
callbackifyAll(Database, {
2778 +
  exclude: [
2779 +
    'create',
2780 +
    'batchCreateSessions',
2781 +
    'batchTransaction',
2782 +
    'close',
2783 +
    'createBatchTransaction',
2784 +
    'createSession',
2785 +
    'createTable',
2786 +
    'delete',
2787 +
    'exists',
2788 +
    'get',
2789 +
    'getMetadata',
2790 +
    'getSchema',
2791 +
    'getSessions',
2792 +
    'getSnapshot',
2793 +
    'getTransaction',
2794 +
    'restore',
2795 +
    'run',
2796 +
    'runPartitionedUpdate',
2797 +
    'runTransaction',
2798 +
    'runTransactionAsync',
2799 +
    'session',
2800 +
    'table',
2801 +
    'updateSchema',
2802 +
  ],
2803 +
});
2804 +
2730 2805
/**
2731 2806
 * Reference to the {@link Database} class.
2732 2807
 * @name module:@google-cloud/spanner.Database

@@ -14,7 +14,8 @@
Loading
14 14
const config = {
15 15
  "enable-source-maps": true,
16 16
  "throw-deprecation": true,
17 -
  "timeout": 10000
17 +
  "timeout": 10000,
18 +
  "recursive": true
18 19
}
19 20
if (process.env.MOCHA_THROW_DEPRECATION === 'false') {
20 21
  delete config['throw-deprecation'];
Files Coverage
bin 0.00%
src 99.74%
.mocharc.js 79.31%
.prettierrc.js 0.00%
Project Totals (23 files) 98.60%
actions 10
Build #253747907 -
actions 12
Build #253747907 -
actions windows
Build #253747907 -
actions 13
Build #253747907 -

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading