@google-cloud/spanner 8.11.0 → 8.13.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.
@@ -23,7 +23,7 @@ import { Json, JSONOptions, Type, Value } from './codec';
23
23
  import { PartialResultStream, ResumeToken, Row } from './partial-result-stream';
24
24
  import { Session } from './session';
25
25
  import { Key } from './table';
26
- import { Span } from './instrument';
26
+ import { Span, ObservabilityOptions, traceConfig } from './instrument';
27
27
  import { NormalCallback } from './common';
28
28
  import { protos } from '@google-cloud/spanner-api';
29
29
  import spannerClient = protos.google;
@@ -31,7 +31,6 @@ import google = protos.google;
31
31
  import IQueryOptions = google.spanner.v1.ExecuteSqlRequest.IQueryOptions;
32
32
  import IRequestOptions = google.spanner.v1.IRequestOptions;
33
33
  import { Spanner } from '.';
34
- import { ObservabilityOptions, traceConfig } from './instrument';
35
34
  import { RunTransactionOptions } from './transaction-runner';
36
35
  export type Rows = Array<Row | Json>;
37
36
  export interface TimestampBounds {
@@ -47,6 +46,13 @@ export interface BatchWriteOptions {
47
46
  gaxOptions?: CallOptions;
48
47
  excludeTxnFromChangeStreams?: boolean;
49
48
  }
49
+ export interface QueueSendOptions {
50
+ payload?: Value;
51
+ deliverTime?: Date | spannerClient.protobuf.ITimestamp;
52
+ }
53
+ export interface QueueAckOptions {
54
+ ignoreNotFound?: boolean;
55
+ }
50
56
  export interface RequestOptions {
51
57
  json?: boolean;
52
58
  jsonOptions?: JSONOptions;
@@ -163,10 +169,6 @@ export interface BatchUpdateOptions {
163
169
  export interface BatchUpdateCallback {
164
170
  (err: null | BatchUpdateError, rowCounts: number[], response?: spannerClient.spanner.v1.ExecuteBatchDmlResponse): void;
165
171
  }
166
- export interface BatchUpdateOptions {
167
- requestOptions?: Omit<IRequestOptions, 'transactionTag'>;
168
- gaxOptions?: CallOptions;
169
- }
170
172
  export type ReadCallback = NormalCallback<Rows>;
171
173
  export interface RunCallback {
172
174
  (err: null | grpc.ServiceError, rows: Rows, stats: spannerClient.spanner.v1.ResultSetStats, metadata?: spannerClient.spanner.v1.ResultSetMetadata): void;
@@ -233,7 +235,7 @@ type PrecommitTokenProvider = spannerClient.spanner.v1.ITransaction | spannerCli
233
235
  export declare class Snapshot extends EventEmitter {
234
236
  protected _options: spannerClient.spanner.v1.ITransactionOptions;
235
237
  protected _seqno: number;
236
- protected _waitingRequests: Array<() => void>;
238
+ protected _waitingRequests: Array<(err?: Error) => void>;
237
239
  protected _inlineBeginStarted: any;
238
240
  protected _useInRunner: boolean;
239
241
  protected _latestPreCommitToken: spannerClient.spanner.v1.IMultiplexedSessionPrecommitToken | undefined | null;
@@ -799,6 +801,26 @@ export declare class Snapshot extends EventEmitter {
799
801
  */
800
802
  run(query: string | ExecuteSqlRequest): Promise<RunResponse>;
801
803
  run(query: string | ExecuteSqlRequest, callback: RunCallback): void;
804
+ /**
805
+ * Always runs the query through the full streaming pipeline (Snapshot.prototype.runStream).
806
+ * Used when runStream has been overridden on Snapshot to preserve backward compatibility
807
+ * with custom stream implementations.
808
+ *
809
+ * @private
810
+ */
811
+ private _runLegacy;
812
+ /**
813
+ * Executes a query using an optimized streaming model:
814
+ * 1. If all results are returned in a single PartialResultSet, the internal streaming
815
+ * pipeline is simplified and rows are decoded directly, bypassing Stream overhead.
816
+ * 2. If there are more than one PartialResultSets, it seamlessly falls back to
817
+ * the standard streaming model.
818
+ *
819
+ * @private
820
+ */
821
+ _run(queryInput: string | ExecuteSqlRequest, callback: RunCallback, options?: {
822
+ startRunSpan?: boolean;
823
+ }): void;
802
824
  /**
803
825
  * ExecuteSql request options. This includes all standard ExecuteSqlRequest
804
826
  * options as well as several convenience properties.
@@ -961,7 +983,7 @@ export declare class Snapshot extends EventEmitter {
961
983
  * @private
962
984
  */
963
985
  private _wrapWithIdWaiter;
964
- _releaseWaitingRequests(): void;
986
+ _releaseWaitingRequests(err?: Error): void;
965
987
  /**
966
988
  * Gets the Spanner object
967
989
  *
@@ -1377,6 +1399,22 @@ export declare class Transaction extends Dml {
1377
1399
  * ```
1378
1400
  */
1379
1401
  insert(table: string, rows: object | object[]): void;
1402
+ /**
1403
+ * Queue a send mutation.
1404
+ *
1405
+ * @param {string} queue The name of the queue.
1406
+ * @param {Key} key The key of the message to send.
1407
+ * @param {QueueSendOptions} [options] Options for the send mutation.
1408
+ */
1409
+ queueSend(queue: string, key: Key, options?: QueueSendOptions): void;
1410
+ /**
1411
+ * Queue an ack mutation.
1412
+ *
1413
+ * @param {string} queue The name of the queue.
1414
+ * @param {Key} key The key of the message to ack.
1415
+ * @param {QueueAckOptions} [options] Options for the ack mutation.
1416
+ */
1417
+ queueAck(queue: string, key: Key, options?: QueueAckOptions): void;
1380
1418
  /**
1381
1419
  * Replace rows of data within a table.
1382
1420
  *
@@ -1613,6 +1651,22 @@ export declare class MutationSet {
1613
1651
  * @param {object|object[]} rows. A single row object or an array of row objects to insert.
1614
1652
  */
1615
1653
  insert(table: string, rows: object | object[]): void;
1654
+ /**
1655
+ * Queue a send mutation.
1656
+ *
1657
+ * @param {string} queue The name of the queue.
1658
+ * @param {Key} key The key of the message to send.
1659
+ * @param {QueueSendOptions} [options] Options for the send mutation.
1660
+ */
1661
+ queueSend(queue: string, key: Key, options?: QueueSendOptions): void;
1662
+ /**
1663
+ * Queue an ack mutation.
1664
+ *
1665
+ * @param {string} queue The name of the queue.
1666
+ * @param {Key} key The key of the message to ack.
1667
+ * @param {QueueAckOptions} [options] Options for the ack mutation.
1668
+ */
1669
+ queueAck(queue: string, key: Key, options?: QueueAckOptions): void;
1616
1670
  /**
1617
1671
  * Adds an update operation to the mutation set.
1618
1672
  * @param {string} table. The name of the table to update.
@@ -1682,6 +1736,8 @@ export declare class MutationGroup {
1682
1736
  private _proto;
1683
1737
  constructor();
1684
1738
  insert(table: string, rows: object | object[]): void;
1739
+ queueSend(queue: string, key: Key, options?: QueueSendOptions): void;
1740
+ queueAck(queue: string, key: Key, options?: QueueAckOptions): void;
1685
1741
  update(table: string, rows: object | object[]): void;
1686
1742
  upsert(table: string, rows: object | object[]): void;
1687
1743
  replace(table: string, rows: object | object[]): void;