@google-cloud/spanner 7.9.1 → 7.11.0

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.
@@ -1720,6 +1720,14 @@
1720
1720
  "options": {
1721
1721
  "(google.api.field_behavior)": "OUTPUT_ONLY"
1722
1722
  }
1723
+ },
1724
+ "backupSchedules": {
1725
+ "rule": "repeated",
1726
+ "type": "string",
1727
+ "id": 14,
1728
+ "options": {
1729
+ "(google.api.field_behavior)": "OUTPUT_ONLY"
1730
+ }
1723
1731
  }
1724
1732
  },
1725
1733
  "nested": {
@@ -2076,6 +2084,9 @@
2076
2084
  }
2077
2085
  }
2078
2086
  },
2087
+ "FullBackupSpec": {
2088
+ "fields": {}
2089
+ },
2079
2090
  "OperationProgress": {
2080
2091
  "fields": {
2081
2092
  "progressPercent": {
@@ -2153,6 +2164,209 @@
2153
2164
  "POSTGRESQL": 2
2154
2165
  }
2155
2166
  },
2167
+ "BackupScheduleSpec": {
2168
+ "oneofs": {
2169
+ "scheduleSpec": {
2170
+ "oneof": [
2171
+ "cronSpec"
2172
+ ]
2173
+ }
2174
+ },
2175
+ "fields": {
2176
+ "cronSpec": {
2177
+ "type": "CrontabSpec",
2178
+ "id": 1
2179
+ }
2180
+ }
2181
+ },
2182
+ "BackupSchedule": {
2183
+ "options": {
2184
+ "(google.api.resource).type": "spanner.googleapis.com/BackupSchedule",
2185
+ "(google.api.resource).pattern": "projects/{project}/instances/{instance}/databases/{database}/backupSchedules/{schedule}",
2186
+ "(google.api.resource).plural": "backupSchedules",
2187
+ "(google.api.resource).singular": "backupSchedule"
2188
+ },
2189
+ "oneofs": {
2190
+ "backupTypeSpec": {
2191
+ "oneof": [
2192
+ "fullBackupSpec"
2193
+ ]
2194
+ }
2195
+ },
2196
+ "fields": {
2197
+ "name": {
2198
+ "type": "string",
2199
+ "id": 1,
2200
+ "options": {
2201
+ "(google.api.field_behavior)": "IDENTIFIER"
2202
+ }
2203
+ },
2204
+ "spec": {
2205
+ "type": "BackupScheduleSpec",
2206
+ "id": 6,
2207
+ "options": {
2208
+ "(google.api.field_behavior)": "OPTIONAL"
2209
+ }
2210
+ },
2211
+ "retentionDuration": {
2212
+ "type": "google.protobuf.Duration",
2213
+ "id": 3,
2214
+ "options": {
2215
+ "(google.api.field_behavior)": "OPTIONAL"
2216
+ }
2217
+ },
2218
+ "encryptionConfig": {
2219
+ "type": "CreateBackupEncryptionConfig",
2220
+ "id": 4,
2221
+ "options": {
2222
+ "(google.api.field_behavior)": "OPTIONAL"
2223
+ }
2224
+ },
2225
+ "fullBackupSpec": {
2226
+ "type": "FullBackupSpec",
2227
+ "id": 7
2228
+ },
2229
+ "updateTime": {
2230
+ "type": "google.protobuf.Timestamp",
2231
+ "id": 9,
2232
+ "options": {
2233
+ "(google.api.field_behavior)": "OUTPUT_ONLY"
2234
+ }
2235
+ }
2236
+ }
2237
+ },
2238
+ "CrontabSpec": {
2239
+ "fields": {
2240
+ "text": {
2241
+ "type": "string",
2242
+ "id": 1,
2243
+ "options": {
2244
+ "(google.api.field_behavior)": "REQUIRED"
2245
+ }
2246
+ },
2247
+ "timeZone": {
2248
+ "type": "string",
2249
+ "id": 2,
2250
+ "options": {
2251
+ "(google.api.field_behavior)": "OUTPUT_ONLY"
2252
+ }
2253
+ },
2254
+ "creationWindow": {
2255
+ "type": "google.protobuf.Duration",
2256
+ "id": 3,
2257
+ "options": {
2258
+ "(google.api.field_behavior)": "OUTPUT_ONLY"
2259
+ }
2260
+ }
2261
+ }
2262
+ },
2263
+ "CreateBackupScheduleRequest": {
2264
+ "fields": {
2265
+ "parent": {
2266
+ "type": "string",
2267
+ "id": 1,
2268
+ "options": {
2269
+ "(google.api.field_behavior)": "REQUIRED",
2270
+ "(google.api.resource_reference).type": "spanner.googleapis.com/Database"
2271
+ }
2272
+ },
2273
+ "backupScheduleId": {
2274
+ "type": "string",
2275
+ "id": 2,
2276
+ "options": {
2277
+ "(google.api.field_behavior)": "REQUIRED"
2278
+ }
2279
+ },
2280
+ "backupSchedule": {
2281
+ "type": "BackupSchedule",
2282
+ "id": 3,
2283
+ "options": {
2284
+ "(google.api.field_behavior)": "REQUIRED"
2285
+ }
2286
+ }
2287
+ }
2288
+ },
2289
+ "GetBackupScheduleRequest": {
2290
+ "fields": {
2291
+ "name": {
2292
+ "type": "string",
2293
+ "id": 1,
2294
+ "options": {
2295
+ "(google.api.field_behavior)": "REQUIRED",
2296
+ "(google.api.resource_reference).type": "spanner.googleapis.com/BackupSchedule"
2297
+ }
2298
+ }
2299
+ }
2300
+ },
2301
+ "DeleteBackupScheduleRequest": {
2302
+ "fields": {
2303
+ "name": {
2304
+ "type": "string",
2305
+ "id": 1,
2306
+ "options": {
2307
+ "(google.api.field_behavior)": "REQUIRED",
2308
+ "(google.api.resource_reference).type": "spanner.googleapis.com/BackupSchedule"
2309
+ }
2310
+ }
2311
+ }
2312
+ },
2313
+ "ListBackupSchedulesRequest": {
2314
+ "fields": {
2315
+ "parent": {
2316
+ "type": "string",
2317
+ "id": 1,
2318
+ "options": {
2319
+ "(google.api.field_behavior)": "REQUIRED",
2320
+ "(google.api.resource_reference).type": "spanner.googleapis.com/Database"
2321
+ }
2322
+ },
2323
+ "pageSize": {
2324
+ "type": "int32",
2325
+ "id": 2,
2326
+ "options": {
2327
+ "(google.api.field_behavior)": "OPTIONAL"
2328
+ }
2329
+ },
2330
+ "pageToken": {
2331
+ "type": "string",
2332
+ "id": 4,
2333
+ "options": {
2334
+ "(google.api.field_behavior)": "OPTIONAL"
2335
+ }
2336
+ }
2337
+ }
2338
+ },
2339
+ "ListBackupSchedulesResponse": {
2340
+ "fields": {
2341
+ "backupSchedules": {
2342
+ "rule": "repeated",
2343
+ "type": "BackupSchedule",
2344
+ "id": 1
2345
+ },
2346
+ "nextPageToken": {
2347
+ "type": "string",
2348
+ "id": 2
2349
+ }
2350
+ }
2351
+ },
2352
+ "UpdateBackupScheduleRequest": {
2353
+ "fields": {
2354
+ "backupSchedule": {
2355
+ "type": "BackupSchedule",
2356
+ "id": 1,
2357
+ "options": {
2358
+ "(google.api.field_behavior)": "REQUIRED"
2359
+ }
2360
+ },
2361
+ "updateMask": {
2362
+ "type": "google.protobuf.FieldMask",
2363
+ "id": 2,
2364
+ "options": {
2365
+ "(google.api.field_behavior)": "REQUIRED"
2366
+ }
2367
+ }
2368
+ }
2369
+ },
2156
2370
  "DatabaseAdmin": {
2157
2371
  "options": {
2158
2372
  "(google.api.default_host)": "spanner.googleapis.com",
@@ -2321,7 +2535,7 @@
2321
2535
  "options": {
2322
2536
  "(google.api.http).post": "/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy",
2323
2537
  "(google.api.http).body": "*",
2324
- "(google.api.http).additional_bindings.post": "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy",
2538
+ "(google.api.http).additional_bindings.post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy",
2325
2539
  "(google.api.http).additional_bindings.body": "*",
2326
2540
  "(google.api.method_signature)": "resource,policy"
2327
2541
  },
@@ -2330,10 +2544,16 @@
2330
2544
  "(google.api.http)": {
2331
2545
  "post": "/v1/{resource=projects/*/instances/*/databases/*}:setIamPolicy",
2332
2546
  "body": "*",
2333
- "additional_bindings": {
2334
- "post": "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy",
2335
- "body": "*"
2336
- }
2547
+ "additional_bindings": [
2548
+ {
2549
+ "post": "/v1/{resource=projects/*/instances/*/backups/*}:setIamPolicy",
2550
+ "body": "*"
2551
+ },
2552
+ {
2553
+ "post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:setIamPolicy",
2554
+ "body": "*"
2555
+ }
2556
+ ]
2337
2557
  }
2338
2558
  },
2339
2559
  {
@@ -2347,7 +2567,7 @@
2347
2567
  "options": {
2348
2568
  "(google.api.http).post": "/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy",
2349
2569
  "(google.api.http).body": "*",
2350
- "(google.api.http).additional_bindings.post": "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy",
2570
+ "(google.api.http).additional_bindings.post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy",
2351
2571
  "(google.api.http).additional_bindings.body": "*",
2352
2572
  "(google.api.method_signature)": "resource"
2353
2573
  },
@@ -2356,10 +2576,16 @@
2356
2576
  "(google.api.http)": {
2357
2577
  "post": "/v1/{resource=projects/*/instances/*/databases/*}:getIamPolicy",
2358
2578
  "body": "*",
2359
- "additional_bindings": {
2360
- "post": "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy",
2361
- "body": "*"
2362
- }
2579
+ "additional_bindings": [
2580
+ {
2581
+ "post": "/v1/{resource=projects/*/instances/*/backups/*}:getIamPolicy",
2582
+ "body": "*"
2583
+ },
2584
+ {
2585
+ "post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:getIamPolicy",
2586
+ "body": "*"
2587
+ }
2588
+ ]
2363
2589
  }
2364
2590
  },
2365
2591
  {
@@ -2387,6 +2613,10 @@
2387
2613
  "post": "/v1/{resource=projects/*/instances/*/backups/*}:testIamPermissions",
2388
2614
  "body": "*"
2389
2615
  },
2616
+ {
2617
+ "post": "/v1/{resource=projects/*/instances/*/databases/*/backupSchedules/*}:testIamPermissions",
2618
+ "body": "*"
2619
+ },
2390
2620
  {
2391
2621
  "post": "/v1/{resource=projects/*/instances/*/databases/*/databaseRoles/*}:testIamPermissions",
2392
2622
  "body": "*"
@@ -2610,6 +2840,100 @@
2610
2840
  "(google.api.method_signature)": "parent"
2611
2841
  }
2612
2842
  ]
2843
+ },
2844
+ "CreateBackupSchedule": {
2845
+ "requestType": "CreateBackupScheduleRequest",
2846
+ "responseType": "BackupSchedule",
2847
+ "options": {
2848
+ "(google.api.http).post": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules",
2849
+ "(google.api.http).body": "backup_schedule",
2850
+ "(google.api.method_signature)": "parent,backup_schedule,backup_schedule_id"
2851
+ },
2852
+ "parsedOptions": [
2853
+ {
2854
+ "(google.api.http)": {
2855
+ "post": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules",
2856
+ "body": "backup_schedule"
2857
+ }
2858
+ },
2859
+ {
2860
+ "(google.api.method_signature)": "parent,backup_schedule,backup_schedule_id"
2861
+ }
2862
+ ]
2863
+ },
2864
+ "GetBackupSchedule": {
2865
+ "requestType": "GetBackupScheduleRequest",
2866
+ "responseType": "BackupSchedule",
2867
+ "options": {
2868
+ "(google.api.http).get": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}",
2869
+ "(google.api.method_signature)": "name"
2870
+ },
2871
+ "parsedOptions": [
2872
+ {
2873
+ "(google.api.http)": {
2874
+ "get": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}"
2875
+ }
2876
+ },
2877
+ {
2878
+ "(google.api.method_signature)": "name"
2879
+ }
2880
+ ]
2881
+ },
2882
+ "UpdateBackupSchedule": {
2883
+ "requestType": "UpdateBackupScheduleRequest",
2884
+ "responseType": "BackupSchedule",
2885
+ "options": {
2886
+ "(google.api.http).patch": "/v1/{backup_schedule.name=projects/*/instances/*/databases/*/backupSchedules/*}",
2887
+ "(google.api.http).body": "backup_schedule",
2888
+ "(google.api.method_signature)": "backup_schedule,update_mask"
2889
+ },
2890
+ "parsedOptions": [
2891
+ {
2892
+ "(google.api.http)": {
2893
+ "patch": "/v1/{backup_schedule.name=projects/*/instances/*/databases/*/backupSchedules/*}",
2894
+ "body": "backup_schedule"
2895
+ }
2896
+ },
2897
+ {
2898
+ "(google.api.method_signature)": "backup_schedule,update_mask"
2899
+ }
2900
+ ]
2901
+ },
2902
+ "DeleteBackupSchedule": {
2903
+ "requestType": "DeleteBackupScheduleRequest",
2904
+ "responseType": "google.protobuf.Empty",
2905
+ "options": {
2906
+ "(google.api.http).delete": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}",
2907
+ "(google.api.method_signature)": "name"
2908
+ },
2909
+ "parsedOptions": [
2910
+ {
2911
+ "(google.api.http)": {
2912
+ "delete": "/v1/{name=projects/*/instances/*/databases/*/backupSchedules/*}"
2913
+ }
2914
+ },
2915
+ {
2916
+ "(google.api.method_signature)": "name"
2917
+ }
2918
+ ]
2919
+ },
2920
+ "ListBackupSchedules": {
2921
+ "requestType": "ListBackupSchedulesRequest",
2922
+ "responseType": "ListBackupSchedulesResponse",
2923
+ "options": {
2924
+ "(google.api.http).get": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules",
2925
+ "(google.api.method_signature)": "parent"
2926
+ },
2927
+ "parsedOptions": [
2928
+ {
2929
+ "(google.api.http)": {
2930
+ "get": "/v1/{parent=projects/*/instances/*/databases/*}/backupSchedules"
2931
+ }
2932
+ },
2933
+ {
2934
+ "(google.api.method_signature)": "parent"
2935
+ }
2936
+ ]
2613
2937
  }
