1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | import { google } from '../protos/protos';
|
18 | import { CallOptions } from 'google-gax';
|
19 | import { Duplex, Transform } from 'stream';
|
20 | export interface AbortableDuplex extends Duplex {
|
21 | abort(): void;
|
22 | }
|
23 | import { entity, Entity, EntityProto, Entities } from './entity';
|
24 | import { Query, QueryProto, RunQueryOptions, RunQueryResponse, RunQueryCallback } from './query';
|
25 | import { Datastore } from '.';
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | declare class DatastoreRequest {
|
36 | id: string | undefined;
|
37 | requests_: Entity | {
|
38 | mutations: Array<{}>;
|
39 | };
|
40 | requestCallbacks_: Array<(err: Error | null, resp: Entity | null) => void> | Entity;
|
41 | datastore: Datastore;
|
42 | [key: string]: Entity;
|
43 | |
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | static prepareEntityObject_(obj: Entity): PrepareEntityObjectResponse;
|
66 | allocateIds(key: entity.Key, options: AllocateIdsOptions | number): Promise<AllocateIdsResponse>;
|
67 | allocateIds(key: entity.Key, options: AllocateIdsOptions | number, callback: AllocateIdsCallback): void;
|
68 | |
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 | createReadStream(keys: Entities, options?: CreateReadStreamOptions): Transform;
|
93 | delete(keys: Entities, gaxOptions?: CallOptions): Promise<DeleteResponse>;
|
94 | delete(keys: Entities, callback: DeleteCallback): void;
|
95 | delete(keys: Entities, gaxOptions: CallOptions, callback: DeleteCallback): void;
|
96 | get(keys: entity.Key | entity.Key[], options?: CreateReadStreamOptions): Promise<GetResponse>;
|
97 | get(keys: entity.Key | entity.Key[], callback: GetCallback): void;
|
98 | get(keys: entity.Key | entity.Key[], options: CreateReadStreamOptions, callback: GetCallback): void;
|
99 | runQuery(query: Query, options?: RunQueryOptions): Promise<RunQueryResponse>;
|
100 | runQuery(query: Query, options: RunQueryOptions, callback: RunQueryCallback): void;
|
101 | runQuery(query: Query, callback: RunQueryCallback): void;
|
102 | |
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 | runQueryStream(query: Query, options?: RunQueryStreamOptions): Transform;
|
134 | merge(entities: Entities): Promise<CommitResponse>;
|
135 | merge(entities: Entities, callback: SaveCallback): void;
|
136 | |
137 |
|
138 |
|
139 | prepareGaxRequest_(config: RequestConfig, callback: Function): void;
|
140 | request_(config: RequestConfig, callback: RequestCallback): void;
|
141 | |
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 |
|
148 |
|
149 |
|
150 | requestStream_(config: RequestConfig): AbortableDuplex;
|
151 | }
|
152 | export interface ConsistencyProtoCode {
|
153 | [key: string]: number;
|
154 | }
|
155 | export declare type AllocateIdsResponse = [entity.Key[], google.datastore.v1.IAllocateIdsResponse];
|
156 | export interface AllocateIdsCallback {
|
157 | (a: Error | null, b: entity.Key[] | null, c: google.datastore.v1.IAllocateIdsResponse): void;
|
158 | }
|
159 | export interface AllocateIdsOptions {
|
160 | allocations?: number;
|
161 | gaxOptions?: CallOptions;
|
162 | }
|
163 | export declare type CreateReadStreamOptions = RunQueryOptions;
|
164 | export interface GetCallback {
|
165 | (err?: Error | null, entity?: Entities): void;
|
166 | }
|
167 | export declare type GetResponse = [Entities];
|
168 | export interface Mutation {
|
169 | [key: string]: EntityProto;
|
170 | }
|
171 | export interface PrepareEntityObject {
|
172 | [key: string]: google.datastore.v1.Key | undefined;
|
173 | }
|
174 | export interface PrepareEntityObjectResponse {
|
175 | key?: google.datastore.v1.Key;
|
176 | data?: google.datastore.v1.Entity;
|
177 | method?: string;
|
178 | }
|
179 | export interface RequestCallback {
|
180 | (a?: Error | null, b?: any): void;
|
181 | }
|
182 | export interface RequestConfig {
|
183 | client: string;
|
184 | gaxOpts?: CallOptions;
|
185 | method: string;
|
186 | prepared?: boolean;
|
187 | reqOpts?: RequestOptions;
|
188 | }
|
189 | export interface RequestOptions {
|
190 | mutations?: google.datastore.v1.IMutation[];
|
191 | keys?: Entity;
|
192 | readOptions?: {
|
193 | readConsistency?: number;
|
194 | transaction?: string;
|
195 | };
|
196 | partitionId?: google.datastore.v1.IPartitionId | null;
|
197 | transactionOptions?: {
|
198 | readOnly?: {};
|
199 | readWrite?: {
|
200 | previousTransaction?: string;
|
201 | };
|
202 | } | null;
|
203 | transaction?: string | null;
|
204 | mode?: string;
|
205 | projectId?: string;
|
206 | query?: QueryProto;
|
207 | filter?: string;
|
208 | indexId?: string;
|
209 | entityFilter?: google.datastore.admin.v1.IEntityFilter;
|
210 | }
|
211 | export declare type RunQueryStreamOptions = RunQueryOptions;
|
212 | export interface CommitCallback {
|
213 | (err?: Error | null, resp?: google.datastore.v1.ICommitResponse): void;
|
214 | }
|
215 | export declare type CommitResponse = [google.datastore.v1.ICommitResponse];
|
216 | export declare type SaveCallback = CommitCallback;
|
217 | export declare type SaveResponse = CommitResponse;
|
218 | export declare type DeleteCallback = CommitCallback;
|
219 | export declare type DeleteResponse = CommitResponse;
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 | export { DatastoreRequest };
|