1 | /*!
|
2 | * Copyright 2018 Google LLC.
|
3 | *
|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | * you may not use this file except in compliance with the License.
|
6 | * You may obtain a copy of the License at
|
7 | *
|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
9 | *
|
10 | * Unless required by applicable law or agreed to in writing, software
|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13 | * See the License for the specific language governing permissions and
|
14 | * limitations under the License.
|
15 | */
|
16 | /// <reference types="node" />
|
17 | import { ClientStub, ChannelCredentials, GoogleAuth, GoogleAuthOptions, CallOptions, Operation, ServiceError } from 'google-gax';
|
18 | import { entity, Entities, Entity, ValueProto } from './entity';
|
19 | import Key = entity.Key;
|
20 | export { Entity, Key };
|
21 | import { GetIndexesCallback, GetIndexesOptions, GetIndexesResponse, Index } from './index-class';
|
22 | import { Query } from './query';
|
23 | import { DatastoreRequest, CommitCallback, CommitResponse, SaveCallback, SaveResponse } from './request';
|
24 | import { Transaction } from './transaction';
|
25 | import { google } from '../protos/protos';
|
26 | export declare type PathType = string | number | entity.Int;
|
27 | export interface BooleanObject {
|
28 | [key: string]: boolean;
|
29 | }
|
30 | export interface EntityProtoReduceAccumulator {
|
31 | [key: string]: ValueProto;
|
32 | }
|
33 | export interface EntityProtoReduceData {
|
34 | value: ValueProto;
|
35 | excludeFromIndexes: ValueProto;
|
36 | name: string | number;
|
37 | }
|
38 | export declare type UpdateCallback = CommitCallback;
|
39 | export declare type UpdateResponse = CommitResponse;
|
40 | export declare type UpsertCallback = CommitCallback;
|
41 | export declare type UpsertResponse = CommitResponse;
|
42 | export declare type InsertCallback = CommitCallback;
|
43 | export declare type InsertResponse = CommitResponse;
|
44 | export interface LongRunningCallback {
|
45 | (err: ServiceError | null, operation?: Operation, apiResponse?: google.longrunning.IOperation): void;
|
46 | }
|
47 | export declare type LongRunningResponse = [Operation, google.longrunning.IOperation];
|
48 | export interface ExportEntitiesConfig extends Omit<google.datastore.admin.v1.IExportEntitiesRequest, 'projectId'> {
|
49 | bucket?: string | {
|
50 | name: string;
|
51 | };
|
52 | kinds?: string[];
|
53 | namespaces?: string[];
|
54 | gaxOptions?: CallOptions;
|
55 | }
|
56 | export interface ImportEntitiesConfig extends Omit<google.datastore.admin.v1.IImportEntitiesRequest, 'projectId'> {
|
57 | file?: string | {
|
58 | bucket: {
|
59 | name: string;
|
60 | };
|
61 | name: string;
|
62 | };
|
63 | kinds?: string[];
|
64 | namespaces?: string[];
|
65 | gaxOptions?: CallOptions;
|
66 | }
|
67 | /**
|
68 | * Idiomatic class for interacting with Cloud Datastore. Uses the lower-level
|
69 | * {@link DatastoreClient} class under the hood.
|
70 | *
|
71 | * In addition to the constructor options shown here, the {@link Datastore}
|
72 | * class constructor accepts the same options accepted by
|
73 | * {@link DatastoreClient}.
|
74 | *
|
75 | * <h4>The Datastore Emulator</h4>
|
76 | *
|
77 | * Make sure you have the <a href="https://cloud.google.com/sdk/downloads">
|
78 | * gcloud SDK installed</a>, then run:
|
79 | *
|
80 | * <pre>
|
81 | * $ gcloud beta emulators datastore start --no-legacy
|
82 | * </pre>
|
83 | *
|
84 | * You will see the following printed:
|
85 | *
|
86 | * <pre>
|
87 | * [datastore] API endpoint: http://localhost:8005
|
88 | * [datastore] If you are using a library that supports the
|
89 | * DATASTORE_EMULATOR_HOST environment variable, run:
|
90 | * [datastore]
|
91 | * [datastore] export DATASTORE_EMULATOR_HOST=localhost:8005
|
92 | * [datastore]
|
93 | * [datastore] Dev App Server is now running.
|
94 | * </pre>
|
95 | *
|
96 | * Set that environment variable and your localhost Datastore will
|
97 | * automatically be used. You can also pass this address in manually with
|
98 | * `apiEndpoint`.
|
99 | *
|
100 | * Additionally, `DATASTORE_PROJECT_ID` is recognized. If you have this set,
|
101 | * you don't need to provide a `projectId`.
|
102 | *
|
103 | *
|
104 | * See {@link https://cloud.google.com/datastore/docs/concepts/overview| Cloud Datastore Concepts Overview}
|
105 | *
|
106 | * @param {object} [options] Configuration options.
|
107 | * @param {string} [options.apiEndpoint] Override the default API endpoint used
|
108 | * to reach Datastore. This is useful for connecting to your local Datastore
|
109 | * server (usually "http://localhost:8080").
|
110 | * @param {string} [options.namespace] Namespace to isolate transactions to.
|
111 | *
|
112 | * @example Import the client library
|
113 | * ```
|
114 | * const {Datastore} = require('@google-cloud/datastore');
|
115 | *
|
116 | * ```
|
117 | * @example Create a client that uses <a href="https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application">Application Default Credentials (ADC)</a>:
|
118 | * ```
|
119 | * const datastore = new Datastore();
|
120 | *
|
121 | * ```
|
122 | * @example Create a client with <a href="https://cloud.google.com/docs/authentication/production#obtaining_and_providing_service_account_credentials_manually">explicit credentials</a>:
|
123 | * ```
|
124 | * const datastore = new Datastore({
|
125 | * projectId: 'your-project-id',
|
126 | * keyFilename: '/path/to/keyfile.json'
|
127 | * });
|
128 | *
|
129 | * ```
|
130 | * @example Retrieving Records
|
131 | * ```
|
132 | * const {Datastore} = require('@google-cloud/datastore');
|
133 | * const datastore = new Datastore();
|
134 | *
|
135 | * // Records, called "entities" in Datastore, are retrieved by using a key. The
|
136 | * // key is more than a numeric identifier, it is a complex data structure that
|
137 | * // can be used to model relationships. The simplest key has a string `kind`
|
138 | * // value, and either a numeric `id` value, or a string `name` value.
|
139 | * //
|
140 | * // A single record can be retrieved with {@link Datastore#key} and
|
141 | * // {@link Datastore#get}.
|
142 | * //-
|
143 | * const key = datastore.key(['Company', 'Google']);
|
144 | *
|
145 | * datastore.get(key, function(err, entity) {
|
146 | * // entity = The record.
|
147 | * // entity[datastore.KEY] = The key for this entity.
|
148 | * });
|
149 | *
|
150 | * //-
|
151 | * // <h3>Querying Records</h3>
|
152 | * //
|
153 | * // Create a query with {@link Datastore#createQuery}.
|
154 | * //-
|
155 | * const query = datastore.createQuery('Company');
|
156 | *
|
157 | * //-
|
158 | * // Multiple records can be found that match criteria with
|
159 | * // {@link Query#filter}.
|
160 | * //-
|
161 | * query.filter('location', 'CA');
|
162 | *
|
163 | * //-
|
164 | * // Records can also be ordered with {@link Query#order}.
|
165 | * //-
|
166 | * query.order('name');
|
167 | *
|
168 | * //-
|
169 | * // The number of records returned can be specified with
|
170 | * // {@link Query#limit}.
|
171 | * //-
|
172 | * query.limit(5);
|
173 | *
|
174 | * //-
|
175 | * // Records' key structures can also be queried with
|
176 | * // {@link Query#hasAncestor}.
|
177 | * //-
|
178 | * const ancestorKey = datastore.key(['ParentCompany', 'Alphabet']);
|
179 | *
|
180 | * query.hasAncestor(ancestorKey);
|
181 | *
|
182 | * //-
|
183 | * // Run the query with {@link Datastore#runQuery}.
|
184 | * //-
|
185 | * datastore.runQuery(query, (err, entities) => {
|
186 | * // entities = An array of records.
|
187 | *
|
188 | * // Access the Key object for an entity.
|
189 | * const firstEntityKey = entities[0][datastore.KEY];
|
190 | * });
|
191 | *
|
192 | * ```
|
193 | * @example Paginating Records
|
194 | * ```
|
195 | * // Imagine building a website that allows a user to sift through hundreds of
|
196 | * // their contacts. You'll likely want to only display a subset of these at
|
197 | * // once, so you set a limit.
|
198 | * //-
|
199 | * const express = require('express');
|
200 | * const app = express();
|
201 | *
|
202 | * const NUM_RESULTS_PER_PAGE = 15;
|
203 | *
|
204 | * app.get('/contacts', (req, res) => {
|
205 | * const query = datastore.createQuery('Contacts')
|
206 | * .limit(NUM_RESULTS_PER_PAGE);
|
207 | *
|
208 | * if (req.query.nextPageCursor) {
|
209 | * query.start(req.query.nextPageCursor);
|
210 | * }
|
211 | *
|
212 | * datastore.runQuery(query, (err, entities, info) => {
|
213 | * if (err) {
|
214 | * // Error handling omitted.
|
215 | * return;
|
216 | * }
|
217 | *
|
218 | * // Respond to the front end with the contacts and the cursoring token
|
219 | * // from the query we just ran.
|
220 | * const frontEndResponse = {
|
221 | * contacts: entities
|
222 | * };
|
223 | *
|
224 | * // Check if more results may exist.
|
225 | * if (info.moreResults !== datastore.NO_MORE_RESULTS) {
|
226 | * frontEndResponse.nextPageCursor = info.endCursor;
|
227 | * }
|
228 | *
|
229 | * res.render('contacts', frontEndResponse);
|
230 | * });
|
231 | * });
|
232 | *
|
233 | * ```
|
234 | * @example Creating Records
|
235 | * ```
|
236 | * // New entities can be created and persisted with {@link Datastore#save}.
|
237 | * // The entitiy must have a key to be saved. If you don't specify an
|
238 | * // identifier for the key, one is generated for you.
|
239 | * //
|
240 | * // We will create a key with a `name` identifier, "Google".
|
241 | * //-
|
242 | * const key = datastore.key(['Company', 'Google']);
|
243 | *
|
244 | * const data = {
|
245 | * name: 'Google',
|
246 | * location: 'CA'
|
247 | * };
|
248 | *
|
249 | * datastore.save({
|
250 | * key: key,
|
251 | * data: data
|
252 | * }, (err) => {
|
253 | * if (!err) {
|
254 | * // Record saved successfully.
|
255 | * }
|
256 | * });
|
257 | *
|
258 | * //-
|
259 | * // We can verify the data was saved by using {@link Datastore#get}.
|
260 | * //-
|
261 | * datastore.get(key, (err, entity) => {
|
262 | * // entity = {
|
263 | * // name: 'Google',
|
264 | * // location: 'CA'
|
265 | * // }
|
266 | * });
|
267 | *
|
268 | * //-
|
269 | * // If we want to update this record, we can modify the data object and re-
|
270 | * // save it.
|
271 | * //-
|
272 | * data.symbol = 'GOOG';
|
273 | *
|
274 | * datastore.save({
|
275 | * key: key, // defined above (datastore.key(['Company', 'Google']))
|
276 | * data: data
|
277 | * }, (err, entity) => {
|
278 | * if (!err) {
|
279 | * // Record updated successfully.
|
280 | * }
|
281 | * });
|
282 | *
|
283 | * ```
|
284 | * @example Deleting Records
|
285 | * ```
|
286 | * // Entities can be removed from Datastore by passing the entity's key object
|
287 | * // to {@link Datastore#delete}.
|
288 | * //-
|
289 | * const key = datastore.key(['Company', 'Google']);
|
290 | *
|
291 | * datastore.delete(key, (err) => {
|
292 | * if (!err) {
|
293 | * // Record deleted successfully.
|
294 | * }
|
295 | * });
|
296 | *
|
297 | * ```
|
298 | * @example Transactions
|
299 | * ```
|
300 | * // Complex logic can be wrapped in a transaction with
|
301 | * // {@link Datastore#transaction}. All queries and updates run within
|
302 | * // the transaction will be applied when the `done` function is called.
|
303 | * //-
|
304 | * const transaction = datastore.transaction();
|
305 | *
|
306 | * transaction.run((err) => {
|
307 | * if (err) {
|
308 | * // Error handling omitted.
|
309 | * }
|
310 | *
|
311 | * const key = datastore.key(['Company', 'Google']);
|
312 | *
|
313 | * transaction.get(key, (err, entity) => {
|
314 | * if (err) {
|
315 | * // Error handling omitted.
|
316 | * }
|
317 | *
|
318 | * entity.symbol = 'GOOG';
|
319 | *
|
320 | * transaction.save(entity);
|
321 | *
|
322 | * transaction.commit((err) => {
|
323 | * if (!err) {
|
324 | * // Transaction committed successfully.
|
325 | * }
|
326 | * });
|
327 | * });
|
328 | * });
|
329 | *
|
330 | * ```
|
331 | * @example Queries with Ancestors
|
332 | * ```
|
333 | * const {Datastore} = require('@google-cloud/datastore');
|
334 | * const datastore = new Datastore();
|
335 | *
|
336 | * const customerId1 = 2993844;
|
337 | * const customerId2 = 4993882;
|
338 | * const customerKey1 = datastore.key(['Customer', customerId1]);
|
339 | * const customerKey2 = datastore.key(['Customer', customerId2]);
|
340 | * const cookieKey1 = datastore.key(['Customer', customerId1, 'Cookie',
|
341 | * 'cookie28839']); // child entity const cookieKey2 =
|
342 | * datastore.key(['Customer', customerId1, 'Cookie', 'cookie78984']); // child
|
343 | * entity const cookieKey3 = datastore.key(['Customer', customerId2, 'Cookie',
|
344 | * 'cookie93911']); // child entity
|
345 | *
|
346 | * const entities = [];
|
347 | *
|
348 | * entities.push({
|
349 | * key: customerKey1,
|
350 | * data: {
|
351 | * name: 'Jane Doe',
|
352 | * address: '4848 Liller'
|
353 | * }
|
354 | * });
|
355 | *
|
356 | * entities.push({
|
357 | * key: customerKey2,
|
358 | * data: {
|
359 | * name: 'John Smith',
|
360 | * address: '4848 Pine'
|
361 | * }
|
362 | * });
|
363 | *
|
364 | * entities.push({
|
365 | * key: cookieKey1,
|
366 | * data: {
|
367 | * cookieVal: 'dj83kks88rkld'
|
368 | * }
|
369 | * });
|
370 | *
|
371 | * entities.push({
|
372 | * key: cookieKey2,
|
373 | * data: {
|
374 | * cookieVal: 'sj843ka99s'
|
375 | * }
|
376 | * });
|
377 | *
|
378 | * entities.push({
|
379 | * key: cookieKey3,
|
380 | * data: {
|
381 | * cookieVal: 'otk82k2kw'
|
382 | * }
|
383 | * });
|
384 | *
|
385 | * datastore.upsert(entities);
|
386 | *
|
387 | * const query = datastore.createQuery().hasAncestor(customerKey1);
|
388 | *
|
389 | * datastore.runQuery(query, (err, entities) => {
|
390 | * for (let entity of entities) {
|
391 | * console.log(entity[datastore.KEY]);
|
392 | * }
|
393 | * });
|
394 | *
|
395 | * const query2 = datastore.createQuery().hasAncestor(customerKey2);
|
396 | *
|
397 | * datastore.runQuery(query2, (err, entities) => {
|
398 | * for (let entity of entities) {
|
399 | * console.log(entity[datastore.KEY]);
|
400 | * }
|
401 | * });
|
402 | *
|
403 | * datastore.runQuery(query2, (entities) => {
|
404 | * console.log(entities);
|
405 | * });
|
406 | * ```
|
407 | */
|
408 | declare class Datastore extends DatastoreRequest {
|
409 | clients_: Map<string, ClientStub>;
|
410 | namespace?: string;
|
411 | defaultBaseUrl_: string;
|
412 | options: DatastoreOptions;
|
413 | baseUrl_?: string;
|
414 | port_?: number;
|
415 | customEndpoint_?: boolean;
|
416 | auth: GoogleAuth;
|
417 | constructor(options?: DatastoreOptions);
|
418 | /**
|
419 | * Export entities from this project to a Google Cloud Storage bucket.
|
420 | *
|
421 | * @param {ExportEntitiesConfig} config Configuration object.
|
422 | * string | Bucket} config.bucket The `gs://bucket` path or a
{ |
423 | * -cloud/storage Bucket object.
|
424 | * string[]} [config.kinds] The kinds to include in this import.
{ |
425 | * string[]} [config.namespaces] The namespace IDs to include in this
{ |
426 | * import.
|
427 | * {object} [config.gaxOptions] Request configuration options, outlined
|
428 | * here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.
|
429 | * function} callback The callback function.
{ |
430 | * @param {?error} callback.err An error returned while making this request.
|
431 | * @param {Operation} callback.operation An operation object that can be used
|
432 | * to check the status of the request.
|
433 | */
|
434 | export(config: ExportEntitiesConfig): Promise<LongRunningResponse>;
|
435 | export(config: ExportEntitiesConfig, callback: LongRunningCallback): void;
|
436 | /**
|
437 | * Get all of the indexes in this project.
|
438 | *
|
439 | * @param {GetIndexesOptions | GetIndexesCallback} [optionsOrCallback]
|
440 | * @param {object} [options.gaxOptions] Request configuration options,
|
441 | * outlined here:
|
442 | * https://googleapis.github.io/gax-nodejs/global.html#CallOptions.
|
443 | * @param {GetIndexesResponse} [callback] The callback function.
|
444 | * @param {?error} callback.error An error returned while making this request.
|
445 | * @param {Index[]} callback.indexes All matching Index instances.
|
446 | * @param {object} callback.apiResponse The full API response.
|
447 | * @return {void | Promise<GetIndexesResponse>}
|
448 | */
|
449 | getIndexes(options?: GetIndexesOptions): Promise<GetIndexesResponse>;
|
450 | getIndexes(options: GetIndexesOptions, callback: GetIndexesCallback): void;
|
451 | getIndexes(callback: GetIndexesCallback): void;
|
452 | /**
|
453 | * Get all of the indexes in this project as a readable object stream.
|
454 | *
|
455 | * @param {GetIndexesOptions} [options] Configuration object. See
|
456 | * {@link Datastore#getIndexes} for a complete list of options.
|
457 | * @returns {ReadableStream<Index>}
|
458 | */
|
459 | getIndexesStream(options?: GetIndexesOptions): NodeJS.ReadableStream;
|
460 | getProjectId(): Promise<string>;
|
461 | /**
|
462 | * Import entities into this project from a remote file.
|
463 | *
|
464 | * @param {ImportEntitiesConfig} config Configuration object.
|
465 | * @param {string | File} config.file The `gs://bucket/file` path or a
|
466 | * @google-cloud/storage File object.
|
467 | * @param {string[]} [config.kinds] The kinds to include in this import.
|
468 | * @param {string[]} [config.namespaces] The namespace IDs to include in this
|
469 | * import.
|
470 | * @param {object} [config.gaxOptions] Request configuration options, outlined
|
471 | * here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions.
|
472 | * @param {function} callback The callback function.
|
473 | * @param {?error} callback.err An error returned while making this request.
|
474 | * @param {Operation} callback.operation An operation object that can be used
|
475 | * to check the status of the request.
|
476 | */
|
477 | import(config: ImportEntitiesConfig): Promise<LongRunningResponse>;
|
478 | import(config: ImportEntitiesConfig, callback: LongRunningCallback): void;
|
479 | /**
|
480 | * Get a reference to an Index.
|
481 | *
|
482 | * @param {string} id The index name or id.
|
483 | * @returns {Index}
|
484 | */
|
485 | index(id: string): Index;
|
486 | /**
|
487 | * Maps to {@link Datastore#save}, forcing the method to be `insert`.
|
488 | *
|
489 | * @param {object|object[]} entities Datastore key object(s).
|
490 | * @param {Key} entities.key Datastore key object.
|
491 | * @param {string[]} [entities.excludeFromIndexes] Exclude properties from
|
492 | * indexing using a simple JSON path notation. See the examples in
|
493 | * {@link Datastore#save} to see how to target properties at different
|
494 | * levels of nesting within your entity.
|
495 | * @param {object} entities.data Data to save with the provided key.
|
496 | * @param {function} callback The callback function.
|
497 | * @param {?error} callback.err An error returned while making this request
|
498 | * @param {object} callback.apiResponse The full API response.
|
499 | */
|
500 | insert(entities: Entities): Promise<InsertResponse>;
|
501 | insert(entities: Entities, callback: InsertCallback): void;
|
502 | /**
|
503 | * Insert or update the specified object(s). If a key is incomplete, its
|
504 | * associated object is inserted and the original Key object is updated to
|
505 | * contain the generated ID.
|
506 | *
|
507 | * This method will determine the correct Datastore method to execute
|
508 | * (`upsert`, `insert`, or `update`) by using the key(s) provided. For
|
509 | * example, if you provide an incomplete key (one without an ID), the request
|
510 | * will create a new entity and have its ID automatically assigned. If you
|
511 | * provide a complete key, the entity will be updated with the data specified.
|
512 | *
|
513 | * By default, all properties are indexed. To prevent a property from being
|
514 | * included in *all* indexes, you must supply an `excludeFromIndexes` array.
|
515 | *
|
516 | * To prevent large properties from being included in *all* indexes, you must supply
|
517 | * `excludeLargeProperties: true`.
|
518 | * See below for an example.
|
519 | *
|
520 | * @borrows {@link Transaction#save} as save
|
521 | *
|
522 | * @throws {Error} If an unrecognized method is provided.
|
523 | *
|
524 | * @param {object|object[]} entities Datastore key object(s).
|
525 | * @param {Key} entities.key Datastore key object.
|
526 | * @param {string[]} [entities.excludeFromIndexes] Exclude properties from
|
527 | * indexing using a simple JSON path notation. See the example below to
|
528 | * see how to target properties at different levels of nesting within your
|
529 | * @param {boolean} [entities.excludeLargeProperties] Automatically exclude
|
530 | * large properties from indexing. It help in storing large values.
|
531 | * @param {string} [entities.method] Explicit method to use, either 'insert',
|
532 | * 'update', or 'upsert'.
|
533 | * @param {object} entities.data Data to save with the provided key.
|
534 | * entity.
|
535 | * @param {object} [gaxOptions] Request configuration options, outlined here:
|
536 | * https://googleapis.github.io/gax-nodejs/global.html#CallOptions.
|
537 | * @param {function} callback The callback function.
|
538 | * @param {?error} callback.err An error returned while making this request
|
539 | * @param {object} callback.apiResponse The full API response.
|
540 | *
|
541 | * @example
|
542 | * ```
|
543 | * //-
|
544 | * // Save a single entity.
|
545 | * //
|
546 | * // Notice that we are providing an incomplete key. After saving, the
|
547 | * // original Key object used to save will be updated to contain the path
|
548 | * // with its generated ID.
|
549 | * //-
|
550 | * const key = datastore.key('Company');
|
551 | * const entity = {
|
552 | * key: key,
|
553 | * data: {
|
554 | * rating: '10'
|
555 | * }
|
556 | * };
|
557 | *
|
558 | * datastore.save(entity, (err) => {
|
559 | * console.log(key.path); // [ 'Company', 5669468231434240 ]
|
560 | * console.log(key.namespace); // undefined
|
561 | * });
|
562 | *
|
563 | * //-
|
564 | * // Save a single entity using a provided name instead of auto-generated ID.
|
565 | * //
|
566 | * // Here we are providing a key with name instead of an ID. After saving,
|
567 | * // the original Key object used to save will be updated to contain the
|
568 | * // path with the name instead of a generated ID.
|
569 | * //-
|
570 | * const key = datastore.key(['Company', 'donutshack']);
|
571 | * const entity = {
|
572 | * key: key,
|
573 | * data: {
|
574 | * name: 'DonutShack',
|
575 | * rating: 8
|
576 | * }
|
577 | * };
|
578 | *
|
579 | * datastore.save(entity, (err) => {
|
580 | * console.log(key.path); // ['Company', 'donutshack']
|
581 | * console.log(key.namespace); // undefined
|
582 | * });
|
583 | *
|
584 | * //-
|
585 | * // Save a single entity with a provided namespace. Namespaces allow for
|
586 | * // multitenancy. To read more about this, see
|
587 | * // [the Datastore docs on key concepts](https://goo.gl/M1LUAu).
|
588 | * //
|
589 | * // Here we are providing a key with namespace.
|
590 | * //-
|
591 | * const key = datastore.key({
|
592 | * namespace: 'my-namespace',
|
593 | * path: ['Company', 'donutshack']
|
594 | * });
|
595 | *
|
596 | * const entity = {
|
597 | * key: key,
|
598 | * data: {
|
599 | * name: 'DonutShack',
|
600 | * rating: 8
|
601 | * }
|
602 | * };
|
603 | *
|
604 | * datastore.save(entity, (err) => {
|
605 | * console.log(key.path); // ['Company', 'donutshack']
|
606 | * console.log(key.namespace); // 'my-namespace'
|
607 | * });
|
608 | *
|
609 | * //-
|
610 | * // Save different types of data, including ints, doubles, dates, booleans,
|
611 | * // blobs, and lists.
|
612 | * //
|
613 | * // Notice that we are providing an incomplete key. After saving, the
|
614 | * // original Key object used to save will be updated to contain the path
|
615 | * // with its generated ID.
|
616 | * //-
|
617 | * const key = datastore.key('Company');
|
618 | * const entity = {
|
619 | * key: key,
|
620 | * data: {
|
621 | * name: 'DonutShack',
|
622 | * rating: datastore.int(10),
|
623 | * worth: datastore.double(123456.78),
|
624 | * location: datastore.geoPoint({
|
625 | * latitude: 40.6894,
|
626 | * longitude: -74.0447
|
627 | * }),
|
628 | * numDonutsServed: 45,
|
629 | * founded: new Date('Tue May 12 2015 15:30:00 GMT-0400 (EDT)'),
|
630 | * isStartup: true,
|
631 | * donutEmoji: Buffer.from('\uD83C\uDF69'),
|
632 | * keywords: [
|
633 | * 'donut',
|
634 | * 'coffee',
|
635 | * 'yum'
|
636 | * ]
|
637 | * }
|
638 | * };
|
639 | *
|
640 | * datastore.save(entity, (err, apiResponse) => {});
|
641 | *
|
642 | * //-
|
643 | * // Use an array, `excludeFromIndexes`, to exclude properties from indexing.
|
644 | * // This will allow storing string values larger than 1500 bytes.
|
645 | * //-
|
646 | * const entity = {
|
647 | * key: datastore.key('Company'),
|
648 | * excludeFromIndexes: [
|
649 | * 'description',
|
650 | * 'embeddedEntity.description',
|
651 | * 'arrayValue[]',
|
652 | * 'arrayValue[].description'
|
653 | * ],
|
654 | * data: {
|
655 | * description: 'Long string (...)',
|
656 | * embeddedEntity: {
|
657 | * description: 'Long string (...)'
|
658 | * },
|
659 | * arrayValue: [
|
660 | * 'Long string (...)',
|
661 | * {
|
662 | * description: 'Long string (...)'
|
663 | * }
|
664 | * ]
|
665 | * }
|
666 | * };
|
667 | *
|
668 | * datastore.save(entity, (err, apiResponse) => {});
|
669 | *
|
670 | * //-
|
671 | * // Use boolean `excludeLargeProperties`, to auto exclude Large properties from indexing.
|
672 | * // This will allow storing string values larger than 1500 bytes.
|
673 | * //-
|
674 | * const entity = {
|
675 | * key: datastore.key('Company'),
|
676 | * data: {
|
677 | * description: 'Long string (...)',
|
678 | * embeddedEntity: {
|
679 | * description: 'Long string (...)'
|
680 | * },
|
681 | * arrayValue: [
|
682 | * 'Long string (...)',
|
683 | * {
|
684 | * description: 'Long string (...)'
|
685 | * }
|
686 | * ]
|
687 | * },
|
688 | * excludeLargeProperties: true
|
689 | * };
|
690 | *
|
691 | * datastore.save(entity, (err, apiResponse) => {});
|
692 | *
|
693 | * //-
|
694 | * // Save multiple entities at once.
|
695 | * //-
|
696 | * const companyKey = datastore.key(['Company', 123]);
|
697 | * const productKey = datastore.key(['Product', 'Computer']);
|
698 | * const entities = [
|
699 | * {
|
700 | * key: companyKey,
|
701 | * data: {
|
702 | * HQ: 'Dallas, TX'
|
703 | * }
|
704 | * },
|
705 | * {
|
706 | * key: productKey,
|
707 | * data: {
|
708 | * vendor: 'Dell'
|
709 | * }
|
710 | * }
|
711 | * ];
|
712 | *
|
713 | * datastore.save(entities, (err, apiResponse) => {});
|
714 | *
|
715 | * //-
|
716 | * // Explicitly attempt to 'insert' a specific entity.
|
717 | * //-
|
718 | * const userKey = datastore.key(['User', 'chilts']);
|
719 | * const entity = {
|
720 | * key: userKey,
|
721 | * method: 'insert',
|
722 | * data: {
|
723 | * fullName: 'Andrew Chilton'
|
724 | * }
|
725 | * };
|
726 | *
|
727 | * datastore.save(entity, (err, apiResponse) => {});
|
728 | *
|
729 | * //-
|
730 | * // Returns a Promise if callback is omitted.
|
731 | * //-
|
732 | * datastore.save(entity).then((data) => {
|
733 | * const apiResponse = data[0];
|
734 | * });
|
735 | * ```
|
736 | */
|
737 | save(entities: Entities, gaxOptions?: CallOptions): Promise<SaveResponse>;
|
738 | save(entities: Entities, gaxOptions: CallOptions, callback: SaveCallback): void;
|
739 | save(entities: Entities, callback: SaveCallback): void;
|
740 | /**
|
741 | * Maps to {@link Datastore#save}, forcing the method to be `update`.
|
742 | *
|
743 | * @param {object|object[]} entities Datastore key object(s).
|
744 | * @param {Key} entities.key Datastore key object.
|
745 | * @param {string[]} [entities.excludeFromIndexes] Exclude properties from
|
746 | * indexing using a simple JSON path notation. See the examples in
|
747 | * {@link Datastore#save} to see how to target properties at different
|
748 | * levels of nesting within your entity.
|
749 | * @param {object} entities.data Data to save with the provided key.
|
750 | * @param {function} callback The callback function.
|
751 | * @param {?error} callback.err An error returned while making this request
|
752 | * @param {object} callback.apiResponse The full API response.
|
753 | */
|
754 | update(entities: Entities): Promise<UpdateResponse>;
|
755 | update(entities: Entities, callback: UpdateCallback): void;
|
756 | /**
|
757 | * Maps to {@link Datastore#save}, forcing the method to be `upsert`.
|
758 | *
|
759 | * @param {object|object[]} entities Datastore key object(s).
|
760 | * @param {Key} entities.key Datastore key object.
|
761 | * @param {string[]} [entities.excludeFromIndexes] Exclude properties from
|
762 | * indexing using a simple JSON path notation. See the examples in
|
763 | * {@link Datastore#save} to see how to target properties at different
|
764 | * levels of nesting within your entity.
|
765 | * @param {object} entities.data Data to save with the provided key.
|
766 | * @param {function} callback The callback function.
|
767 | * @param {?error} callback.err An error returned while making this request
|
768 | * @param {object} callback.apiResponse The full API response.
|
769 | */
|
770 | upsert(entities: Entities): Promise<UpsertResponse>;
|
771 | upsert(entities: Entities, callback: UpsertCallback): void;
|
772 | /**
|
773 | * Helper function to get a Datastore Double object.
|
774 | *
|
775 | * @param {number} value The double value.
|
776 | * @returns {object}
|
777 | *
|
778 | * @example
|
779 | * ```
|
780 | * const {Datastore} = require('@google-cloud/datastore');
|
781 | * const datastore = new Datastore();
|
782 | * const threeDouble = datastore.double(3.0);
|
783 | * ```
|
784 | */
|
785 | static double(value: number): entity.Double;
|
786 | double(value: number): entity.Double;
|
787 | /**
|
788 | * Helper function to check if something is a Datastore Double object.
|
789 | *
|
790 | * @param {*} value
|
791 | * @returns {boolean}
|
792 | *
|
793 | * @example
|
794 | * ```
|
795 | * const {Datastore} = require('@google-cloud/datastore');
|
796 | * const datastore = new Datastore();
|
797 | * datastore.isDouble(0.42); // false
|
798 | * datastore.isDouble(datastore.double(0.42)); // true
|
799 | * ```
|
800 | */
|
801 | static isDouble(value?: {}): boolean;
|
802 | isDouble(value?: {}): boolean;
|
803 | /**
|
804 | * Helper function to get a Datastore Geo Point object.
|
805 | *
|
806 | * @param {object} coordinates Coordinate value.
|
807 | * @param {number} coordinates.latitude Latitudinal value.
|
808 | * @param {number} coordinates.longitude Longitudinal value.
|
809 | * @returns {object}
|
810 | *
|
811 | * @example
|
812 | * ```
|
813 | * const {Datastore} = require('@google-cloud/datastore');
|
814 | * const datastore = new Datastore();
|
815 | * const coordinates = {
|
816 | * latitude: 40.6894,
|
817 | * longitude: -74.0447
|
818 | * };
|
819 | *
|
820 | * const geoPoint = datastore.geoPoint(coordinates);
|
821 | *
|
822 | * //-
|
823 | * // List all companies that are located at 40.123 latitude
|
824 | * // and -74.0447 longitude.
|
825 | * //-
|
826 | * const query = datastore.createQuery('Company');
|
827 | * const companyQuery = query
|
828 | * .filter('geoPoint.latitude', datastore.double(40.123))
|
829 | * .filter('geoPoint.longitude', datastore.double(-74.0447));
|
830 | * ```
|
831 | */
|
832 | static geoPoint(coordinates: entity.Coordinates): entity.GeoPoint;
|
833 | geoPoint(coordinates: entity.Coordinates): entity.GeoPoint;
|
834 | /**
|
835 | * Helper function to check if something is a Datastore Geo Point object.
|
836 | *
|
837 | * @param {*} value
|
838 | * @returns {boolean}
|
839 | *
|
840 | * @example
|
841 | * ```
|
842 | * const {Datastore} = require('@google-cloud/datastore');
|
843 | * const datastore = new Datastore();
|
844 | * const coordinates = {
|
845 | * latitude: 0,
|
846 | * longitude: 0
|
847 | * };
|
848 | *
|
849 | * datastore.isGeoPoint(coordinates); // false
|
850 | * datastore.isGeoPoint(datastore.geoPoint(coordinates)); // true
|
851 | * ```
|
852 | */
|
853 | static isGeoPoint(value?: {}): boolean;
|
854 | isGeoPoint(value?: {}): boolean;
|
855 | /**
|
856 | * Helper function to get a Datastore Integer object.
|
857 | *
|
858 | * This is also useful when using an ID outside the bounds of a JavaScript
|
859 | * Number object.
|
860 | *
|
861 | * @param {number} value The integer value.
|
862 | * @returns {object}
|
863 | *
|
864 | * @example
|
865 | * ```
|
866 | * const {Datastore} = require('@google-cloud/datastore');
|
867 | * const datastore = new Datastore();
|
868 | * const sevenInteger = datastore.int(7);
|
869 | *
|
870 | * //-
|
871 | * // Create an Int to support long Key IDs.
|
872 | * //-
|
873 | * const key = datastore.key([
|
874 | * 'Kind',
|
875 | * datastore.int('100000000000001234')
|
876 | * ]);
|
877 | * ```
|
878 | */
|
879 | static int(value: number | string): entity.Int;
|
880 | int(value: number | string): entity.Int;
|
881 | /**
|
882 | * Helper function to check if something is a Datastore Integer object.
|
883 | *
|
884 | * @param {*} value
|
885 | * @returns {boolean}
|
886 | *
|
887 | * @example
|
888 | * ```
|
889 | * const {Datastore} = require('@google-cloud/datastore');
|
890 | * const datastore = new Datastore();
|
891 | * datastore.isInt(42); // false
|
892 | * datastore.isInt(datastore.int(42)); // true
|
893 | * ```
|
894 | */
|
895 | static isInt(value?: {}): boolean;
|
896 | isInt(value?: {}): boolean;
|
897 | /**
|
898 | * Access the Key from an Entity object.
|
899 | *
|
900 | * @name Datastore.KEY
|
901 | * @type {symbol}
|
902 | */
|
903 | /**
|
904 | * Access the Key from an Entity object.
|
905 | *
|
906 | * @name Datastore#KEY
|
907 | * @type {symbol}
|
908 | */
|
909 | static KEY: typeof entity.KEY_SYMBOL;
|
910 | KEY: typeof entity.KEY_SYMBOL;
|
911 | /**
|
912 | * This is one of three values which may be returned from
|
913 | * {@link Datastore#runQuery}, {@link Transaction#runQuery}, and
|
914 | * {@link Query#run} as `info.moreResults`.
|
915 | *
|
916 | * There *may* be more results after the specified end cursor.
|
917 | *
|
918 | * @type {string}
|
919 | */
|
920 | static MORE_RESULTS_AFTER_CURSOR: string;
|
921 | MORE_RESULTS_AFTER_CURSOR: string;
|
922 | /**
|
923 | * This is one of three values which may be returned from
|
924 | * {@link Datastore#runQuery}, {@link Transaction#runQuery}, and
|
925 | * {@link Query#run} as `info.moreResults`.
|
926 | *
|
927 | * There *may* be more results after the specified limit.
|
928 | *
|
929 | * @type {string}
|
930 | */
|
931 | static MORE_RESULTS_AFTER_LIMIT: string;
|
932 | MORE_RESULTS_AFTER_LIMIT: string;
|
933 | /**
|
934 | * This is one of three values which may be returned from
|
935 | * {@link Datastore#runQuery}, {@link Transaction#runQuery}, and
|
936 | * {@link Query#run} as `info.moreResults`.
|
937 | *
|
938 | * There are no more results left to query for.
|
939 | *
|
940 | * @type {string}
|
941 | */
|
942 | static NO_MORE_RESULTS: string;
|
943 | NO_MORE_RESULTS: string;
|
944 | /**
|
945 | * Create a query for the specified kind. See {@link Query} for all
|
946 | * of the available methods.
|
947 | *
|
948 | * @see {@link https://cloud.google.com/datastore/docs/concepts/queries| Datastore Queries}
|
949 | * @see {@link Query}
|
950 | *
|
951 | * @param {string} [namespace] Namespace.
|
952 | * @param {string} kind The kind to query.
|
953 | * @returns {Query}
|
954 | *
|
955 | * @example
|
956 | * ```
|
957 | * const {Datastore} = require('@google-cloud/datastore');
|
958 | * const datastore = new Datastore();
|
959 | * const query = datastore.createQuery('Company');
|
960 | * ```
|
961 | */
|
962 | createQuery(kind?: string): Query;
|
963 | createQuery(kind?: string[]): Query;
|
964 | createQuery(namespace: string, kind: string): Query;
|
965 | createQuery(namespace: string, kind: string[]): Query;
|
966 | /**
|
967 | * Helper to create a Key object, scoped to the instance's namespace by
|
968 | * default.
|
969 | *
|
970 | * You may also specify a configuration object to define a namespace and path.
|
971 | *
|
972 | * @param {object|string|array} [options] Key path. To specify or override a namespace,
|
973 | * you must use an object here to explicitly state it.
|
974 | * @param {string|array} [options.path] Key path.
|
975 | * @param {string} [options.namespace] Optional namespace.
|
976 | * @returns {Key} A newly created Key from the options given.
|
977 | *
|
978 | * @example
|
979 | * ```
|
980 | * <caption>Create an incomplete key with a kind value of `Company`.
|
981 | * Since no Id is supplied, Datastore will generate one on save.</caption>
|
982 | * const {Datastore} = require('@google-cloud/datastore');
|
983 | * const datastore = new Datastore();
|
984 | * const key = datastore.key('Company');
|
985 | *
|
986 | * ```
|
987 | * @example
|
988 | * ```
|
989 | * <caption>Create a complete key with a kind value of `Company` and Id `123`.</caption>
|
990 | * const {Datastore} = require('@google-cloud/datastore');
|
991 | * const datastore = new Datastore();
|
992 | * const key = datastore.key(['Company', 123]);
|
993 | *
|
994 | * ```
|
995 | * @example
|
996 | * ```
|
997 | * <caption>If the ID integer is outside the bounds of a JavaScript Number
|
998 | * object, create an Int.</caption>
|
999 | * const {Datastore} = require('@google-cloud/datastore');
|
1000 | * const datastore = new Datastore();
|
1001 | * const key = datastore.key([
|
1002 | * 'Company',
|
1003 | * datastore.int('100000000000001234')
|
1004 | * ]);
|
1005 | *
|
1006 | * ```
|
1007 | * @example
|
1008 | * ```
|
1009 | * <caption>Create a complete key with a kind value of `Company` and name `Google`.
|
1010 | * Because the supplied Id is a string, Datastore will prefix it with "name=".
|
1011 | * Had the supplied Id been numeric, Datastore would prefix it with the standard, "id=".</caption>
|
1012 | * const {Datastore} = require('@google-cloud/datastore');
|
1013 | * const datastore = new Datastore();
|
1014 | * const key = datastore.key(['Company', 'Google']);
|
1015 | *
|
1016 | * ```
|
1017 | * @example
|
1018 | * ```
|
1019 | * <caption>Create a complete key from a provided namespace and path.</caption>
|
1020 | * const {Datastore} = require('@google-cloud/datastore');
|
1021 | * const datastore = new Datastore();
|
1022 | * const key = datastore.key({
|
1023 | * namespace: 'My-NS',
|
1024 | * path: ['Company', 123]
|
1025 | * });
|
1026 | *
|
1027 | * ```
|
1028 | * @example
|
1029 | * ```
|
1030 | * <caption>Create a complete key that specifies an ancestor. This will create a Team entity
|
1031 | * with a name of "Datastore", which belongs to the Company with the "name=Google" key.</caption>
|
1032 | * const {Datastore} = require('@google-cloud/datastore');
|
1033 | * const datastore = new Datastore();
|
1034 | * const key = datastore.key(['Company', 'Google', 'Team', 'Datastore']);
|
1035 | *
|
1036 | * ```
|
1037 | * @example
|
1038 | * ```
|
1039 | * <caption>Create a incomplete key that specifies an ancestor. This will create an Employee entity
|
1040 | * with an auto-generated Id, which belongs to the Company with the "name=Google" key.</caption>
|
1041 | * const {Datastore} = require('@google-cloud/datastore');
|
1042 | * const datastore = new Datastore();
|
1043 | * const key = datastore.key(['Company', 'Google', 'Employee']);
|
1044 | * ```
|
1045 | */
|
1046 | key(options: entity.KeyOptions): entity.Key;
|
1047 | key(path: PathType[]): entity.Key;
|
1048 | key(path: string): entity.Key;
|
1049 | /**
|
1050 | * Helper function to check if something is a Datastore Key object.
|
1051 | *
|
1052 | * @param {*} value
|
1053 | * @returns {boolean}
|
1054 | *
|
1055 | * @example
|
1056 | * ```
|
1057 | * const {Datastore} = require('@google-cloud/datastore');
|
1058 | * const datastore = new Datastore();
|
1059 | * datastore.isKey({path: ['Company', 123]}); // false
|
1060 | * datastore.isKey(datastore.key(['Company', 123])); // true
|
1061 | * ```
|
1062 | */
|
1063 | static isKey(value?: {}): boolean;
|
1064 | isKey(value?: {}): boolean;
|
1065 | /**
|
1066 | * Helper to create a URL safe key.
|
1067 | *
|
1068 | * This is intended to work with the "legacy" representation of a
|
1069 | * datastore "Key" used within Google App Engine (a so-called "Reference").
|
1070 | * The returned string can be used as the "urlsafe"
|
1071 | * The base64 encoded values will have padding removed.
|
1072 | *
|
1073 | *
|
1074 | * @param {entity.Key} key Entity key object.
|
1075 | * @param {string} locationPrefix Optional .
|
1076 | * The location prefix of an App Engine project ID.
|
1077 | * Often this value is 's~', but may also be 'e~', or other location prefixes
|
1078 | * currently unknown.
|
1079 | * @param {function} callback The callback function.
|
1080 | * @param {?error} callback.err An error returned while making this request
|
1081 | * @param {string} callback.urlSafeKey A Base64-encoded URL-safe key.
|
1082 | *
|
1083 | * @example
|
1084 | * ```
|
1085 | * const {Datastore} = require('@google-cloud/datastore');
|
1086 | * const datastore = new Datastore();
|
1087 | * const key = datastore.key(['Company', 'Google']);
|
1088 | *
|
1089 | * datastore.keyToLegacyUrlSafe(key, (err, urlSafeKey) => {
|
1090 | * if (err) {
|
1091 | * // Error handling omitted.
|
1092 | * }
|
1093 | * console.log(urlSafeKey);
|
1094 | * });
|
1095 | *
|
1096 | * //-
|
1097 | * // Create a complete URL-safe key using a location prefix.
|
1098 | * //-
|
1099 | * const locationPrefix = 's~';
|
1100 | *
|
1101 | * datastore.keyToLegacyUrlSafe(key, locationPrefix, (err, urlSafeKey) => {
|
1102 | * if (err) {
|
1103 | * // Error handling omitted.
|
1104 | * }
|
1105 | * console.log(urlSafeKey);
|
1106 | * });
|
1107 | *
|
1108 | * //-
|
1109 | * // If the callback is omitted, we'll return a Promise.
|
1110 | * //-
|
1111 | * datastore.keyToLegacyUrlSafe(key).then((data) => {
|
1112 | * const urlSafeKey = data[0];
|
1113 | * console.log(urlSafeKey);
|
1114 | * });
|
1115 | * ```
|
1116 | */
|
1117 | keyToLegacyUrlSafe(key: entity.Key, locationPrefix?: string): Promise<string>;
|
1118 | keyToLegacyUrlSafe(key: entity.Key, callback: KeyToLegacyUrlSafeCallback): void;
|
1119 | keyToLegacyUrlSafe(key: entity.Key, locationPrefix: string, callback: KeyToLegacyUrlSafeCallback): void;
|
1120 | /**
|
1121 | * Helper to convert URL safe key string to entity key object
|
1122 | *
|
1123 | * This is intended to work with the "legacy" representation of a
|
1124 | * datastore "Key" used within Google App Engine (a so-called "Reference").
|
1125 | *
|
1126 | * @param {entity.Key} key Entity key object.
|
1127 | * @param {string} locationPrefix Optional .
|
1128 | * The location prefix of an App Engine project ID.
|
1129 | * Often this value is 's~', but may also be 'e~', or other location prefixes
|
1130 | * currently unknown.
|
1131 | * @returns {string} Created urlsafe key.
|
1132 | *
|
1133 | * @example
|
1134 | * ```
|
1135 | * const {Datastore} = require('@google-cloud/datastore');
|
1136 | * const datastore = new Datastore();
|
1137 | * const urlSafeKey = 'ag9ncmFzcy1jbHVtcC00NzlyEwsSB0NvbXBhbnkiBkdvb2dsZQw';
|
1138 | *
|
1139 | * datastore.keyFromLegacyUrlsafe(key);
|
1140 | *
|
1141 | * ```
|
1142 | */
|
1143 | keyFromLegacyUrlsafe(key: string): entity.Key;
|
1144 | /**
|
1145 | * Create a new Transaction object.
|
1146 | *
|
1147 | * @param {object} [options] Configuration object.
|
1148 | * @param {string} [options.id] The ID of a previously run transaction.
|
1149 | * @param {boolean} [options.readOnly=false] A read-only transaction cannot
|
1150 | * modify entities.
|
1151 | * @returns {Transaction}
|
1152 | *
|
1153 | * @example
|
1154 | * ```
|
1155 | * const {Datastore} = require('@google-cloud/datastore');
|
1156 | * const datastore = new Datastore();
|
1157 | * const transaction = datastore.transaction();
|
1158 | * ```
|
1159 | */
|
1160 | transaction(options?: TransactionOptions): Transaction;
|
1161 | /**
|
1162 | * Determine the appropriate endpoint to use for API requests. If not
|
1163 | * explicitly defined, check for the "DATASTORE_EMULATOR_HOST" environment
|
1164 | * variable, used to connect to a local Datastore server.
|
1165 | *
|
1166 | * @private
|
1167 | *
|
1168 | * @param {string} customApiEndpoint Custom API endpoint.
|
1169 | */
|
1170 | determineBaseUrl_(customApiEndpoint?: string): void;
|
1171 | /**
|
1172 | * {@link DatastoreRequest} class.
|
1173 | *
|
1174 | * @name Datastore.DatastoreRequest
|
1175 | * @see DatastoreRequest
|
1176 | * @type {constructor}
|
1177 | */
|
1178 | DatastoreRequest: typeof DatastoreRequest;
|
1179 | /**
|
1180 | * {@link Query} class.
|
1181 | *
|
1182 | * @name Datastore.Query
|
1183 | * @see Query
|
1184 | * @type {constructor}
|
1185 | */
|
1186 | Query: typeof Query;
|
1187 | /**
|
1188 | * {@link Transaction} class.
|
1189 | *
|
1190 | * @name Datastore.Transaction
|
1191 | * @see Transaction
|
1192 | * @type {constructor}
|
1193 | */
|
1194 | Transaction: typeof Transaction;
|
1195 | }
|
1196 | export { Datastore };
|
1197 | export interface TransactionOptions {
|
1198 | id?: string;
|
1199 | readOnly?: boolean;
|
1200 | }
|
1201 | export { Index, DatastoreRequest, Query, Transaction };
|
1202 | export interface DatastoreOptions extends GoogleAuthOptions {
|
1203 | namespace?: string;
|
1204 | apiEndpoint?: string;
|
1205 | sslCreds?: ChannelCredentials;
|
1206 | }
|
1207 | export interface KeyToLegacyUrlSafeCallback {
|
1208 | (err?: Error | null, urlSafeKey?: string): void;
|
1209 | }
|
1210 | declare const v1: any;
|
1211 | export { v1 };
|
1212 | export { DatastoreClient, DatastoreAdminClient } from './v1';
|