datastore-api 1.1.1 → 1.4.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.4.0](https://github.com/mdornseif/datastore-api/compare/v1.3.0...v1.4.0) (2022-01-04)
6
+
7
+
8
+ ### Features
9
+
10
+ * save() adds _keyStr the same way get() does ([f4f6452](https://github.com/mdornseif/datastore-api/commit/f4f6452c77046c0ee8d0b6ddfe2ec6744a4968bd))
11
+
12
+ ## [1.3.0](https://github.com/mdornseif/datastore-api/compare/v1.2.0...v1.3.0) (2022-01-03)
13
+
14
+
15
+ ### Features
16
+
17
+ * Set excludeLargeProperties by default. ([289cd28](https://github.com/mdornseif/datastore-api/commit/289cd289651b0c34f36098370b3dfbe249790c5a))
18
+
19
+ ## [1.2.0](https://github.com/mdornseif/datastore-api/compare/v1.1.3...v1.2.0) (2021-12-30)
20
+
21
+
22
+ ### Features
23
+
24
+ * add `query(... selection)` ([e9f8053](https://github.com/mdornseif/datastore-api/commit/e9f8053fa98f496e69ccf83e649e7c1502751f16))
25
+ * add KEYSYM ([d97eff0](https://github.com/mdornseif/datastore-api/commit/d97eff09f0c7dd60caa860eda45975438d369920))
26
+ * debug log; removed readonly from several types ([f1fcdb6](https://github.com/mdornseif/datastore-api/commit/f1fcdb62551c3c624fcfd67f550f40a5bbd38138))
27
+
28
+ ### [1.1.3](https://github.com/mdornseif/datastore-api/compare/v1.1.2...v1.1.3) (2021-12-29)
29
+
30
+ ### [1.1.2](https://github.com/mdornseif/datastore-api/compare/v1.1.1...v1.1.2) (2021-12-29)
31
+
5
32
  ### [1.1.1](https://github.com/mdornseif/datastore-api/compare/v1.1.0...v1.1.1) (2021-12-29)
6
33
 
7
34
  ## [1.1.0](https://github.com/mdornseif/datastore-api/compare/v1.0.2...v1.1.0) (2021-12-25)
package/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ [![version](https://img.shields.io/npm/v/datastore-api.svg?style=flat-square)](https://npmjs.org/datastore-api)
2
+ [![license](https://img.shields.io/npm/l/datastore-api?color=%23007a1f&style=flat-square)](https://github.com/mdornseif/datastore-api/blob/master/LICENSE)
3
+ [![downloads](https://img.shields.io/npm/dm/datastore-api?style=flat-square&color=%23007a1f)](https://npmcharts.com/compare/datastore-api)
4
+
1
5
  # datastore-api
2
6
 
3
7
  Simplified, more consistent API for Google Cloud Datastore.
@@ -22,9 +26,9 @@ Main differences:
22
26
 
23
27
  Find the full documentation [here](http://mdornseif.io/datastore-api/classes/Dstore.html). In there also some of the idiosyncrasies of using the Datastore are explained.
24
28
 
25
- See [the API documentation](http://mdornseif.io/datastore-api/classes/Dstore.html) for Details.
29
+ See [the API documentation](http://mdornseif.io/datastore-api/classes/Dstore.html) for Details, [Github](https://github.com/mdornseif/datastore-api) for source.
26
30
 
27
- # See also
31
+ ## See also
28
32
 
29
33
  - Google Documentation
30
34
 
@@ -33,7 +37,7 @@ See [the API documentation](http://mdornseif.io/datastore-api/classes/Dstore.htm
33
37
  - Other [Hidden Auto-Generated Datastore API Documentation](https://googleapis.dev/nodejs/datastore/latest/) with better navigation. Seems to contain more on the lower level access.
34
38
  - [SDK Source](https://github.com/googleapis/nodejs-datastore)
35
39
  - [API reference](https://cloud.google.com/datastore/docs/reference/data/rpc) helps to understand under-documented SDK.
36
- - [grpc-js environment variables](https://github.com/grpc/grpc-node/blob/master/doc/environment_variables.md) - try[GRPC_VERBOSITY=DEBUG GRPC_TRACE=all yarn test](https://github.com/grpc/grpc-node/blob/master/TROUBLESHOOTING.md)
40
+ - [grpc-js environment variables](https://github.com/grpc/grpc-node/blob/master/doc/environment_variables.md) - try [GRPC_VERBOSITY=DEBUG GRPC_TRACE=all yarn test](https://github.com/grpc/grpc-node/blob/master/TROUBLESHOOTING.md)
37
41
 
38
42
  - API Simplification
39
43
  - [google-cloud-datastore-node](https://www.npmjs.com/package/google-cloud-datastore-node)
@@ -4,53 +4,61 @@ import { Operator, RunQueryResponse } from '@google-cloud/datastore/build/src/qu
4
4
  import { CommitResponse } from '@google-cloud/datastore/build/src/request';
5
5
  /** @ignore */
6
6
  export { Datastore, Key, PathType, Query, Transaction, } from '@google-cloud/datastore';
7
+ export declare const KEYSYM: symbol;
7
8
  export declare type IGqlFilterTypes = boolean | string | number;
8
9
  export declare type IGqlFilterSpec = {
9
10
  readonly eq: IGqlFilterTypes;
10
11
  };
11
- export declare type TGqlFilterList = ReadonlyArray<readonly [string, Operator, DstorePropertyValues]>;
12
+ export declare type TGqlFilterList = Array<[string, Operator, DstorePropertyValues]>;
12
13
  /** Define what can be written into the Datastore */
13
- export declare type DstorePropertyValues = number | string | Date | boolean | null | undefined | Buffer | Key | readonly DstorePropertyValues[] | {
14
- readonly [key: string]: DstorePropertyValues;
14
+ export declare type DstorePropertyValues = number | string | Date | boolean | null | undefined | Buffer | Key | DstorePropertyValues[] | {
15
+ [key: string]: DstorePropertyValues;
15
16
  };
17
+ export interface IDstoreEntryWithoutKey {
18
+ /** All User Data stored in the Datastore */
19
+ [key: string]: DstorePropertyValues;
20
+ }
16
21
  /** Represents what is actually stored inside the Datastore, called "Entity" by Google
17
22
  [@google-cloud/datastore](https://github.com/googleapis/nodejs-datastore#readme) adds `[Datastore.KEY]`. Using ES6 Symbols presents all kinds of hurdles, especially when you try to serialize into a cache. So we add the property _keyStr which contains the encoded code. It is automatically used
18
23
  to reconstruct `[Datastore.KEY]`, if you use [[Dstore.readKey]].
19
24
  */
20
- export declare type TDstoreEntry = {
25
+ export interface IDstoreEntry extends IDstoreEntryWithoutKey {
21
26
  readonly [Datastore.KEY]?: Key;
22
27
  /** [Datastore.KEY] key */
23
28
  _keyStr: string;
24
29
  /** All User Data stored in the Datastore */
25
- readonly [key: string]: DstorePropertyValues;
26
- };
30
+ [key: string]: DstorePropertyValues;
31
+ }
27
32
  /** Represents the thing you pass to the save method. Also called "Entity" by Google */
28
33
  export declare type DstoreSaveEntity = {
29
- readonly key: Key;
30
- readonly data: Omit<TDstoreEntry, '_keyStr' | Datastore['KEY']>;
31
- readonly method?: 'insert' | 'update' | 'upsert';
32
- readonly excludeLargeProperties?: boolean;
33
- readonly excludeFromIndexes?: readonly string[];
34
+ key: Key;
35
+ data: Omit<IDstoreEntry, '_keyStr' | Datastore['KEY']> & Partial<{
36
+ _keyStr: string;
37
+ [Datastore.KEY]: Key;
38
+ }>;
39
+ method?: 'insert' | 'update' | 'upsert';
40
+ excludeLargeProperties?: boolean;
41
+ excludeFromIndexes?: readonly string[];
34
42
  };
35
43
  declare type IDstore = {
36
44
  /** Accessible by Users of the library. Keep in mind that you will access outside transactions created by [[runInTransaction]]. */
37
45
  readonly datastore: Datastore;
38
- readonly key: (path: ReadonlyArray<PathType>) => Key;
39
- readonly keyFromSerialized: (text: string) => Key;
40
- readonly keySerialize: (key: Key) => string;
41
- readonly readKey: (entry: TDstoreEntry) => Key;
42
- readonly get: (key: Key) => Promise<TDstoreEntry | null>;
43
- readonly getMulti: (keys: ReadonlyArray<Key>) => Promise<ReadonlyArray<TDstoreEntry | undefined>>;
44
- readonly set: (key: Key, entry: TDstoreEntry) => Promise<Key>;
45
- readonly save: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;
46
- readonly insert: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;
47
- readonly update: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;
48
- readonly delete: (keys: readonly Key[]) => Promise<CommitResponse | undefined>;
49
- readonly createQuery: (kind: string) => Query;
50
- readonly query: (kind: string, filters?: TGqlFilterList, limit?: number, orders?: readonly string[]) => Promise<RunQueryResponse>;
51
- readonly runQuery: (query: Query | Omit<Query, 'run'>) => Promise<RunQueryResponse>;
52
- readonly allocateOneId: (kindName: string) => Promise<string>;
53
- readonly runInTransaction: <T>(func: {
46
+ key: (path: ReadonlyArray<PathType>) => Key;
47
+ keyFromSerialized: (text: string) => Key;
48
+ keySerialize: (key: Key) => string;
49
+ readKey: (entry: IDstoreEntry) => Key;
50
+ get: (key: Key) => Promise<IDstoreEntry | null>;
51
+ getMulti: (keys: ReadonlyArray<Key>) => Promise<ReadonlyArray<IDstoreEntry | undefined>>;
52
+ set: (key: Key, entry: IDstoreEntry) => Promise<Key>;
53
+ save: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;
54
+ insert: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;
55
+ update: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;
56
+ delete: (keys: readonly Key[]) => Promise<CommitResponse | undefined>;
57
+ createQuery: (kind: string) => Query;
58
+ query: (kind: string, filters?: TGqlFilterList, limit?: number, ordering?: readonly string[], selection?: readonly string[], cursor?: string) => Promise<RunQueryResponse>;
59
+ runQuery: (query: Query | Omit<Query, 'run'>) => Promise<RunQueryResponse>;
60
+ allocateOneId: (kindName: string) => Promise<string>;
61
+ runInTransaction: <T>(func: {
54
62
  (): Promise<T>;
55
63
  (): T;
56
64
  }) => Promise<T>;
@@ -60,18 +68,18 @@ declare type IDstore = {
60
68
  [@google-cloud/datastore](https://github.com/googleapis/nodejs-datastore#readme) is a strange beast: [The documentation is auto generated](https://cloud.google.com/nodejs/docs/reference/datastore/latest) and completely shy of documenting any advanced concepts.
61
69
  (Example: If you ask the datastore to auto-generate keys during save: how do you retrieve the generated key?) Generally I suggest to look at the Python 2.x [db](https://cloud.google.com/appengine/docs/standard/python/datastore/api-overview) and [ndb](https://cloud.google.com/appengine/docs/standard/python/ndb) documentation to get a better explanation of the workings of the datastore.
62
70
 
63
- Also the typings are strange. The Google provided type `Entities` can be the on disk representation, the same but including a key reference (`Datastore.KEY` - [[DstoreEntry]]), a list of these or a structured object containing the on disk representation under the `data` property and a `key` property and maybe some configuration like `excludeFromIndexes` ([[DstoreSaveEntity]]) or a list of these.
71
+ Also the typings are strange. The Google provided type `Entities` can be the on disk representation, the same but including a key reference (`Datastore.KEY` - [[IDstoreEntry]]), a list of these or a structured object containing the on disk representation under the `data` property and a `key` property and maybe some configuration like `excludeFromIndexes` ([[DstoreSaveEntity]]) or a list of these.
64
72
 
65
73
  KvStore tries to abstract away most surprises the datastore provides to you but als tries to stay as API compatible as possible to [@google-cloud/datastore](https://github.com/googleapis/nodejs-datastore).
66
74
 
67
75
  Main differences:
68
76
 
69
77
  - Everything asynchronous is Promise-based - no callbacks.
70
- - [[get]] always returns a single [[DstoreEntry]].
71
- - [[getMulti]] always returns an Array<[[DstoreEntry]]> of the same length as the input Array. Items not found are represented by null.
78
+ - [[get]] always returns a single [[IDstoreEntry]].
79
+ - [[getMulti]] always returns an Array<[[IDstoreEntry]]> of the same length as the input Array. Items not found are represented by null.
72
80
  - [[set]] is called with `(key, value)` and always returns the complete [[Key]] of the entity being written. Keys are normalized, numeric IDs are always encoded as strings.
73
81
  - [[key]] handles [[Key]] object instantiation for you.
74
- - [[readKey]] extracts the key from an [[DstoreEntry]] you have read without the need of fancy `Symbol`-based access to `entity[Datastore.KEY]`. If needed, it tries to deserialize `_keyStr` to create `entity[Datastore.KEY]`. This ist important when rehydrating an [[DstoreEntry]] from a serializing cache.
82
+ - [[readKey]] extracts the key from an [[IDstoreEntry]] you have read without the need of fancy `Symbol`-based access to `entity[Datastore.KEY]`. If needed, it tries to deserialize `_keyStr` to create `entity[Datastore.KEY]`. This ist important when rehydrating an [[IDstoreEntry]] from a serializing cache.
75
83
  - [[allocateOneId]] returns a single numeric string encoded unique datastore id without the need of fancy unpacking.
76
84
  - [[runInTransaction]] allows you to provide a function to be executed inside an transaction without the need of passing around the transaction object. This is modelled after Python 2.7 [ndb's `@ndb.transactional` feature](https://cloud.google.com/appengine/docs/standard/python/ndb/transactions). This is implemented via node's [AsyncLocalStorage](https://nodejs.org/docs/latest-v14.x/api/async_hooks.html).
77
85
  - [[keySerialize]] is synchronous.
@@ -126,24 +134,24 @@ export declare class Dstore implements IDstore {
126
134
  * @category Datastore Drop-In
127
135
  */
128
136
  keyFromSerialized(text: string): Key;
129
- /** `readKey()` extracts the [[Key]] from an [[DstoreEntry]].
137
+ /** `readKey()` extracts the [[Key]] from an [[IDstoreEntry]].
130
138
  *
131
139
  * Is is an alternative to `entity[Datastore.KEY]` which tends to fail in various contexts and also confuses older Typescript compilers.
132
- * It can extract the [[Key]] form a [[DstoreEntry]] which has been serialized to JSON by leveraging the property `_keyStr`.
140
+ * It can extract the [[Key]] form a [[IDstoreEntry]] which has been serialized to JSON by leveraging the property `_keyStr`.
133
141
  *
134
142
  * @category Additional
135
143
  */
136
- readKey(ent: TDstoreEntry): Key;
137
- /** `fixKeys()` is called for all [[DstoreEntry]]sa returned from [[Dstore]].
144
+ readKey(ent: IDstoreEntry): Key;
145
+ /** `fixKeys()` is called for all [[IDstoreEntry]]sa returned from [[Dstore]].
138
146
  *
139
147
  * Is ensures that besides `entity[Datastore.KEY]` there is `_keyStr` to be leveraged by [[readKey]].
140
148
  *
141
149
  * @internal
142
150
  */
143
151
  private fixKeys;
144
- /** `get()` reads a [[DstoreEntry]] from the Datastore.
152
+ /** `get()` reads a [[IDstoreEntry]] from the Datastore.
145
153
  *
146
- * It returns [[DstoreEntry]] or `null` if not found.
154
+ * It returns [[IDstoreEntry]] or `null` if not found.
147
155
 
148
156
  * The underlying Datastore API Call is [lookup](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/lookup).
149
157
  *
@@ -152,14 +160,14 @@ export declare class Dstore implements IDstore {
152
160
  * Differences between [[Dstore.get]] and [[Datastore.get]]:
153
161
  *
154
162
  * - [Dstore.get]] takes a single [[Key]] as Parameter, no Array. Check [[getMulti]] if you want Arrays.
155
- * - [Dstore.get]] returns a single [[DstoreEntry]], no Array.
163
+ * - [Dstore.get]] returns a single [[IDstoreEntry]], no Array.
156
164
  *
157
165
  * @category Datastore Drop-In
158
166
  */
159
- get(key: Key): Promise<TDstoreEntry | null>;
160
- /** `getMulti()` reads several [[DstoreEntry]]s from the Datastore.
167
+ get(key: Key): Promise<IDstoreEntry | null>;
168
+ /** `getMulti()` reads several [[IDstoreEntry]]s from the Datastore.
161
169
  *
162
- * It returns a list of [[DstoreEntry]]s or `null` if not found.
170
+ * It returns a list of [[IDstoreEntry]]s or `null` if not found.
163
171
 
164
172
  * The underlying Datastore API Call is [lookup](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/lookup).
165
173
  *
@@ -168,12 +176,12 @@ export declare class Dstore implements IDstore {
168
176
  * Differences between [[Dstore.getMulti]] and [[Datastore.get]]:
169
177
  *
170
178
  * - [[Dstore.getMulti]] always takes an Array of [[Key]]s as Parameter.
171
- * - [[Dstore.getMulti]] returns always a Array of [[DstoreEntry]], or null.
179
+ * - [[Dstore.getMulti]] returns always a Array of [[IDstoreEntry]], or null.
172
180
  * - [[Datastore.get]] has many edge cases - e.g. when not being able to find any of the provided keys - which return surprising results. [[Dstore.getMulti]] always returns an Array. TODO: return a Array with the same length as the Input.
173
181
  *
174
182
  * @category Datastore Drop-In
175
183
  */
176
- getMulti(keys: readonly Key[]): Promise<ReadonlyArray<TDstoreEntry | undefined>>;
184
+ getMulti(keys: readonly Key[]): Promise<Array<IDstoreEntry | undefined>>;
177
185
  /** `set()` is addition to [[Datastore]]. It provides a classic Key-value Interface.
178
186
  *
179
187
  * Instead providing a nested [[DstoreSaveEntity]] to [[save]] you can call set directly as `set( key, value)`.
@@ -190,7 +198,7 @@ export declare class Dstore implements IDstore {
190
198
  *
191
199
  * @category Additional
192
200
  */
193
- set(key: Key, data: TDstoreEntry): Promise<Key>;
201
+ set(key: Key, data: IDstoreEntry): Promise<Key>;
194
202
  /** `save()` is compatible to [Datastore.save()](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_save_member_1_).
195
203
  *
196
204
  * The single Parameter is a list of [[DstoreSaveEntity]]s.
@@ -206,7 +214,21 @@ export declare class Dstore implements IDstore {
206
214
  *
207
215
  * If the Datastore generates a new ID because of an incomplete [[Key]] *on first save* it will return an large integer as [[Key.id]].
208
216
  * On every subsequent `save()` an string encoded number representation is returned.
209
- * Dstore normalizes that and always returns an string encoded number representation.
217
+ * @todo Dstore should normalizes that and always return an string encoded number representation.
218
+ *
219
+ * Each [[DstoreSaveEntity]] can have an `excludeFromIndexes` property which is somewhat underdocumented.
220
+ * It can use something like JSON-Path notation
221
+ * ([Source](https://github.com/googleapis/nodejs-datastore/blob/2941f2f0f132b41534e303d441d837051ce88fd7/src/index.ts#L948))
222
+ * [.*](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1598),
223
+ * [parent[]](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1672),
224
+ * [parent.*](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1672),
225
+ * [parent[].*](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1672)
226
+ * and [more complex patterns](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1754)
227
+ * seem to be supported patterns.
228
+ *
229
+ * If the caller has not provided an `excludeLargeProperties` in a [[DstoreSaveEntity]] we will default it
230
+ * to `excludeLargeProperties: true`. Without this you can not store strings longer than 1500 bytes easily
231
+ * ([source](https://github.com/googleapis/nodejs-datastore/blob/c7a08a8382c6706ccbfbbf77950babf40bac757c/src/entity.ts#L961)).
210
232
  *
211
233
  * @category Datastore Drop-In
212
234
  */
@@ -221,6 +243,8 @@ export declare class Dstore implements IDstore {
221
243
  *
222
244
  * For handling of incomplete [[Key]]s see [[save]].
223
245
  *
246
+ * This function can be completely emulated by using [[save]] with `method: 'insert'` inside each [[DstoreSaveEntity]].
247
+ *
224
248
  * @throws [[DstoreError]]
225
249
  * @category Datastore Drop-In
226
250
  */
@@ -235,15 +259,17 @@ export declare class Dstore implements IDstore {
235
259
  * It throws an [[DstoreError]] if there is no Entity with the same [[Key]] in the Datastore. `update()` *overwrites all existing data* for that [[Key]].
236
260
  * There was an alpha functionality called `merge()` in the Datastore which read an Entity, merged it with the new data and wrote it back, but this was never documented.
237
261
  *
238
- * `update()` is idempotent. Deleting the same [[Key]] twice is no error.
262
+ * `update()` is idempotent. Updating the same [[Key]] twice is no error.
263
+ *
264
+ * This function can be completely emulated by using [[save]] with `method: 'update'` inside each [[DstoreSaveEntity]].
239
265
  *
240
266
  * @throws [[DstoreError]]
241
267
  * @category Datastore Drop-In
242
268
  */
243
269
  update(entities: readonly DstoreSaveEntity[]): Promise<CommitResponse | undefined>;
244
- /** `delete()` is compatible to [Datastore.update()].
270
+ /** `delete()` is compatible to [Datastore.delete()].
245
271
  *
246
- * Unfortunately currently (late 2021) there is no formal documentation from Google on [Datastore.update()].
272
+ * Unfortunately currently (late 2021) there is no formal documentation from Google on [Datastore.delete()].
247
273
  *
248
274
  * The single Parameter is a list of [[Key]]s.
249
275
  * If called within a transaction it returns `undefined`.
@@ -262,9 +288,10 @@ export declare class Dstore implements IDstore {
262
288
  * @param kind Name of the [[Datastore]][Kind](https://cloud.google.com/datastore/docs/concepts/entities#kinds_and_identifiers) ("Table") which should be searched.
263
289
  *
264
290
  * @category Datastore Drop-In
265
- */ createQuery(kind: string): Query;
291
+ */
292
+ createQuery(kind: string): Query;
266
293
  runQuery(query: Query | Omit<Query, 'run'>): Promise<RunQueryResponse>;
267
- query(kindName: string, filters?: TGqlFilterList, limit?: number, orders?: readonly string[]): Promise<RunQueryResponse>;
294
+ query(kindName: string, filters?: TGqlFilterList, limit?: number, ordering?: readonly string[], selection?: string[], cursor?: string): Promise<RunQueryResponse>;
268
295
  /** Allocate one ID in the Datastore.
269
296
  *
270
297
  * Currently (late 2021) there is no documentation provided by Google for the underlying node function.
@@ -279,16 +306,18 @@ export declare class Dstore implements IDstore {
279
306
  allocateOneId(kindName?: string): Promise<string>;
280
307
  /** This tries to give high level access to transactions.
281
308
 
282
- Be aware that Transactions differ considerable between Master-Slave Datastore (very old), High Replication Datastore (old, later called [Google Cloud Datastore](https://cloud.google.com/datastore/docs/concepts/cloud-datastore-transactions)) and [Firestore in Datastore Mode](https://cloud.google.com/datastore/docs/firestore-or-datastore#in_datastore_mode) (current).
283
-
284
309
  So called "Gross Group Transactions" are always enabled. Transactions are never Cross Project. `runInTransaction()` works only if you use the same [[KvStore] instance for all access within the Transaction.
285
310
 
286
311
  [[runInTransaction]] is modelled after Python 2.7 [ndb's `@ndb.transactional` feature](https://cloud.google.com/appengine/docs/standard/python/ndb/transactions). This is based on node's [AsyncLocalStorage](https://nodejs.org/docs/latest-v14.x/api/async_hooks.html).
287
312
 
288
- Transactions frequently fail if you try to access the same data via in a transaction. See the [Documentation on Locking](https://cloud.google.com/datastore/docs/concepts/transactions#transaction_locks) for further reference. You are advised to use [p-limit](https://github.com/sindresorhus/p-limit)(1) to seralize transactions touching the same resource. This should work nicely with node's single process model. It is a much bigger problem on shared-nothing approaches, like Python on App Engine.
313
+ Transactions frequently fail if you try to access the same data via in a transaction. See the [Documentation on Locking](https://cloud.google.com/datastore/docs/concepts/transactions#transaction_locks) for further reference. You are advised to use [p-limit](https://github.com/sindresorhus/p-limit)(1) to serialize transactions touching the same resource. This should work nicely with node's single process model. It is a much bigger problem on shared-nothing approaches, like Python on App Engine.
289
314
 
290
315
  Transactions might be wrapped in [p-retry](https://github.com/sindresorhus/p-retry) to implement automatically retrying them with exponential back-off should they fail due to contention.
291
- */
316
+
317
+ Be aware that Transactions differ considerable between Master-Slave Datastore (very old), High Replication Datastore (old, later called [Google Cloud Datastore](https://cloud.google.com/datastore/docs/concepts/cloud-datastore-transactions)) and [Firestore in Datastore Mode](https://cloud.google.com/datastore/docs/firestore-or-datastore#in_datastore_mode) (current).
318
+
319
+ Most Applications today are running on "Firestore in Datastore Mode". Beware that the Datastore-Emulator fails with `error: 3 INVALID_ARGUMENT: Only ancestor queries are allowed inside transactions.` during [[runQuery]] while the Datastore on Google Infrastructure does not have such an restriction anymore as of 2022.
320
+ */
292
321
  runInTransaction<T>(func: () => Promise<T>): Promise<T>;
293
322
  }
294
323
  export declare class DstoreError extends Error {