@maxim_mazurok/gapi.client.spanner-v1 0.0.20230918 → 0.0.20230921

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.
Files changed (3) hide show
  1. package/index.d.ts +117 -5
  2. package/package.json +1 -1
  3. package/tests.ts +97 -1
package/index.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
10
10
  // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
11
11
  // Generated from: https://spanner.googleapis.com/$discovery/rest?version=v1
12
- // Revision: 20230918
12
+ // Revision: 20230921
13
13
 
14
14
  /// <reference types="gapi.client" />
15
15
 
@@ -117,6 +117,25 @@ declare namespace gapi.client {
117
117
  session?:
118
118
  Session[];
119
119
  }
120
+ interface BatchWriteRequest {
121
+ /** Required. The groups of mutations to be applied. */
122
+ mutationGroups?:
123
+ MutationGroup[];
124
+ /** Common options for this request. */
125
+ requestOptions?:
126
+ RequestOptions;
127
+ }
128
+ interface BatchWriteResponse {
129
+ /** The commit timestamp of the transaction that applied this batch. Present if `status` is `OK`, absent otherwise. */
130
+ commitTimestamp?:
131
+ string;
132
+ /** The mutation groups applied in this batch. The values index into the `mutation_groups` field in the corresponding `BatchWriteRequest`. */
133
+ indexes?:
134
+ number[];
135
+ /** An `OK` status indicates success. Any other status indicates a failure. */
136
+ status?:
137
+ Status;
138
+ }
120
139
  interface BeginTransactionRequest {
121
140
  /** Required. Options for the new transaction. */
122
141
  options?:
@@ -1092,6 +1111,11 @@ declare namespace gapi.client {
1092
1111
  update?:
1093
1112
  Write;
1094
1113
  }
1114
+ interface MutationGroup {
1115
+ /** Required. The mutations in this group. */
1116
+ mutations?:
1117
+ Mutation[];
1118
+ }
1095
1119
  interface Operation {
1096
1120
  /** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */
1097
1121
  done?:
@@ -1219,10 +1243,10 @@ declare namespace gapi.client {
1219
1243
  partitionOptions?:
1220
1244
  PartitionOptions;
1221
1245
  /**
1222
- * Required. The query request to generate partitions for. The request will fail if the query is not root partitionable. The query plan of a root partitionable query has a single
1223
- * distributed union operator. A distributed union operator conceptually divides one or more tables into multiple splits, remotely evaluates a subquery independently on each split, and
1224
- * then unions all results. This must not contain DML commands, such as INSERT, UPDATE, or DELETE. Use ExecuteStreamingSql with a PartitionedDml transaction for large,
1225
- * partition-friendly DML operations.
1246
+ * Required. The query request to generate partitions for. The request will fail if the query is not root partitionable. For a query to be root partitionable, it needs to satisfy a few
1247
+ * conditions. For example, the first operator in the query execution plan must be a distributed union operator. For more information about other conditions, see [Read data in
1248
+ * parallel](https://cloud.google.com/spanner/docs/reads#read_data_in_parallel). The query request must not contain DML commands, such as INSERT, UPDATE, or DELETE. Use
1249
+ * ExecuteStreamingSql with a PartitionedDml transaction for large, partition-friendly DML operations.
1226
1250
  */
1227
1251
  sql?:
1228
1252
  string;
@@ -3775,6 +3799,94 @@ declare namespace gapi.client {
3775
3799
  string;
3776
3800
  },
3777
3801
  body: BatchCreateSessionsRequest): Request<BatchCreateSessionsResponse>;
3802
+ /**
3803
+ * Batches the supplied mutation groups in a collection of efficient transactions. All mutations in a group are committed atomically. However, mutations across groups can be committed
3804
+ * non-atomically in an unspecified order and thus, they must be independent of each other. Partial failure is possible, i.e., some groups may have been committed successfully, while
3805
+ * some may have failed. The results of individual batches are streamed into the response as the batches are applied. BatchWrite requests are not replay protected, meaning that each
3806
+ * mutation group may be applied more than once. Replays of non-idempotent mutations may have undesirable effects. For example, replays of an insert mutation may produce an already
3807
+ * exists error or if you use generated or commit timestamp-based keys, it may result in additional rows being added to the mutation's table. We recommend structuring your mutation
3808
+ * groups to be idempotent to avoid this issue.
3809
+ */
3810
+ batchWrite(request: {
3811
+ /** V1 error format. */
3812
+ "$.xgafv"?:
3813
+ string;
3814
+ /** OAuth access token. */
3815
+ access_token?:
3816
+ string;
3817
+ /** Data format for response. */
3818
+ alt?:
3819
+ string;
3820
+ /** JSONP */
3821
+ callback?:
3822
+ string;
3823
+ /** Selector specifying which fields to include in a partial response. */
3824
+ fields?:
3825
+ string;
3826
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
3827
+ key?:
3828
+ string;
3829
+ /** OAuth 2.0 token for the current user. */
3830
+ oauth_token?:
3831
+ string;
3832
+ /** Returns response with indentations and line breaks. */
3833
+ prettyPrint?:
3834
+ boolean;
3835
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
3836
+ quotaUser?:
3837
+ string;
3838
+ /** Required. The session in which the batch request is to be run. */
3839
+ session:
3840
+ string;
3841
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
3842
+ upload_protocol?:
3843
+ string;
3844
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
3845
+ uploadType?:
3846
+ string;
3847
+ /** Request body */
3848
+ resource:
3849
+ BatchWriteRequest;
3850
+ }): Request<BatchWriteResponse>;
3851
+ batchWrite(request: {
3852
+ /** V1 error format. */
3853
+ "$.xgafv"?:
3854
+ string;
3855
+ /** OAuth access token. */
3856
+ access_token?:
3857
+ string;
3858
+ /** Data format for response. */
3859
+ alt?:
3860
+ string;
3861
+ /** JSONP */
3862
+ callback?:
3863
+ string;
3864
+ /** Selector specifying which fields to include in a partial response. */
3865
+ fields?:
3866
+ string;
3867
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
3868
+ key?:
3869
+ string;
3870
+ /** OAuth 2.0 token for the current user. */
3871
+ oauth_token?:
3872
+ string;
3873
+ /** Returns response with indentations and line breaks. */
3874
+ prettyPrint?:
3875
+ boolean;
3876
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
3877
+ quotaUser?:
3878
+ string;
3879
+ /** Required. The session in which the batch request is to be run. */
3880
+ session:
3881
+ string;
3882
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
3883
+ upload_protocol?:
3884
+ string;
3885
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
3886
+ uploadType?:
3887
+ string;
3888
+ },
3889
+ body: BatchWriteRequest): Request<BatchWriteResponse>;
3778
3890
  /** Begins a new transaction. This step can often be skipped: Read, ExecuteSql and Commit can begin a new transaction as a side-effect. */
3779
3891
  beginTransaction(request: {
3780
3892
  /** V1 error format. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxim_mazurok/gapi.client.spanner-v1",
3
- "version": "0.0.20230918",
3
+ "version": "0.0.20230921",
4
4
  "description": "TypeScript typings for Cloud Spanner API v1",
5
5
  "license": "MIT",
6
6
  "author": {
package/tests.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
4
  // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
5
 
6
- // Revision: 20230918
6
+ // Revision: 20230921
7
7
 
8
8
  gapi.load('client', async () => {
9
9
  /** now we can use gapi.client */
@@ -756,6 +756,102 @@ gapi.load('client', async () => {
756
756
  name: "Test string",
757
757
  },
758
758
  });
759
+ /**
760
+ * Batches the supplied mutation groups in a collection of efficient transactions. All mutations in a group are committed atomically. However, mutations across groups can be committed
761
+ * non-atomically in an unspecified order and thus, they must be independent of each other. Partial failure is possible, i.e., some groups may have been committed successfully, while some
762
+ * may have failed. The results of individual batches are streamed into the response as the batches are applied. BatchWrite requests are not replay protected, meaning that each mutation
763
+ * group may be applied more than once. Replays of non-idempotent mutations may have undesirable effects. For example, replays of an insert mutation may produce an already exists error or
764
+ * if you use generated or commit timestamp-based keys, it may result in additional rows being added to the mutation's table. We recommend structuring your mutation groups to be idempotent
765
+ * to avoid this issue.
766
+ */
767
+ await gapi.client.spanner.projects.instances.databases.sessions.batchWrite({
768
+ session: "Test string",
769
+ }, {
770
+ mutationGroups: [
771
+ {
772
+ mutations: [
773
+ {
774
+ delete: {
775
+ keySet: {
776
+ all: true,
777
+ keys: [
778
+ [
779
+ 42
780
+ ]
781
+ ],
782
+ ranges: [
783
+ {
784
+ endClosed: [
785
+ 42
786
+ ],
787
+ endOpen: [
788
+ 42
789
+ ],
790
+ startClosed: [
791
+ 42
792
+ ],
793
+ startOpen: [
794
+ 42
795
+ ],
796
+ }
797
+ ],
798
+ },
799
+ table: "Test string",
800
+ },
801
+ insert: {
802
+ columns: [
803
+ "Test string"
804
+ ],
805
+ table: "Test string",
806
+ values: [
807
+ [
808
+ 42
809
+ ]
810
+ ],
811
+ },
812
+ insertOrUpdate: {
813
+ columns: [
814
+ "Test string"
815
+ ],
816
+ table: "Test string",
817
+ values: [
818
+ [
819
+ 42
820
+ ]
821
+ ],
822
+ },
823
+ replace: {
824
+ columns: [
825
+ "Test string"
826
+ ],
827
+ table: "Test string",
828
+ values: [
829
+ [
830
+ 42
831
+ ]
832
+ ],
833
+ },
834
+ update: {
835
+ columns: [
836
+ "Test string"
837
+ ],
838
+ table: "Test string",
839
+ values: [
840
+ [
841
+ 42
842
+ ]
843
+ ],
844
+ },
845
+ }
846
+ ],
847
+ }
848
+ ],
849
+ requestOptions: {
850
+ priority: "Test string",
851
+ requestTag: "Test string",
852
+ transactionTag: "Test string",
853
+ },
854
+ });
759
855
  /** Begins a new transaction. This step can often be skipped: Read, ExecuteSql and Commit can begin a new transaction as a side-effect. */
760
856
  await gapi.client.spanner.projects.instances.databases.sessions.beginTransaction({
761
857
  session: "Test string",