2614
2938
  }
2615
2939
  },
@@ -4694,7 +5018,8 @@
4694
5018
  "generateDbPartitionsRead",
4695
5019
  "generateDbPartitionsQuery",
4696
5020
  "executePartition",
4697
- "executeChangeStreamQuery"
5021
+ "executeChangeStreamQuery",
5022
+ "queryCancellation"
4698
5023
  ]
4699
5024
  }
4700
5025
  },
@@ -4770,6 +5095,10 @@
4770
5095
  "executeChangeStreamQuery": {
4771
5096
  "type": "ExecuteChangeStreamQuery",
4772
5097
  "id": 50
5098
+ },
5099
+ "queryCancellation": {
5100
+ "type": "QueryCancellationAction",
5101
+ "id": 51
4773
5102
  }
4774
5103
  }
4775
5104
  },
@@ -6172,6 +6501,18 @@
6172
6501
  }
6173
6502
  }
6174
6503
  },
6504
+ "QueryCancellationAction": {
6505
+ "fields": {
6506
+ "longRunningSql": {
6507
+ "type": "string",
6508
+ "id": 1
6509
+ },
6510
+ "cancelQuery": {
6511
+ "type": "string",
6512
+ "id": 2
6513
+ }
6514
+ }
6515
+ },
6175
6516
  "CancelOperationAction": {
6176
6517
  "fields": {
6177
6518
  "operation": {
@@ -7772,6 +8113,36 @@
7772
8113
  "dataBoostEnabled": {
7773
8114
  "type": "bool",
7774
8115
  "id": 15
8116
+ },
8117
+ "orderBy": {
8118
+ "type": "OrderBy",
8119
+ "id": 16,
8120
+ "options": {
8121
+ "(google.api.field_behavior)": "OPTIONAL"
8122
+ }
8123
+ },
8124
+ "lockHint": {
8125
+ "type": "LockHint",
8126
+ "id": 17,
8127
+ "options": {
8128
+ "(google.api.field_behavior)": "OPTIONAL"
8129
+ }
8130
+ }
8131
+ },
8132
+ "nested": {
8133
+ "OrderBy": {
8134
+ "values": {
8135
+ "ORDER_BY_UNSPECIFIED": 0,
8136
+ "ORDER_BY_PRIMARY_KEY": 1,
8137
+ "ORDER_BY_NO_ORDER": 2
8138
+ }
8139
+ },
8140
+ "LockHint": {
8141
+ "values": {
8142
+ "LOCK_HINT_UNSPECIFIED": 0,
8143
+ "LOCK_HINT_SHARED": 1,
8144
+ "LOCK_HINT_EXCLUSIVE": 2
8145
+ }
7775
8146
  }
7776
8147
  }
7777
8148
  },
@@ -24,7 +24,7 @@ import { PartialResultStream } from './partial-result-stream';
24
24
  import { Session } from './session';
25
25
  import { SessionPoolCloseCallback, SessionPoolInterface, SessionPoolOptions } from './session-pool';
26
26
  import { CreateTableCallback, CreateTableResponse, Table } from './table';
27
- import { BatchWriteOptions, ExecuteSqlRequest, MutationGroup, RunCallback, RunResponse, RunUpdateCallback, Snapshot, TimestampBounds, Transaction } from './transaction';
27
+ import { BatchWriteOptions, CommitCallback, CommitResponse, ExecuteSqlRequest, MutationGroup, MutationSet, RunCallback, RunResponse, RunUpdateCallback, Snapshot, TimestampBounds, Transaction } from './transaction';
28
28
  import { AsyncRunTransactionCallback, RunTransactionCallback, RunTransactionOptions } from './transaction-runner';
29
29
  import { IOperation, LongRunningCallback, NormalCallback, PagedOptionsWithFilter, PagedResponse, RequestCallback, ResourceCallback, Schema } from './common';
30
30
  import { Duplex, Readable } from 'stream';
@@ -1836,6 +1836,60 @@ declare class Database extends common.GrpcServiceObject {
1836
1836
  * ```
1837
1837
  */
1838
1838
  batchWriteAtLeastOnce(mutationGroups: MutationGroup[], options?: BatchWriteOptions): NodeJS.ReadableStream;
1839
+ /**
1840
+ * Write mutations using a single RPC invocation without replay protection.
1841
+ *
1842
+ * writeAtLeastOnce writes mutations to Spanner using a single Commit RPC.
1843
+ * These requests are not replay protected, meaning that it may apply mutations more
1844
+ * than once, if the mutations are not idempotent, this may lead to a failure being
1845
+ * reported when the mutation was applied once. Replays non-idempotent mutations may
1846
+ * have undesirable effects. For example, replays of an insert mutation may produce an
1847
+ * already exists error. For this reason, most users of the library will prefer to use
1848
+ * {@link runTransaction} instead.
1849
+ *
1850
+ * However, {@link writeAtLeastOnce()} requires only a single RPC, whereas {@link runTransaction()}
1851
+ * requires two RPCs (one of which may be performed in advance), and so this method may be
1852
+ * appropriate for latency sensitive and/or high throughput blind writing.
1853
+ *
1854
+ * We recommend structuring your mutation set to be idempotent to avoid this issue.
1855
+ *
1856
+ * @param {MutationSet} [mutations] Set of Mutations to be applied.
1857
+ * @param {CallOptions} [options] Options object for blind write request.
1858
+ * @param {CommitCallback} [callback] Callback function for blind write request.
1859
+ *
1860
+ * @returns {Promise}
1861
+ *
1862
+ * @example
1863
+ * ```
1864
+ * const {Spanner} = require('@google-cloud/spanner');
1865
+ * const spanner = new Spanner();
1866
+ *
1867
+ * const instance = spanner.instance('my-instance');
1868
+ * const database = instance.database('my-database');
1869
+ * const mutations = new MutationSet();
1870
+ * mutations.upsert('Singers', {
1871
+ * SingerId: 1,
1872
+ * FirstName: 'Scarlet',
1873
+ * LastName: 'Terry',
1874
+ * });
1875
+ * mutations.upsert('Singers', {
1876
+ * SingerId: 2,
1877
+ * FirstName: 'Marc',
1878
+ * LastName: 'Richards',
1879
+ * });
1880
+ *
1881
+ * try {
1882
+ * const [response, err] = await database.writeAtLeastOnce(mutations, {});
1883
+ * console.log(response.commitTimestamp);
1884
+ * } catch(err) {
1885
+ * console.log("Error: ", err);
1886
+ * }
1887
+ * ```
1888
+ */
1889
+ writeAtLeastOnce(mutations: MutationSet): Promise<CommitResponse>;
1890
+ writeAtLeastOnce(mutations: MutationSet, options: CallOptions): Promise<CommitResponse>;
1891
+ writeAtLeastOnce(mutations: MutationSet, callback: CommitCallback): void;
1892
+ writeAtLeastOnce(mutations: MutationSet, options: CallOptions, callback: CommitCallback): void;
1839
1893
  /**
1840
1894
  * Create a Session object.
1841
1895
  *
@@ -442,15 +442,30 @@ class Database extends common.GrpcServiceObject {
442
442
  const [metadata] = await this.getMetadata(gaxOptions);
443
443
  return metadata.state || undefined;
444
444
  }
445
- async getDatabaseDialect(optionsOrCallback, cb) {
446
- const gaxOptions = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
447
- if (this.databaseDialect === 'DATABASE_DIALECT_UNSPECIFIED' ||
448
- this.databaseDialect === null ||
449
- this.databaseDialect === undefined) {
450
- const [metadata] = await this.getMetadata(gaxOptions);
451
- this.databaseDialect = metadata.databaseDialect;
445
+ async getDatabaseDialect(optionsOrCallback, callback) {
446
+ const gaxOptions = typeof optionsOrCallback === 'object'
447
+ ? optionsOrCallback
448
+ : {};
449
+ const cb = typeof optionsOrCallback === 'function'
450
+ ? optionsOrCallback
451
+ : callback;
452
+ try {
453
+ if (this.databaseDialect === 'DATABASE_DIALECT_UNSPECIFIED' ||
454
+ this.databaseDialect === null ||
455
+ this.databaseDialect === undefined) {
456
+ const [metadata] = await this.getMetadata(gaxOptions);
457
+ this.databaseDialect = metadata.databaseDialect;
458
+ }
459
+ if (cb) {
460
+ cb(null, this.databaseDialect);
461
+ return;
462
+ }
463
+ return this.databaseDialect || undefined;
464
+ }
465
+ catch (err) {
466
+ cb(err);
467
+ return;
452
468
  }
453
- return this.databaseDialect || undefined;
454
469
  }
455
470
  getSchema(optionsOrCallback, cb) {
456
471
  const gaxOpts = typeof optionsOrCallback === 'object' ? optionsOrCallback : {};
@@ -1220,6 +1235,7 @@ class Database extends common.GrpcServiceObject {
1220
1235
  session: session.formattedName_,
1221
1236
  mutationGroups: mutationGroups.map(mg => mg.proto()),
1222
1237
  requestOptions: options === null || options === void 0 ? void 0 : options.requestOptions,
1238
+ excludeTxnFromChangeStream: options === null || options === void 0 ? void 0 : options.excludeTxnFromChangeStreams,
1223
1239
  });
1224
1240
  let dataReceived = false;
1225
1241
  let dataStream = this.requestStream({
@@ -1256,6 +1272,27 @@ class Database extends common.GrpcServiceObject {
1256
1272
  });
1257
1273
  return proxyStream;
1258
1274
  }
1275
+ writeAtLeastOnce(mutations, optionsOrCallback, callback) {
1276
+ const cb = typeof optionsOrCallback === 'function'
1277
+ ? optionsOrCallback
1278
+ : callback;
1279
+ const options = typeof optionsOrCallback === 'object' && optionsOrCallback
1280
+ ? optionsOrCallback
1281
+ : {};
1282
+ this.pool_.getSession((err, session, transaction) => {
1283
+ if (err && (0, session_pool_1.isSessionNotFoundError)(err)) {
1284
+ this.writeAtLeastOnce(mutations, options, cb);
1285
+ return;
1286
+ }
1287
+ if (err) {
1288
+ cb(err);
1289
+ return;
1290
+ }
1291
+ this._releaseOnEnd(session, transaction);
1292
+ transaction === null || transaction === void 0 ? void 0 : transaction.setQueuedMutations(mutations.proto());
1293
+ return transaction === null || transaction === void 0 ? void 0 : transaction.commit(options, cb);
1294
+ });
1295
+ }
1259
1296
  /**
1260
1297
  * Create a Session object.
1261
1298
  *
@@ -1387,6 +1424,7 @@ exports.Database = Database;
1387
1424
  'batchCreateSessions',
1388
1425
  'batchTransaction',
1389
1426
  'batchWriteAtLeastOnce',
1427
+ 'writeAtLeastOnce',
1390
1428
  'close',
1391
1429
  'createBatchTransaction',
1392
1430
  'createSession',
@@ -1394,6 +1432,7 @@ exports.Database = Database;
1394
1432
  'delete',
1395
1433
  'exists',
1396
1434
  'get',
1435
+ 'getDatabaseDialect',
1397
1436
  'getMetadata',
1398
1437
  'getSchema',
1399
1438
  'getSessions',
@@ -28,7 +28,7 @@ import { PagedOptions, PagedResponse, PagedCallback, PagedOptionsWithFilter, Nor
28
28
  import { Session } from './session';
29
29
  import { SessionPool } from './session-pool';
30
30
  import { Table } from './table';
31
- import { MutationGroup, PartitionedDml, Snapshot, Transaction } from './transaction';
31
+ import { MutationGroup, MutationSet, PartitionedDml, Snapshot, Transaction } from './transaction';
32
32
  import * as v1 from './v1';
33
33
  export type IOperation = instanceAdmin.longrunning.IOperation;
34
34
  export type GetInstancesOptions = PagedOptionsWithFilter;
@@ -1163,6 +1163,14 @@ export { Transaction };
1163
1163
  * @type {Constructor}
1164
1164
  */
1165
1165
  export { MutationGroup };
1166
+ /**
1167
+ * {@link MutationSet} class.
1168
+ *
1169
+ * @name Spanner.MutationSet
1170
+ * @see MutationSet
1171
+ * @type {Constructor}
1172
+ */
1173
+ export { MutationSet };
1166
1174
  /**
1167
1175
  * @type {object}
1168
1176
  * @property {constructor} DatabaseAdminClient