datastore-api 6.0.0 → 6.0.1
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/dist/datastore-api.cjs.development.js +3 -0
- package/dist/datastore-api.cjs.development.js.map +1 -1
- package/dist/datastore-api.cjs.production.min.js +1 -1
- package/dist/datastore-api.cjs.production.min.js.map +1 -1
- package/dist/datastore-api.esm.js +3 -0
- package/dist/datastore-api.esm.js.map +1 -1
- package/package.json +81 -67
- package/src/lib/dstore-api.ts +3 -0
|
@@ -470,6 +470,9 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
|
470
470
|
var debug = /*#__PURE__*/Debug('ds:api');
|
|
471
471
|
/** @ignore */
|
|
472
472
|
var transactionAsyncLocalStorage = /*#__PURE__*/new async_hooks.AsyncLocalStorage();
|
|
473
|
+
// for HMR
|
|
474
|
+
promClient.register.removeSingleMetric('dstore_requests_seconds');
|
|
475
|
+
promClient.register.removeSingleMetric('dstore_failures_total');
|
|
473
476
|
/** @ignore */
|
|
474
477
|
var metricHistogram = /*#__PURE__*/new promClient.Histogram({
|
|
475
478
|
name: 'dstore_requests_seconds',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datastore-api.cjs.development.js","sources":["../src/lib/dstore-api.ts"],"sourcesContent":["/*\n * dstore.ts - Datastore Compatibility layer\n * Try to get a smoother api for transactions and such.\n * A little bit inspired by the Python2 ndb interface.\n * But without the ORM bits.\n *\n * In future https://github.com/graphql/dataloader might be used for batching.\n *\n * Created by Dr. Maximillian Dornseif 2021-12-05 in huwawi3backend 11.10.0\n * Copyright (c) 2021, 2022, 2023 Dr. Maximillian Dornseif\n */\n\nimport { AsyncLocalStorage } from 'async_hooks';\nimport { setImmediate } from 'timers/promises';\n\nimport { Datastore, Key, PathType, Query, Transaction, PropertyFilter } from '@google-cloud/datastore';\nimport { Entity, entity } from '@google-cloud/datastore/build/src/entity';\nimport { Operator, RunQueryInfo, RunQueryResponse } from '@google-cloud/datastore/build/src/query';\nimport { CommitResponse } from '@google-cloud/datastore/build/src/request';\nimport {\n assert,\n assertIsArray,\n assertIsDefined,\n assertIsNumber,\n assertIsObject,\n assertIsString,\n} from 'assertate-debug';\nimport Debug from 'debug';\nimport promClient from 'prom-client';\nimport { Writable } from 'ts-essentials';\n\n/** @ignore */\nexport { Datastore, Key, PathType, Query, Transaction } from '@google-cloud/datastore';\n\n/** @ignore */\nconst debug = Debug('ds:api');\n\n/** @ignore */\nconst transactionAsyncLocalStorage = new AsyncLocalStorage();\n\n/** @ignore */\nconst metricHistogram = new promClient.Histogram({\n name: 'dstore_requests_seconds',\n help: 'How long did Datastore operations take?',\n labelNames: ['operation'],\n});\nconst metricFailureCounter = new promClient.Counter({\n name: 'dstore_failures_total',\n help: 'How many Datastore operations failed?',\n labelNames: ['operation'],\n});\n\n/** Use instead of Datastore.KEY\n *\n * Even better: use `_key` instead.\n */\nexport const KEYSYM = Datastore.KEY;\n\nexport type IGqlFilterTypes = boolean | string | number;\n\nexport type IGqlFilterSpec = {\n readonly eq: IGqlFilterTypes;\n};\nexport type TGqlFilterList = Array<[string, Operator, DstorePropertyValues]>;\n\n/** Define what can be written into the Datastore */\nexport type DstorePropertyValues =\n | number\n | string\n | Date\n | boolean\n | null\n | undefined\n | Buffer\n | Key\n | DstorePropertyValues[]\n | { [key: string]: DstorePropertyValues };\n\nexport interface IDstoreEntryWithoutKey {\n /** All User Data stored in the Datastore */\n [key: string]: DstorePropertyValues;\n}\n\n/** Represents what is actually stored inside the Datastore, called \"Entity\" by Google\n [@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 key. It is automatically used to reconstruct `[Datastore.KEY]`, if you use [[Dstore.readKey]].\n*/\nexport interface IDstoreEntry extends IDstoreEntryWithoutKey {\n /* Datastore Key provided by [@google-cloud/datastore](https://github.com/googleapis/nodejs-datastore#readme) */\n readonly [Datastore.KEY]?: Key;\n /** [Datastore.KEY] key */\n _keyStr: string;\n}\n\n/** Represents the thing you pass to the save method. Also called \"Entity\" by Google */\nexport type DstoreSaveEntity = {\n key: Key;\n data: Omit<IDstoreEntry, '_keyStr' | Datastore['KEY']> &\n Partial<{\n _keyStr: string|undefined;\n [Datastore.KEY]: Key;\n }>;\n method?: 'insert' | 'update' | 'upsert';\n excludeLargeProperties?: boolean;\n excludeFromIndexes?: readonly string[];\n};\n\ntype IDstore = {\n /** Accessible by Users of the library. Keep in mind that you will access outside transactions created by [[runInTransaction]]. */\n readonly datastore: Datastore;\n key: (path: ReadonlyArray<PathType>) => Key;\n keyFromSerialized: (text: string) => Key;\n keySerialize: (key: Key) => string;\n readKey: (entry: IDstoreEntry) => Key;\n get: (key: Key) => Promise<IDstoreEntry | null>;\n getMulti: (keys: ReadonlyArray<Key>) => Promise<ReadonlyArray<IDstoreEntry | null>>;\n set: (key: Key, entry: IDstoreEntry) => Promise<Key>;\n save: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;\n insert: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;\n update: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;\n delete: (keys: readonly Key[]) => Promise<CommitResponse | undefined>;\n createQuery: (kind: string) => Query;\n query: (\n kind: string,\n filters?: TGqlFilterList,\n limit?: number,\n ordering?: readonly string[],\n selection?: readonly string[],\n cursor?: string\n ) => Promise<RunQueryResponse>;\n runQuery: (query: Query | Omit<Query, 'run'>) => Promise<RunQueryResponse>;\n allocateOneId: (kindName: string) => Promise<string>;\n runInTransaction: <T>(func: { (): Promise<T>; (): T }) => Promise<T>;\n};\n\n/** Dstore implements a slightly more accessible version of the [Google Cloud Datastore: Node.js Client](https://cloud.google.com/nodejs/docs/reference/datastore/latest)\n\n[@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.\n(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.\n\nAlso 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.\n\nKvStore 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).\n\nMain differences:\n\n- Everything asynchronous is Promise-based - no callbacks.\n- [[get]] always returns a single [[IDstoreEntry]].\n- [[getMulti]] always returns an Array<[[IDstoreEntry]]> of the same length as the input Array. Items not found are represented by null.\n- [[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.\n- [[key]] handles [[Key]] object instantiation for you.\n- [[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.\n- [[allocateOneId]] returns a single numeric string encoded unique datastore id without the need of fancy unpacking.\n- [[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).\n- [[keySerialize]] is synchronous.\n\nThis documentation also tries to document the little known idiosyncrasies of the [@google-cloud/datastore](https://github.com/googleapis/nodejs-datastore) library. See the corresponding functions.\n*/\nexport class Dstore implements IDstore {\n engine = 'Dstore';\n engines: string[] = [];\n private readonly urlSaveKey = new entity.URLSafeKey();\n\n /** Generate a Dstore instance for a specific [[Datastore]] instance.\n\n ```\n const dstore = Dstore(new Datastore())\n ```\n\n You are encouraged to provide the second parameter to provide the ProjectID. This makes [[keySerialize]] more robust. Usually you can get this from the Environment:\n\n ```\n const dstore = Dstore(new Datastore(), process.env.GCLOUD_PROJECT)\n\n @param datastore A [[Datastore]] instance. Can be freely accessed by the client. Be aware that using this inside [[runInTransaction]] ignores the transaction.\n @param projectId The `GCLOUD_PROJECT ID`. Used for Key generation during serialization.\n ```\n */\n constructor(readonly datastore: Datastore, readonly projectId?: string, readonly logger?: string) {\n assertIsObject(datastore);\n this.engines.push(this.engine);\n }\n\n /** Gets the Datastore or the current Transaction. */\n private getDoT(): Transaction | Datastore {\n return (transactionAsyncLocalStorage.getStore() as Transaction) || this.datastore;\n }\n\n /** `key()` creates a [[Key]] Object from a path.\n *\n * Compatible to [Datastore.key](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_key_member_1_)\n *\n * If the Path has an odd number of elements, it is considered an incomplete Key. This can only be used for saving and will prompt the Datastore to auto-generate an (random) ID. See also [[save]].\n *\n * @category Datastore Drop-In\n */\n key(path: readonly PathType[]): Key {\n return this.datastore.key(path as Writable<typeof path>);\n }\n\n /** `keyFromSerialized()` serializes [[Key]] to a string.\n *\n * Compatible to [keyToLegacyUrlSafe](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_keyToLegacyUrlSafe_member_1_), but does not support the \"locationPrefix\" since the use for this parameter is undocumented and unknown. It seems to be an artifact from early App Engine days.\n *\n * It can be a synchronous function because it does not look up the `projectId`. Instead it is assumed, that you give the `projectId` upon instantiation of [[Dstore]]. It also seems, that a wrong `projectId` bears no ill effects.\n *\n * @category Datastore Drop-In\n */\n keySerialize(key: Key): string {\n return key ? this.urlSaveKey.legacyEncode(this.projectId ?? '', key) : '';\n }\n\n /** `keyFromSerialized()` deserializes a string created with [[keySerialize]] to a [[Key]].\n *\n * Compatible to [keyFromLegacyUrlsafe](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_keyFromLegacyUrlsafe_member_1_).\n *\n * @category Datastore Drop-In\n */\n keyFromSerialized(text: string): Key {\n return this.urlSaveKey.legacyDecode(text);\n }\n\n /** `readKey()` extracts the [[Key]] from an [[IDstoreEntry]].\n *\n * Is is an alternative to `entity[Datastore.KEY]` which tends to fail in various contexts and also confuses older Typescript compilers.\n * It can extract the [[Key]] form a [[IDstoreEntry]] which has been serialized to JSON by leveraging the property `_keyStr`.\n *\n * @category Additional\n */\n readKey(ent: IDstoreEntry): Key {\n assertIsObject(ent);\n let ret = ent[Datastore.KEY];\n if (ent._keyStr && !ret) {\n ret = this.keyFromSerialized(ent._keyStr);\n }\n assertIsObject(\n ret,\n 'entity[Datastore.KEY]/entity._keyStr',\n `Entity is missing the datastore Key: ${JSON.stringify(ent)}`\n );\n return ret;\n }\n\n /** `fixKeys()` is called for all [[IDstoreEntry]]sa returned from [[Dstore]].\n *\n * Is ensures that besides `entity[Datastore.KEY]` there is `_keyStr` to be leveraged by [[readKey]].\n *\n * @internal\n */\n private fixKeys(\n entities: ReadonlyArray<Partial<IDstoreEntry> | undefined>\n ): Array<IDstoreEntry | undefined> {\n entities.forEach((x) => {\n if (!!x?.[Datastore.KEY] && x[Datastore.KEY]) {\n assertIsDefined(x[Datastore.KEY]);\n assertIsObject(x[Datastore.KEY]);\n // Old TypesScript has problems with symbols as a property\n x._keyStr = this.keySerialize(x[Datastore.KEY] as Key);\n }\n });\n return entities as Array<IDstoreEntry | undefined>;\n }\n\n /** `get()` reads a [[IDstoreEntry]] from the Datastore.\n *\n * It returns [[IDstoreEntry]] or `null` if not found.\n\n * The underlying Datastore API Call is [lookup](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/lookup).\n *\n * It is in the Spirit of [Datastore.get()]. Unfortunately currently (late 2021) there is no formal documentation from Google on [Datastore.get()].\n *\n * Differences between [[Dstore.get]] and [[Datastore.get]]:\n *\n * - [Dstore.get]] takes a single [[Key]] as Parameter, no Array. Check [[getMulti]] if you want Arrays.\n * - [Dstore.get]] returns a single [[IDstoreEntry]], no Array.\n *\n * @category Datastore Drop-In\n */\n async get(key: Key): Promise<IDstoreEntry | null> {\n assertIsObject(key);\n assert(!Array.isArray(key));\n assert(key.path.length % 2 == 0, `key.path must be complete: ${JSON.stringify(key.path)}`);\n const result = await this.getMulti([key]);\n return result?.[0] || null;\n }\n\n /** `getMulti()` reads several [[IDstoreEntry]]s from the Datastore.\n *\n * It returns a list of [[IDstoreEntry]]s or `undefined` if not found. Entries are in the same Order as the keys in the Parameter.\n * This is different from the @google-cloud/datastore where not found items are not present in the result and the order in the result list is undefined.\n *\n * The underlying Datastore API Call is [lookup](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/lookup).\n *\n * It is in the Spirit of [Datastore.get()]. Unfortunately currently (late 2021) there is no formal documentation from Google on [Datastore.get()].\n *\n * Differences between [[Dstore.getMulti]] and [[Datastore.get]]:\n *\n * - [[Dstore.getMulti]] always takes an Array of [[Key]]s as Parameter.\n * - [[Dstore.getMulti]] returns always a Array of [[IDstoreEntry]], or null.\n * - [[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.\n *\n * @category Datastore Drop-In\n */\n async getMulti(keys: readonly Key[]): Promise<Array<IDstoreEntry | null>> {\n // assertIsArray(keys);\n let results: (IDstoreEntry | null | undefined)[];\n const metricEnd = metricHistogram.startTimer();\n try {\n results = this.fixKeys(\n keys.length > 0 ? (await this.getDoT().get(keys as Writable<typeof keys>))?.[0] : []\n );\n } catch (error) {\n metricFailureCounter.inc({ operation: 'get' });\n await setImmediate();\n throw new DstoreError('datastore.getMulti error', error as Error, { keys });\n } finally {\n metricEnd({ operation: 'get' });\n }\n\n // Sort resulting entities by the keys they were requested with.\n assertIsArray(results);\n const entities = results as IDstoreEntry[];\n const entitiesByKey: Record<string, IDstoreEntry> = {};\n entities.forEach((entity) => {\n entitiesByKey[JSON.stringify(entity[Datastore.KEY])] = entity;\n });\n return keys.map((key) => entitiesByKey[JSON.stringify(key)] || null);\n }\n\n /** `set()` is addition to [[Datastore]]. It provides a classic Key-value Interface.\n *\n * Instead providing a nested [[DstoreSaveEntity]] to [[save]] you can call set directly as `set( key, value)`.\n * Observe that set takes a [[Key]] as first parameter. you call it like this;\n *\n * ```js\n * const ds = Dstore()\n * ds.set(ds.key('kind', '123'), {props1: 'foo', prop2: 'bar'})\n * ```\n *\n * It returns the [[Key]] of the Object being written.\n * If the Key provided was an incomplete [[Key]] it will return a completed [[Key]].\n * See [[save]] for more information on key generation.\n *\n * @category Additional\n */\n async set(key: Key, data: IDstoreEntryWithoutKey): Promise<Key> {\n assertIsObject(key);\n assertIsObject(data);\n const saveEntity = { key, data };\n await this.save([saveEntity]);\n return saveEntity.key;\n }\n\n /** `save()` is compatible to [Datastore.save()](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_save_member_1_).\n *\n * The single Parameter is a list of [[DstoreSaveEntity]]s.\n * If called within a transaction it returns `undefined`.\n * If not, it returns a [[CommitResponse]] which is not documented by Google.\n *\n * Different [DstoreSaveEntity]]s in the `entities` parameter can have different values in their [[DstoreSaveEntity.method]] property.\n * This allows you to do `insert`, `update` and `upsert` (the default) in a single request.\n *\n * `save()` seems to basically be an alias to [upsert](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_upsert_member_1_).\n *\n * If the [[Key]] provided in [[DstoreSaveEntity.key]] was an incomplete [[Key]] it will be updated by `save()` inside the [[DstoreSaveEntity]].\n *\n * If the Datastore generates a new ID because of an incomplete [[Key]] *on first save* it will return an large integer as [[Key.id]].\n * On every subsequent `save()` an string encoded number representation is returned.\n * @todo Dstore should normalizes that and always return an string encoded number representation.\n *\n * Each [[DstoreSaveEntity]] can have an `excludeFromIndexes` property which is somewhat underdocumented.\n * It can use something like JSON-Path notation\n * ([Source](https://github.com/googleapis/nodejs-datastore/blob/2941f2f0f132b41534e303d441d837051ce88fd7/src/index.ts#L948))\n * [.*](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1598),\n * [parent[]](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1672),\n * [parent.*](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1672),\n * [parent[].*](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1672)\n * and [more complex patterns](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1754)\n * seem to be supported patterns.\n *\n * If the caller has not provided an `excludeLargeProperties` in a [[DstoreSaveEntity]] we will default it\n * to `excludeLargeProperties: true`. Without this you can not store strings longer than 1500 bytes easily\n * ([source](https://github.com/googleapis/nodejs-datastore/blob/c7a08a8382c6706ccbfbbf77950babf40bac757c/src/entity.ts#L961)).\n *\n * @category Datastore Drop-In\n */\n async save(entities: readonly DstoreSaveEntity[]): Promise<CommitResponse | undefined> {\n assertIsArray(entities);\n let ret: CommitResponse | undefined;\n const metricEnd = metricHistogram.startTimer();\n try {\n // Within Transaction we don't get any answer here!\n // [ { mutationResults: [ [Object], [Object] ], indexUpdates: 51 } ]\n for (const e of entities) {\n assertIsObject(e.key);\n assertIsObject(e.data);\n this.fixKeys([e.data]);\n e.excludeLargeProperties = e.excludeLargeProperties === undefined ? true : e.excludeLargeProperties;\n e.data = { ...e.data, _keyStr: undefined };\n }\n ret = (await this.getDoT().save(entities)) || undefined;\n for (const e of entities) {\n e.data[Datastore.KEY] = e.key;\n this.fixKeys([e.data]);\n }\n } catch (error) {\n metricFailureCounter.inc({ operation: 'save' });\n await setImmediate();\n throw new DstoreError('datastore.save error', error as Error);\n } finally {\n metricEnd({ operation: 'save' });\n }\n return ret;\n }\n\n /** `insert()` is compatible to [Datastore.insert()](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_insert_member_1_).\n *\n * The single Parameter is a list of [[DstoreSaveEntity]]s.\n * If called within a transaction it returns `undefined`.\n * If not, it returns a [[CommitResponse]] which is not documented by Google.\n *\n * `insert()` seems to be like [[save]] where [[DstoreSaveEntity.method]] is set to `'insert'`. It throws an [[DstoreError]] if there is already a Entity with the same [[Key]] in the Datastore.\n *\n * For handling of incomplete [[Key]]s see [[save]].\n *\n * This function can be completely emulated by using [[save]] with `method: 'insert'` inside each [[DstoreSaveEntity]].\n * Prefer using `save()` because it is much better tested.\n *\n * await ds.insert([{key: ds.key(['testKind', 123]), entity: {data:' 123'}}])\n *\n * @throws [[DstoreError]]\n * @category Datastore Drop-In\n */\n async insert(entities: readonly DstoreSaveEntity[]): Promise<CommitResponse | undefined> {\n assertIsArray(entities);\n let ret: CommitResponse | undefined;\n const metricEnd = metricHistogram.startTimer();\n try {\n ret = (await this.getDoT().insert(entities)) || undefined;\n } catch (error) {\n // console.error(error)\n metricFailureCounter.inc({ operation: 'insert' });\n await setImmediate();\n throw new DstoreError('datastore.insert error', error as Error);\n } finally {\n metricEnd({ operation: 'insert' });\n }\n return ret;\n }\n\n /** `update()` is compatible to [Datastore.update()](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_update_member_1_).\n\n * The single Parameter is a list of [[DstoreSaveEntity]]s.\n * If called within a transaction it returns `undefined`.\n * If not, it returns a [[CommitResponse]] which is not documented by Google.\n *\n * `update()` seems to be like [[save]] where [[DstoreSaveEntity.method]] is set to `'update'`.\n * It throws an [[DstoreError]] if there is no Entity with the same [[Key]] in the Datastore. `update()` *overwrites all existing data* for that [[Key]].\n * 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.\n *\n * `update()` is idempotent. Updating the same [[Key]] twice is no error.\n *\n * This function can be completely emulated by using [[save]] with `method: 'update'` inside each [[DstoreSaveEntity]].\n * Prefer using `save()` because it is much better tested.\n *\n * @throws [[DstoreError]]\n * @category Datastore Drop-In\n */\n async update(entities: readonly DstoreSaveEntity[]): Promise<CommitResponse | undefined> {\n assertIsArray(entities);\n\n entities.forEach((entity) => assertIsObject(entity.key));\n entities.forEach((entity) =>\n assert(\n entity.key.path.length % 2 == 0,\n `entity.key.path must be complete: ${JSON.stringify([entity.key.path, entity])}`\n )\n );\n let ret: CommitResponse | undefined;\n const metricEnd = metricHistogram.startTimer();\n\n try {\n ret = (await this.getDoT().update(entities)) || undefined;\n } catch (error) {\n // console.error(error)\n metricFailureCounter.inc({ operation: 'update' });\n await setImmediate();\n throw new DstoreError('datastore.update error', error as Error);\n } finally {\n metricEnd({ operation: 'update' });\n }\n return ret;\n }\n\n /** `delete()` is compatible to [Datastore.delete()].\n *\n * Unfortunately currently (late 2021) there is no formal documentation from Google on [Datastore.delete()].\n *\n * The single Parameter is a list of [[Key]]s.\n * If called within a transaction it returns `undefined`.\n * If not, it returns a [[CommitResponse]] which is not documented by Google.\n *\n * `delete()` is idempotent. Deleting the same [[Key]] twice is no error.\n *\n * @throws [[DstoreError]]\n * @category Datastore Drop-In\n */\n async delete(keys: readonly Key[]): Promise<CommitResponse | undefined> {\n assertIsArray(keys);\n keys.forEach((key) => assertIsObject(key));\n keys.forEach((key) =>\n assert(key.path.length % 2 == 0, `key.path must be complete: ${JSON.stringify(key.path)}`)\n );\n let ret;\n const metricEnd = metricHistogram.startTimer();\n try {\n ret = (await this.getDoT().delete(keys)) || undefined;\n } catch (error) {\n metricFailureCounter.inc({ operation: 'delete' });\n await setImmediate();\n throw new DstoreError('datastore.delete error', error as Error);\n } finally {\n metricEnd({ operation: 'delete' });\n }\n return ret;\n }\n\n /** `createQuery()` creates an \"empty\" [[Query]] Object.\n *\n * Compatible to [createQuery](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_createQuery_member_1_) in the datastore.\n *\n * @param kindName Name of the [[Datastore]][Kind](https://cloud.google.com/datastore/docs/concepts/entities#kinds_and_identifiers) (\"Table\") which should be searched.\n *\n * @category Datastore Drop-In\n */\n createQuery(kindName: string): Query {\n try {\n return this.getDoT().createQuery(kindName);\n } catch (error) {\n throw new DstoreError('datastore.createQuery error', error as Error);\n }\n }\n\n async runQuery(query: Query | Omit<Query, 'run'>): Promise<RunQueryResponse> {\n let ret;\n const metricEnd = metricHistogram.startTimer();\n try {\n const [entities, info]: [Entity[], RunQueryInfo] = await this.getDoT().runQuery(query as Query);\n ret = [this.fixKeys(entities), info];\n } catch (error) {\n await setImmediate();\n throw new DstoreError('datastore.runQuery error', error as Error);\n } finally {\n metricEnd({ operation: 'query' });\n }\n return ret as RunQueryResponse;\n }\n\n /** `query()` combined [[createQuery]] and [[runQuery]] in a single call.\n *\n *\n * @param kindName Name of the [[Datastore]][Kind](https://cloud.google.com/datastore/docs/concepts/entities#kinds_and_identifiers) (\"Table\") which should be searched.\n * @param filters List of [[Query]] filter() calls.\n * @param limit Maximum Number of Results to return.\n * @param ordering List of [[Query]] order() calls.\n * @param selection selectionList of [[Query]] select() calls.\n * @param cursor unsupported so far.\n *\n * @category Datastore Drop-In\n */\n async query(\n kindName: string,\n filters: TGqlFilterList = [],\n limit = 2500,\n ordering: readonly string[] = [],\n selection: readonly string[] = [],\n cursor?: string\n ): Promise<RunQueryResponse> {\n assertIsString(kindName);\n assertIsArray(filters);\n assertIsNumber(limit);\n try {\n const q = this.createQuery(kindName);\n for (const filterSpec of filters) {\n assertIsObject(filterSpec);\n // @ts-ignore\n q.filter(new PropertyFilter(...filterSpec));\n }\n for (const orderField of ordering) {\n q.order(orderField);\n }\n if (limit > 0) {\n q.limit(limit);\n }\n if (selection.length > 0) {\n q.select(selection as any);\n }\n return await this.runQuery(q);\n } catch (error) {\n await setImmediate();\n throw new DstoreError('datastore.query error', error as Error, {\n kindName,\n filters,\n limit,\n ordering,\n });\n }\n }\n\n /** Allocate one ID in the Datastore.\n *\n * Currently (late 2021) there is no documentation provided by Google for the underlying node function.\n * Check the Documentation for [the low-level function](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/allocateIds)\n * and [the conceptual overview](https://cloud.google.com/datastore/docs/concepts/entities#assigning_your_own_numeric_id)\n * and [this Stackoverflow post](https://stackoverflow.com/questions/60516959/how-does-allocateids-work-in-cloud-datastore-mode).\n *\n * The ID is a string encoded large number. This function will never return the same ID twice for any given Datastore.\n * If you provide a kindName the ID will be namespaced to this kind.\n * In fact the generated ID is namespaced via an incomplete [[Key]] of the given Kind.\n */\n async allocateOneId(kindName = 'Numbering'): Promise<string> {\n assertIsString(kindName);\n const ret = (await this.datastore.allocateIds(this.key([kindName]), 1))[0][0].id;\n assertIsString(ret);\n return ret;\n }\n\n /** This tries to give high level access to transactions.\n\n 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.\n\n [[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).\n\n 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.\n\n 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.\n\n 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).\n\n 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.\n */\n async runInTransaction<T>(func: () => Promise<T>): Promise<T> {\n let ret;\n const transaction: Transaction = this.datastore.transaction();\n await transactionAsyncLocalStorage.run(transaction, async () => {\n const [transactionInfo, transactionRunApiResponse] = await transaction.run();\n let commitApiResponse;\n try {\n ret = await func();\n } catch (error) {\n const rollbackInfo = await transaction.rollback();\n debug(\n 'Transaction failed, rollback initiated: %O %O %O %O',\n transactionInfo,\n transactionRunApiResponse,\n rollbackInfo,\n error\n );\n await setImmediate();\n throw new DstoreError('datastore.transaction execution error', error as Error);\n }\n try {\n commitApiResponse = (await transaction.commit())[0];\n } catch (error) {\n debug(\n 'Transaction commit failed: %O %O %O %O ret: %O',\n transactionInfo,\n transactionRunApiResponse,\n commitApiResponse,\n error,\n ret\n );\n await setImmediate();\n throw new DstoreError('datastore.transaction execution error', error as Error);\n }\n });\n return ret as T;\n }\n}\n\nexport class DstoreError extends Error {\n public readonly extensions: Record<string, unknown>;\n public readonly originalError: Error | undefined;\n readonly [key: string]: unknown;\n\n constructor(message: string, originalError: Error | undefined, extensions?: Record<string, unknown>) {\n super(`${message}: ${originalError?.message}`);\n\n // if no name provided, use the default. defineProperty ensures that it stays non-enumerable\n if (!this.name) {\n Object.defineProperty(this, 'name', { value: 'DstoreError' });\n }\n // metadata: Metadata { internalRepr: Map(0) {}, options: {} },\n this.originalError = originalError;\n this.extensions = { ...extensions };\n this.stack =\n (this.stack?.split('\\n')[0] || '') +\n '\\n' +\n (originalError?.stack?.split('\\n')?.slice(1)?.join('\\n') || '') +\n '\\n' +\n (this.stack?.split('\\n')?.slice(1)?.join('\\n') || '');\n\n // These are usually present on Datastore Errors\n // logger.error({ err: originalError, extensions }, message);\n }\n}\n"],"names":["debug","Debug","transactionAsyncLocalStorage","AsyncLocalStorage","metricHistogram","promClient","Histogram","name","help","labelNames","metricFailureCounter","Counter","KEYSYM","Datastore","KEY","Dstore","datastore","projectId","logger","engine","engines","urlSaveKey","entity","URLSafeKey","assertIsObject","push","_proto","prototype","getDoT","getStore","key","path","keySerialize","_this$projectId","legacyEncode","keyFromSerialized","text","legacyDecode","readKey","ent","ret","_keyStr","JSON","stringify","fixKeys","entities","_this","forEach","x","assertIsDefined","get","_get","_asyncToGenerator","_regeneratorRuntime","mark","_callee","result","wrap","_callee$","_context","prev","next","assert","Array","isArray","length","getMulti","sent","abrupt","stop","_x","apply","arguments","_getMulti","_callee2","keys","results","metricEnd","_yield$this$getDoT$ge","entitiesByKey","_callee2$","_context2","startTimer","t0","t2","t3","t1","t4","call","t5","inc","operation","setImmediate","DstoreError","finish","assertIsArray","map","_x2","set","_set","_callee3","data","saveEntity","_callee3$","_context3","save","_x3","_x4","_save","_callee4","_iterator","_step","e","_iterator2","_step2","_e","_callee4$","_context4","_createForOfIteratorHelperLoose","done","value","excludeLargeProperties","undefined","_extends","_x5","insert","_insert","_callee5","_callee5$","_context5","_x6","update","_update","_callee6","_callee6$","_context6","_x7","_delete2","_callee7","_callee7$","_context7","_delete","_x8","createQuery","kindName","error","runQuery","_runQuery","_callee8","query","_yield$this$getDoT$ru","info","_callee8$","_context8","_x9","_query","_callee9","filters","limit","ordering","selection","cursor","q","_iterator3","_step3","filterSpec","_iterator4","_step4","orderField","_callee9$","_context9","assertIsString","assertIsNumber","filter","_construct","PropertyFilter","order","select","_x10","_x11","_x12","_x13","_x14","_x15","allocateOneId","_allocateOneId","_callee10","_callee10$","_context10","allocateIds","id","_x16","runInTransaction","_runInTransaction","_callee12","func","transaction","_callee12$","_context12","run","_callee11","_yield$transaction$ru","transactionInfo","transactionRunApiResponse","commitApiResponse","rollbackInfo","_callee11$","_context11","rollback","commit","_x17","_Error","_inheritsLoose","message","originalError","extensions","_this2$stack","_originalError$stack","_originalError$stack$","_originalError$stack$2","_this2$stack2","_this2$stack2$split","_this2$stack2$split$s","_this2","Object","defineProperty","_assertThisInitialized","stack","split","slice","join","_wrapNativeSuper","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA;AACA,IAAMA,KAAK,gBAAGC,KAAK,CAAC,QAAQ,CAAC,CAAA;AAE7B;AACA,IAAMC,4BAA4B,gBAAG,IAAIC,6BAAiB,EAAE,CAAA;AAE5D;AACA,IAAMC,eAAe,gBAAG,IAAIC,UAAU,CAACC,SAAS,CAAC;AAC/CC,EAAAA,IAAI,EAAE,yBAAyB;AAC/BC,EAAAA,IAAI,EAAE,yCAAyC;EAC/CC,UAAU,EAAE,CAAC,WAAW,CAAA;AACzB,CAAA,CAAC,CAAA;AACF,IAAMC,oBAAoB,gBAAG,IAAIL,UAAU,CAACM,OAAO,CAAC;AAClDJ,EAAAA,IAAI,EAAE,uBAAuB;AAC7BC,EAAAA,IAAI,EAAE,uCAAuC;EAC7CC,U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AAI,EAAE,CAAC,GAC/D,IAAI,IACH,CAAAV,CAAAA,aAAA,GAAAG,MAAA,CAAKI,KAAK,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,CAAAN,mBAAA,GAAVD,aAAA,CAAYQ,KAAK,CAAC,IAAI,CAAC,sBAAAN,qBAAA,GAAvBD,mBAAA,CAAyBQ,KAAK,CAAC,CAAC,CAAC,KAAA,IAAA,GAAA,KAAA,CAAA,GAAjCP,qBAAA,CAAmCQ,IAAI,CAAC,IAAI,CAAC,KAAI,EAAE,CAAC,CAAA;AAEvD;AACA;AAAA,IAAA,OAAAP,MAAA,CAAA;AACF,GAAA;AAAC,EAAA,OAAAlI,WAAA,CAAA;AAAA,CAAA0I,eAAAA,gBAAA,CAxB8BC,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"datastore-api.cjs.development.js","sources":["../src/lib/dstore-api.ts"],"sourcesContent":["/*\n * dstore.ts - Datastore Compatibility layer\n * Try to get a smoother api for transactions and such.\n * A little bit inspired by the Python2 ndb interface.\n * But without the ORM bits.\n *\n * In future https://github.com/graphql/dataloader might be used for batching.\n *\n * Created by Dr. Maximillian Dornseif 2021-12-05 in huwawi3backend 11.10.0\n * Copyright (c) 2021, 2022, 2023 Dr. Maximillian Dornseif\n */\n\nimport { AsyncLocalStorage } from 'async_hooks';\nimport { setImmediate } from 'timers/promises';\n\nimport { Datastore, Key, PathType, Query, Transaction, PropertyFilter } from '@google-cloud/datastore';\nimport { Entity, entity } from '@google-cloud/datastore/build/src/entity';\nimport { Operator, RunQueryInfo, RunQueryResponse } from '@google-cloud/datastore/build/src/query';\nimport { CommitResponse } from '@google-cloud/datastore/build/src/request';\nimport {\n assert,\n assertIsArray,\n assertIsDefined,\n assertIsNumber,\n assertIsObject,\n assertIsString,\n} from 'assertate-debug';\nimport Debug from 'debug';\nimport promClient from 'prom-client';\nimport { Writable } from 'ts-essentials';\n\n/** @ignore */\nexport { Datastore, Key, PathType, Query, Transaction } from '@google-cloud/datastore';\n\n/** @ignore */\nconst debug = Debug('ds:api');\n\n/** @ignore */\nconst transactionAsyncLocalStorage = new AsyncLocalStorage();\n\n// for HMR\npromClient.register.removeSingleMetric('dstore_requests_seconds')\npromClient.register.removeSingleMetric('dstore_failures_total')\n/** @ignore */\nconst metricHistogram = new promClient.Histogram({\n name: 'dstore_requests_seconds',\n help: 'How long did Datastore operations take?',\n labelNames: ['operation'],\n});\nconst metricFailureCounter = new promClient.Counter({\n name: 'dstore_failures_total',\n help: 'How many Datastore operations failed?',\n labelNames: ['operation'],\n});\n\n/** Use instead of Datastore.KEY\n *\n * Even better: use `_key` instead.\n */\nexport const KEYSYM = Datastore.KEY;\n\nexport type IGqlFilterTypes = boolean | string | number;\n\nexport type IGqlFilterSpec = {\n readonly eq: IGqlFilterTypes;\n};\nexport type TGqlFilterList = Array<[string, Operator, DstorePropertyValues]>;\n\n/** Define what can be written into the Datastore */\nexport type DstorePropertyValues =\n | number\n | string\n | Date\n | boolean\n | null\n | undefined\n | Buffer\n | Key\n | DstorePropertyValues[]\n | { [key: string]: DstorePropertyValues };\n\nexport interface IDstoreEntryWithoutKey {\n /** All User Data stored in the Datastore */\n [key: string]: DstorePropertyValues;\n}\n\n/** Represents what is actually stored inside the Datastore, called \"Entity\" by Google\n [@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 key. It is automatically used to reconstruct `[Datastore.KEY]`, if you use [[Dstore.readKey]].\n*/\nexport interface IDstoreEntry extends IDstoreEntryWithoutKey {\n /* Datastore Key provided by [@google-cloud/datastore](https://github.com/googleapis/nodejs-datastore#readme) */\n readonly [Datastore.KEY]?: Key;\n /** [Datastore.KEY] key */\n _keyStr: string;\n}\n\n/** Represents the thing you pass to the save method. Also called \"Entity\" by Google */\nexport type DstoreSaveEntity = {\n key: Key;\n data: Omit<IDstoreEntry, '_keyStr' | Datastore['KEY']> &\n Partial<{\n _keyStr: string|undefined;\n [Datastore.KEY]: Key;\n }>;\n method?: 'insert' | 'update' | 'upsert';\n excludeLargeProperties?: boolean;\n excludeFromIndexes?: readonly string[];\n};\n\ntype IDstore = {\n /** Accessible by Users of the library. Keep in mind that you will access outside transactions created by [[runInTransaction]]. */\n readonly datastore: Datastore;\n key: (path: ReadonlyArray<PathType>) => Key;\n keyFromSerialized: (text: string) => Key;\n keySerialize: (key: Key) => string;\n readKey: (entry: IDstoreEntry) => Key;\n get: (key: Key) => Promise<IDstoreEntry | null>;\n getMulti: (keys: ReadonlyArray<Key>) => Promise<ReadonlyArray<IDstoreEntry | null>>;\n set: (key: Key, entry: IDstoreEntry) => Promise<Key>;\n save: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;\n insert: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;\n update: (entities: readonly DstoreSaveEntity[]) => Promise<CommitResponse | undefined>;\n delete: (keys: readonly Key[]) => Promise<CommitResponse | undefined>;\n createQuery: (kind: string) => Query;\n query: (\n kind: string,\n filters?: TGqlFilterList,\n limit?: number,\n ordering?: readonly string[],\n selection?: readonly string[],\n cursor?: string\n ) => Promise<RunQueryResponse>;\n runQuery: (query: Query | Omit<Query, 'run'>) => Promise<RunQueryResponse>;\n allocateOneId: (kindName: string) => Promise<string>;\n runInTransaction: <T>(func: { (): Promise<T>; (): T }) => Promise<T>;\n};\n\n/** Dstore implements a slightly more accessible version of the [Google Cloud Datastore: Node.js Client](https://cloud.google.com/nodejs/docs/reference/datastore/latest)\n\n[@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.\n(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.\n\nAlso 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.\n\nKvStore 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).\n\nMain differences:\n\n- Everything asynchronous is Promise-based - no callbacks.\n- [[get]] always returns a single [[IDstoreEntry]].\n- [[getMulti]] always returns an Array<[[IDstoreEntry]]> of the same length as the input Array. Items not found are represented by null.\n- [[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.\n- [[key]] handles [[Key]] object instantiation for you.\n- [[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.\n- [[allocateOneId]] returns a single numeric string encoded unique datastore id without the need of fancy unpacking.\n- [[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).\n- [[keySerialize]] is synchronous.\n\nThis documentation also tries to document the little known idiosyncrasies of the [@google-cloud/datastore](https://github.com/googleapis/nodejs-datastore) library. See the corresponding functions.\n*/\nexport class Dstore implements IDstore {\n engine = 'Dstore';\n engines: string[] = [];\n private readonly urlSaveKey = new entity.URLSafeKey();\n\n /** Generate a Dstore instance for a specific [[Datastore]] instance.\n\n ```\n const dstore = Dstore(new Datastore())\n ```\n\n You are encouraged to provide the second parameter to provide the ProjectID. This makes [[keySerialize]] more robust. Usually you can get this from the Environment:\n\n ```\n const dstore = Dstore(new Datastore(), process.env.GCLOUD_PROJECT)\n\n @param datastore A [[Datastore]] instance. Can be freely accessed by the client. Be aware that using this inside [[runInTransaction]] ignores the transaction.\n @param projectId The `GCLOUD_PROJECT ID`. Used for Key generation during serialization.\n ```\n */\n constructor(readonly datastore: Datastore, readonly projectId?: string, readonly logger?: string) {\n assertIsObject(datastore);\n this.engines.push(this.engine);\n }\n\n /** Gets the Datastore or the current Transaction. */\n private getDoT(): Transaction | Datastore {\n return (transactionAsyncLocalStorage.getStore() as Transaction) || this.datastore;\n }\n\n /** `key()` creates a [[Key]] Object from a path.\n *\n * Compatible to [Datastore.key](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_key_member_1_)\n *\n * If the Path has an odd number of elements, it is considered an incomplete Key. This can only be used for saving and will prompt the Datastore to auto-generate an (random) ID. See also [[save]].\n *\n * @category Datastore Drop-In\n */\n key(path: readonly PathType[]): Key {\n return this.datastore.key(path as Writable<typeof path>);\n }\n\n /** `keyFromSerialized()` serializes [[Key]] to a string.\n *\n * Compatible to [keyToLegacyUrlSafe](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_keyToLegacyUrlSafe_member_1_), but does not support the \"locationPrefix\" since the use for this parameter is undocumented and unknown. It seems to be an artifact from early App Engine days.\n *\n * It can be a synchronous function because it does not look up the `projectId`. Instead it is assumed, that you give the `projectId` upon instantiation of [[Dstore]]. It also seems, that a wrong `projectId` bears no ill effects.\n *\n * @category Datastore Drop-In\n */\n keySerialize(key: Key): string {\n return key ? this.urlSaveKey.legacyEncode(this.projectId ?? '', key) : '';\n }\n\n /** `keyFromSerialized()` deserializes a string created with [[keySerialize]] to a [[Key]].\n *\n * Compatible to [keyFromLegacyUrlsafe](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_keyFromLegacyUrlsafe_member_1_).\n *\n * @category Datastore Drop-In\n */\n keyFromSerialized(text: string): Key {\n return this.urlSaveKey.legacyDecode(text);\n }\n\n /** `readKey()` extracts the [[Key]] from an [[IDstoreEntry]].\n *\n * Is is an alternative to `entity[Datastore.KEY]` which tends to fail in various contexts and also confuses older Typescript compilers.\n * It can extract the [[Key]] form a [[IDstoreEntry]] which has been serialized to JSON by leveraging the property `_keyStr`.\n *\n * @category Additional\n */\n readKey(ent: IDstoreEntry): Key {\n assertIsObject(ent);\n let ret = ent[Datastore.KEY];\n if (ent._keyStr && !ret) {\n ret = this.keyFromSerialized(ent._keyStr);\n }\n assertIsObject(\n ret,\n 'entity[Datastore.KEY]/entity._keyStr',\n `Entity is missing the datastore Key: ${JSON.stringify(ent)}`\n );\n return ret;\n }\n\n /** `fixKeys()` is called for all [[IDstoreEntry]]sa returned from [[Dstore]].\n *\n * Is ensures that besides `entity[Datastore.KEY]` there is `_keyStr` to be leveraged by [[readKey]].\n *\n * @internal\n */\n private fixKeys(\n entities: ReadonlyArray<Partial<IDstoreEntry> | undefined>\n ): Array<IDstoreEntry | undefined> {\n entities.forEach((x) => {\n if (!!x?.[Datastore.KEY] && x[Datastore.KEY]) {\n assertIsDefined(x[Datastore.KEY]);\n assertIsObject(x[Datastore.KEY]);\n // Old TypesScript has problems with symbols as a property\n x._keyStr = this.keySerialize(x[Datastore.KEY] as Key);\n }\n });\n return entities as Array<IDstoreEntry | undefined>;\n }\n\n /** `get()` reads a [[IDstoreEntry]] from the Datastore.\n *\n * It returns [[IDstoreEntry]] or `null` if not found.\n\n * The underlying Datastore API Call is [lookup](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/lookup).\n *\n * It is in the Spirit of [Datastore.get()]. Unfortunately currently (late 2021) there is no formal documentation from Google on [Datastore.get()].\n *\n * Differences between [[Dstore.get]] and [[Datastore.get]]:\n *\n * - [Dstore.get]] takes a single [[Key]] as Parameter, no Array. Check [[getMulti]] if you want Arrays.\n * - [Dstore.get]] returns a single [[IDstoreEntry]], no Array.\n *\n * @category Datastore Drop-In\n */\n async get(key: Key): Promise<IDstoreEntry | null> {\n assertIsObject(key);\n assert(!Array.isArray(key));\n assert(key.path.length % 2 == 0, `key.path must be complete: ${JSON.stringify(key.path)}`);\n const result = await this.getMulti([key]);\n return result?.[0] || null;\n }\n\n /** `getMulti()` reads several [[IDstoreEntry]]s from the Datastore.\n *\n * It returns a list of [[IDstoreEntry]]s or `undefined` if not found. Entries are in the same Order as the keys in the Parameter.\n * This is different from the @google-cloud/datastore where not found items are not present in the result and the order in the result list is undefined.\n *\n * The underlying Datastore API Call is [lookup](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/lookup).\n *\n * It is in the Spirit of [Datastore.get()]. Unfortunately currently (late 2021) there is no formal documentation from Google on [Datastore.get()].\n *\n * Differences between [[Dstore.getMulti]] and [[Datastore.get]]:\n *\n * - [[Dstore.getMulti]] always takes an Array of [[Key]]s as Parameter.\n * - [[Dstore.getMulti]] returns always a Array of [[IDstoreEntry]], or null.\n * - [[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.\n *\n * @category Datastore Drop-In\n */\n async getMulti(keys: readonly Key[]): Promise<Array<IDstoreEntry | null>> {\n // assertIsArray(keys);\n let results: (IDstoreEntry | null | undefined)[];\n const metricEnd = metricHistogram.startTimer();\n try {\n results = this.fixKeys(\n keys.length > 0 ? (await this.getDoT().get(keys as Writable<typeof keys>))?.[0] : []\n );\n } catch (error) {\n metricFailureCounter.inc({ operation: 'get' });\n await setImmediate();\n throw new DstoreError('datastore.getMulti error', error as Error, { keys });\n } finally {\n metricEnd({ operation: 'get' });\n }\n\n // Sort resulting entities by the keys they were requested with.\n assertIsArray(results);\n const entities = results as IDstoreEntry[];\n const entitiesByKey: Record<string, IDstoreEntry> = {};\n entities.forEach((entity) => {\n entitiesByKey[JSON.stringify(entity[Datastore.KEY])] = entity;\n });\n return keys.map((key) => entitiesByKey[JSON.stringify(key)] || null);\n }\n\n /** `set()` is addition to [[Datastore]]. It provides a classic Key-value Interface.\n *\n * Instead providing a nested [[DstoreSaveEntity]] to [[save]] you can call set directly as `set( key, value)`.\n * Observe that set takes a [[Key]] as first parameter. you call it like this;\n *\n * ```js\n * const ds = Dstore()\n * ds.set(ds.key('kind', '123'), {props1: 'foo', prop2: 'bar'})\n * ```\n *\n * It returns the [[Key]] of the Object being written.\n * If the Key provided was an incomplete [[Key]] it will return a completed [[Key]].\n * See [[save]] for more information on key generation.\n *\n * @category Additional\n */\n async set(key: Key, data: IDstoreEntryWithoutKey): Promise<Key> {\n assertIsObject(key);\n assertIsObject(data);\n const saveEntity = { key, data };\n await this.save([saveEntity]);\n return saveEntity.key;\n }\n\n /** `save()` is compatible to [Datastore.save()](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_save_member_1_).\n *\n * The single Parameter is a list of [[DstoreSaveEntity]]s.\n * If called within a transaction it returns `undefined`.\n * If not, it returns a [[CommitResponse]] which is not documented by Google.\n *\n * Different [DstoreSaveEntity]]s in the `entities` parameter can have different values in their [[DstoreSaveEntity.method]] property.\n * This allows you to do `insert`, `update` and `upsert` (the default) in a single request.\n *\n * `save()` seems to basically be an alias to [upsert](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_upsert_member_1_).\n *\n * If the [[Key]] provided in [[DstoreSaveEntity.key]] was an incomplete [[Key]] it will be updated by `save()` inside the [[DstoreSaveEntity]].\n *\n * If the Datastore generates a new ID because of an incomplete [[Key]] *on first save* it will return an large integer as [[Key.id]].\n * On every subsequent `save()` an string encoded number representation is returned.\n * @todo Dstore should normalizes that and always return an string encoded number representation.\n *\n * Each [[DstoreSaveEntity]] can have an `excludeFromIndexes` property which is somewhat underdocumented.\n * It can use something like JSON-Path notation\n * ([Source](https://github.com/googleapis/nodejs-datastore/blob/2941f2f0f132b41534e303d441d837051ce88fd7/src/index.ts#L948))\n * [.*](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1598),\n * [parent[]](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1672),\n * [parent.*](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1672),\n * [parent[].*](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1672)\n * and [more complex patterns](https://github.com/googleapis/nodejs-datastore/blob/406b15d2014087172df617c6e0a397a2c0902c5f/test/index.ts#L1754)\n * seem to be supported patterns.\n *\n * If the caller has not provided an `excludeLargeProperties` in a [[DstoreSaveEntity]] we will default it\n * to `excludeLargeProperties: true`. Without this you can not store strings longer than 1500 bytes easily\n * ([source](https://github.com/googleapis/nodejs-datastore/blob/c7a08a8382c6706ccbfbbf77950babf40bac757c/src/entity.ts#L961)).\n *\n * @category Datastore Drop-In\n */\n async save(entities: readonly DstoreSaveEntity[]): Promise<CommitResponse | undefined> {\n assertIsArray(entities);\n let ret: CommitResponse | undefined;\n const metricEnd = metricHistogram.startTimer();\n try {\n // Within Transaction we don't get any answer here!\n // [ { mutationResults: [ [Object], [Object] ], indexUpdates: 51 } ]\n for (const e of entities) {\n assertIsObject(e.key);\n assertIsObject(e.data);\n this.fixKeys([e.data]);\n e.excludeLargeProperties = e.excludeLargeProperties === undefined ? true : e.excludeLargeProperties;\n e.data = { ...e.data, _keyStr: undefined };\n }\n ret = (await this.getDoT().save(entities)) || undefined;\n for (const e of entities) {\n e.data[Datastore.KEY] = e.key;\n this.fixKeys([e.data]);\n }\n } catch (error) {\n metricFailureCounter.inc({ operation: 'save' });\n await setImmediate();\n throw new DstoreError('datastore.save error', error as Error);\n } finally {\n metricEnd({ operation: 'save' });\n }\n return ret;\n }\n\n /** `insert()` is compatible to [Datastore.insert()](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_insert_member_1_).\n *\n * The single Parameter is a list of [[DstoreSaveEntity]]s.\n * If called within a transaction it returns `undefined`.\n * If not, it returns a [[CommitResponse]] which is not documented by Google.\n *\n * `insert()` seems to be like [[save]] where [[DstoreSaveEntity.method]] is set to `'insert'`. It throws an [[DstoreError]] if there is already a Entity with the same [[Key]] in the Datastore.\n *\n * For handling of incomplete [[Key]]s see [[save]].\n *\n * This function can be completely emulated by using [[save]] with `method: 'insert'` inside each [[DstoreSaveEntity]].\n * Prefer using `save()` because it is much better tested.\n *\n * await ds.insert([{key: ds.key(['testKind', 123]), entity: {data:' 123'}}])\n *\n * @throws [[DstoreError]]\n * @category Datastore Drop-In\n */\n async insert(entities: readonly DstoreSaveEntity[]): Promise<CommitResponse | undefined> {\n assertIsArray(entities);\n let ret: CommitResponse | undefined;\n const metricEnd = metricHistogram.startTimer();\n try {\n ret = (await this.getDoT().insert(entities)) || undefined;\n } catch (error) {\n // console.error(error)\n metricFailureCounter.inc({ operation: 'insert' });\n await setImmediate();\n throw new DstoreError('datastore.insert error', error as Error);\n } finally {\n metricEnd({ operation: 'insert' });\n }\n return ret;\n }\n\n /** `update()` is compatible to [Datastore.update()](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_update_member_1_).\n\n * The single Parameter is a list of [[DstoreSaveEntity]]s.\n * If called within a transaction it returns `undefined`.\n * If not, it returns a [[CommitResponse]] which is not documented by Google.\n *\n * `update()` seems to be like [[save]] where [[DstoreSaveEntity.method]] is set to `'update'`.\n * It throws an [[DstoreError]] if there is no Entity with the same [[Key]] in the Datastore. `update()` *overwrites all existing data* for that [[Key]].\n * 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.\n *\n * `update()` is idempotent. Updating the same [[Key]] twice is no error.\n *\n * This function can be completely emulated by using [[save]] with `method: 'update'` inside each [[DstoreSaveEntity]].\n * Prefer using `save()` because it is much better tested.\n *\n * @throws [[DstoreError]]\n * @category Datastore Drop-In\n */\n async update(entities: readonly DstoreSaveEntity[]): Promise<CommitResponse | undefined> {\n assertIsArray(entities);\n\n entities.forEach((entity) => assertIsObject(entity.key));\n entities.forEach((entity) =>\n assert(\n entity.key.path.length % 2 == 0,\n `entity.key.path must be complete: ${JSON.stringify([entity.key.path, entity])}`\n )\n );\n let ret: CommitResponse | undefined;\n const metricEnd = metricHistogram.startTimer();\n\n try {\n ret = (await this.getDoT().update(entities)) || undefined;\n } catch (error) {\n // console.error(error)\n metricFailureCounter.inc({ operation: 'update' });\n await setImmediate();\n throw new DstoreError('datastore.update error', error as Error);\n } finally {\n metricEnd({ operation: 'update' });\n }\n return ret;\n }\n\n /** `delete()` is compatible to [Datastore.delete()].\n *\n * Unfortunately currently (late 2021) there is no formal documentation from Google on [Datastore.delete()].\n *\n * The single Parameter is a list of [[Key]]s.\n * If called within a transaction it returns `undefined`.\n * If not, it returns a [[CommitResponse]] which is not documented by Google.\n *\n * `delete()` is idempotent. Deleting the same [[Key]] twice is no error.\n *\n * @throws [[DstoreError]]\n * @category Datastore Drop-In\n */\n async delete(keys: readonly Key[]): Promise<CommitResponse | undefined> {\n assertIsArray(keys);\n keys.forEach((key) => assertIsObject(key));\n keys.forEach((key) =>\n assert(key.path.length % 2 == 0, `key.path must be complete: ${JSON.stringify(key.path)}`)\n );\n let ret;\n const metricEnd = metricHistogram.startTimer();\n try {\n ret = (await this.getDoT().delete(keys)) || undefined;\n } catch (error) {\n metricFailureCounter.inc({ operation: 'delete' });\n await setImmediate();\n throw new DstoreError('datastore.delete error', error as Error);\n } finally {\n metricEnd({ operation: 'delete' });\n }\n return ret;\n }\n\n /** `createQuery()` creates an \"empty\" [[Query]] Object.\n *\n * Compatible to [createQuery](https://cloud.google.com/nodejs/docs/reference/datastore/latest/datastore/datastore#_google_cloud_datastore_Datastore_createQuery_member_1_) in the datastore.\n *\n * @param kindName Name of the [[Datastore]][Kind](https://cloud.google.com/datastore/docs/concepts/entities#kinds_and_identifiers) (\"Table\") which should be searched.\n *\n * @category Datastore Drop-In\n */\n createQuery(kindName: string): Query {\n try {\n return this.getDoT().createQuery(kindName);\n } catch (error) {\n throw new DstoreError('datastore.createQuery error', error as Error);\n }\n }\n\n async runQuery(query: Query | Omit<Query, 'run'>): Promise<RunQueryResponse> {\n let ret;\n const metricEnd = metricHistogram.startTimer();\n try {\n const [entities, info]: [Entity[], RunQueryInfo] = await this.getDoT().runQuery(query as Query);\n ret = [this.fixKeys(entities), info];\n } catch (error) {\n await setImmediate();\n throw new DstoreError('datastore.runQuery error', error as Error);\n } finally {\n metricEnd({ operation: 'query' });\n }\n return ret as RunQueryResponse;\n }\n\n /** `query()` combined [[createQuery]] and [[runQuery]] in a single call.\n *\n *\n * @param kindName Name of the [[Datastore]][Kind](https://cloud.google.com/datastore/docs/concepts/entities#kinds_and_identifiers) (\"Table\") which should be searched.\n * @param filters List of [[Query]] filter() calls.\n * @param limit Maximum Number of Results to return.\n * @param ordering List of [[Query]] order() calls.\n * @param selection selectionList of [[Query]] select() calls.\n * @param cursor unsupported so far.\n *\n * @category Datastore Drop-In\n */\n async query(\n kindName: string,\n filters: TGqlFilterList = [],\n limit = 2500,\n ordering: readonly string[] = [],\n selection: readonly string[] = [],\n cursor?: string\n ): Promise<RunQueryResponse> {\n assertIsString(kindName);\n assertIsArray(filters);\n assertIsNumber(limit);\n try {\n const q = this.createQuery(kindName);\n for (const filterSpec of filters) {\n assertIsObject(filterSpec);\n // @ts-ignore\n q.filter(new PropertyFilter(...filterSpec));\n }\n for (const orderField of ordering) {\n q.order(orderField);\n }\n if (limit > 0) {\n q.limit(limit);\n }\n if (selection.length > 0) {\n q.select(selection as any);\n }\n return await this.runQuery(q);\n } catch (error) {\n await setImmediate();\n throw new DstoreError('datastore.query error', error as Error, {\n kindName,\n filters,\n limit,\n ordering,\n });\n }\n }\n\n /** Allocate one ID in the Datastore.\n *\n * Currently (late 2021) there is no documentation provided by Google for the underlying node function.\n * Check the Documentation for [the low-level function](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/allocateIds)\n * and [the conceptual overview](https://cloud.google.com/datastore/docs/concepts/entities#assigning_your_own_numeric_id)\n * and [this Stackoverflow post](https://stackoverflow.com/questions/60516959/how-does-allocateids-work-in-cloud-datastore-mode).\n *\n * The ID is a string encoded large number. This function will never return the same ID twice for any given Datastore.\n * If you provide a kindName the ID will be namespaced to this kind.\n * In fact the generated ID is namespaced via an incomplete [[Key]] of the given Kind.\n */\n async allocateOneId(kindName = 'Numbering'): Promise<string> {\n assertIsString(kindName);\n const ret = (await this.datastore.allocateIds(this.key([kindName]), 1))[0][0].id;\n assertIsString(ret);\n return ret;\n }\n\n /** This tries to give high level access to transactions.\n\n 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.\n\n [[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).\n\n 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.\n\n 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.\n\n 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).\n\n 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.\n */\n async runInTransaction<T>(func: () => Promise<T>): Promise<T> {\n let ret;\n const transaction: Transaction = this.datastore.transaction();\n await transactionAsyncLocalStorage.run(transaction, async () => {\n const [transactionInfo, transactionRunApiResponse] = await transaction.run();\n let commitApiResponse;\n try {\n ret = await func();\n } catch (error) {\n const rollbackInfo = await transaction.rollback();\n debug(\n 'Transaction failed, rollback initiated: %O %O %O %O',\n transactionInfo,\n transactionRunApiResponse,\n rollbackInfo,\n error\n );\n await setImmediate();\n throw new DstoreError('datastore.transaction execution error', error as Error);\n }\n try {\n commitApiResponse = (await transaction.commit())[0];\n } catch (error) {\n debug(\n 'Transaction commit failed: %O %O %O %O ret: %O',\n transactionInfo,\n transactionRunApiResponse,\n commitApiResponse,\n error,\n ret\n );\n await setImmediate();\n throw new DstoreError('datastore.transaction execution error', error as Error);\n }\n });\n return ret as T;\n }\n}\n\nexport class DstoreError extends Error {\n public readonly extensions: Record<string, unknown>;\n public readonly originalError: Error | undefined;\n readonly [key: string]: unknown;\n\n constructor(message: string, originalError: Error | undefined, extensions?: Record<string, unknown>) {\n super(`${message}: ${originalError?.message}`);\n\n // if no name provided, use the default. defineProperty ensures that it stays non-enumerable\n if (!this.name) {\n Object.defineProperty(this, 'name', { value: 'DstoreError' });\n }\n // metadata: Metadata { internalRepr: Map(0) {}, options: {} },\n this.originalError = originalError;\n this.extensions = { ...extensions };\n this.stack =\n (this.stack?.split('\\n')[0] || '') +\n '\\n' +\n (originalError?.stack?.split('\\n')?.slice(1)?.join('\\n') || '') +\n '\\n' +\n (this.stack?.split('\\n')?.slice(1)?.join('\\n') || '');\n\n // These are usually present on Datastore Errors\n // logger.error({ err: originalError, extensions }, message);\n }\n}\n"],"names":["debug","Debug","transactionAsyncLocalStorage","AsyncLocalStorage","promClient","register","removeSingleMetric","metricHistogram","Histogram","name","help","labelNames","metricFailureCounter","Counter","KEYSYM","Datastore","KEY","Dstore","datastore","projectId","logger","engine","engines","urlSaveKey","entity","URLSafeKey","assertIsObject","push","_proto","prototype","getDoT","getStore","key","path","keySerialize","_this$projectId","legacyEncode","keyFromSerialized","text","legacyDecode","readKey","ent","ret","_keyStr","JSON","stringify","fixKeys","entities","_this","forEach","x","assertIsDefined","get","_get","_asyncToGenerator","_regeneratorRuntime","mark","_callee","result","wrap","_callee$","_context","prev","next","assert","Array","isArray","length","getMulti","sent","abrupt","stop","_x","apply","arguments","_getMulti","_callee2","keys","results","metricEnd","_yield$this$getDoT$ge","entitiesByKey","_callee2$","_context2","startTimer","t0","t2","t3","t1","t4","call","t5","inc","operation","setImmediate","DstoreError","finish","assertIsArray","map","_x2","set","_set","_callee3","data","saveEntity","_callee3$","_context3","save","_x3","_x4","_save","_callee4","_iterator","_step","e","_iterator2","_step2","_e","_callee4$","_context4","_createForOfIteratorHelperLoose","done","value","excludeLargeProperties","undefined","_extends","_x5","insert","_insert","_callee5","_callee5$","_context5","_x6","update","_update","_callee6","_callee6$","_context6","_x7","_delete2","_callee7","_callee7$","_context7","_delete","_x8","createQuery","kindName","error","runQuery","_runQuery","_callee8","query","_yield$this$getDoT$ru","info","_callee8$","_context8","_x9","_query","_callee9","filters","limit","ordering","selection","cursor","q","_iterator3","_step3","filterSpec","_iterator4","_step4","orderField","_callee9$","_context9","assertIsString","assertIsNumber","filter","_construct","PropertyFilter","order","select","_x10","_x11","_x12","_x13","_x14","_x15","allocateOneId","_allocateOneId","_callee10","_callee10$","_context10","allocateIds","id","_x16","runInTransaction","_runInTransaction","_callee12","func","transaction","_callee12$","_context12","run","_callee11","_yield$transaction$ru","transactionInfo","transactionRunApiResponse","commitApiResponse","rollbackInfo","_callee11$","_context11","rollback","commit","_x17","_Error","_inheritsLoose","message","originalError","extensions","_this2$stack","_originalError$stack","_originalError$stack$","_originalError$stack$2","_this2$stack2","_this2$stack2$split","_this2$stack2$split$s","_this2","Object","def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AE,CAAC,GAC/D,IAAI,IACH,CAAAV,CAAAA,aAAA,GAAAG,MAAA,CAAKI,KAAK,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,CAAAN,mBAAA,GAAVD,aAAA,CAAYQ,KAAK,CAAC,IAAI,CAAC,sBAAAN,qBAAA,GAAvBD,mBAAA,CAAyBQ,KAAK,CAAC,CAAC,CAAC,KAAA,IAAA,GAAA,KAAA,CAAA,GAAjCP,qBAAA,CAAmCQ,IAAI,CAAC,IAAI,CAAC,KAAI,EAAE,CAAC,CAAA;AAEvD;AACA;AAAA,IAAA,OAAAP,MAAA,CAAA;AACF,GAAA;AAAC,EAAA,OAAAlI,WAAA,CAAA;AAAA,CAAA0I,eAAAA,gBAAA,CAxB8BC,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("async_hooks"),e=require("timers/promises"),r=require("@google-cloud/datastore"),n=require("@google-cloud/datastore/build/src/entity"),o=require("assertate-debug"),a=require("debug"),i=require("prom-client");function s(){s=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function f(t,e,r,o){var a=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new I(o||[]);return n(a,"_invoke",{value:k(t,r,i)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var p={};function h(){}function d(){}function v(){}var y={};c(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(S([])));m&&m!==e&&r.call(m,a)&&(y=m);var b=v.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(n,a,i,s){var u=l(t[n],t,a);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,i,s)}),(function(t){o("throw",t,i,s)})):e.resolve(f).then((function(t){c.value=t,i(c)}),(function(t){return o("throw",t,i,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function k(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=O(i,r);if(s){if(s===p)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;var a=o.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:_}}function _(){return{value:void 0,done:!0}}return d.prototype=v,n(b,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:d,configurable:!0}),d.displayName=c(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),c(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new x(f(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},w(b),c(b,u,"Generator"),c(b,a,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=S,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function u(t,e,r,n,o,a,i){try{var s=t[a](i),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function c(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){u(a,n,o,i,s,"next",t)}function s(t){u(a,n,o,i,s,"throw",t)}i(void 0)}))}}function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f.apply(this,arguments)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function h(t,e,r){return h=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&p(o,r.prototype),o},h.apply(null,arguments)}function d(t){var e="function"==typeof Map?new Map:void 0;return d=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return h(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,t)},d(t)}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function y(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return v(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var g=a("ds:api"),m=new t.AsyncLocalStorage,b=new i.Histogram({name:"dstore_requests_seconds",help:"How long did Datastore operations take?",labelNames:["operation"]}),w=new i.Counter({name:"dstore_failures_total",help:"How many Datastore operations failed?",labelNames:["operation"]}),x=r.Datastore.KEY,k=function(){function t(t,e,r){this.datastore=void 0,this.projectId=void 0,this.logger=void 0,this.engine="Dstore",this.engines=[],this.urlSaveKey=new n.entity.URLSafeKey,this.datastore=t,this.projectId=e,this.logger=r,o.assertIsObject(t),this.engines.push(this.engine)}var a=t.prototype;return a.getDoT=function(){return m.getStore()||this.datastore},a.key=function(t){return this.datastore.key(t)},a.keySerialize=function(t){var e;return t?this.urlSaveKey.legacyEncode(null!=(e=this.projectId)?e:"",t):""},a.keyFromSerialized=function(t){return this.urlSaveKey.legacyDecode(t)},a.readKey=function(t){o.assertIsObject(t);var e=t[r.Datastore.KEY];return t._keyStr&&!e&&(e=this.keyFromSerialized(t._keyStr)),o.assertIsObject(e,"entity[Datastore.KEY]/entity._keyStr","Entity is missing the datastore Key: "+JSON.stringify(t)),e},a.fixKeys=function(t){var e=this;return t.forEach((function(t){null!=t&&t[r.Datastore.KEY]&&t[r.Datastore.KEY]&&(o.assertIsDefined(t[r.Datastore.KEY]),o.assertIsObject(t[r.Datastore.KEY]),t._keyStr=e.keySerialize(t[r.Datastore.KEY]))})),t},a.get=function(){var t=c(s().mark((function t(e){var r;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsObject(e),o.assert(!Array.isArray(e)),o.assert(e.path.length%2==0,"key.path must be complete: "+JSON.stringify(e.path)),t.next=5,this.getMulti([e]);case 5:return t.abrupt("return",(null==(r=t.sent)?void 0:r[0])||null);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),a.getMulti=function(){var t=c(s().mark((function t(n){var a,i,u,c;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=b.startTimer(),t.prev=1,t.t0=this,!(n.length>0)){t.next=15;break}return t.next=6,this.getDoT().get(n);case 6:if(t.t2=u=t.sent,null!=t.t2){t.next=11;break}t.t3=void 0,t.next=12;break;case 11:t.t3=u[0];case 12:t.t1=t.t3,t.next=16;break;case 15:t.t1=[];case 16:t.t4=t.t1,a=t.t0.fixKeys.call(t.t0,t.t4),t.next=26;break;case 20:return t.prev=20,t.t5=t.catch(1),w.inc({operation:"get"}),t.next=25,e.setImmediate();case 25:throw new O("datastore.getMulti error",t.t5,{keys:n});case 26:return t.prev=26,i({operation:"get"}),t.finish(26);case 29:return o.assertIsArray(a),c={},a.forEach((function(t){c[JSON.stringify(t[r.Datastore.KEY])]=t})),t.abrupt("return",n.map((function(t){return c[JSON.stringify(t)]||null})));case 34:case"end":return t.stop()}}),t,this,[[1,20,26,29]])})));return function(e){return t.apply(this,arguments)}}(),a.set=function(){var t=c(s().mark((function t(e,r){var n;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsObject(e),o.assertIsObject(r),n={key:e,data:r},t.next=5,this.save([n]);case 5:return t.abrupt("return",n.key);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),a.save=function(){var t=c(s().mark((function t(n){var a,i,u,c,l,p,h,d;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(o.assertIsArray(n),i=b.startTimer(),t.prev=2,u=y(n);!(c=u()).done;)o.assertIsObject((l=c.value).key),o.assertIsObject(l.data),this.fixKeys([l.data]),l.excludeLargeProperties=void 0===l.excludeLargeProperties||l.excludeLargeProperties,l.data=f({},l.data,{_keyStr:void 0});return t.next=6,this.getDoT().save(n);case 6:if(t.t0=t.sent,t.t0){t.next=9;break}t.t0=void 0;case 9:for(a=t.t0,p=y(n);!(h=p()).done;)(d=h.value).data[r.Datastore.KEY]=d.key,this.fixKeys([d.data]);t.next=19;break;case 13:return t.prev=13,t.t1=t.catch(2),w.inc({operation:"save"}),t.next=18,e.setImmediate();case 18:throw new O("datastore.save error",t.t1);case 19:return t.prev=19,i({operation:"save"}),t.finish(19);case 22:return t.abrupt("return",a);case 23:case"end":return t.stop()}}),t,this,[[2,13,19,22]])})));return function(e){return t.apply(this,arguments)}}(),a.insert=function(){var t=c(s().mark((function t(r){var n,a;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsArray(r),a=b.startTimer(),t.prev=2,t.next=5,this.getDoT().insert(r);case 5:if(t.t0=t.sent,t.t0){t.next=8;break}t.t0=void 0;case 8:n=t.t0,t.next=17;break;case 11:return t.prev=11,t.t1=t.catch(2),w.inc({operation:"insert"}),t.next=16,e.setImmediate();case 16:throw new O("datastore.insert error",t.t1);case 17:return t.prev=17,a({operation:"insert"}),t.finish(17);case 20:return t.abrupt("return",n);case 21:case"end":return t.stop()}}),t,this,[[2,11,17,20]])})));return function(e){return t.apply(this,arguments)}}(),a.update=function(){var t=c(s().mark((function t(r){var n,a;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsArray(r),r.forEach((function(t){return o.assertIsObject(t.key)})),r.forEach((function(t){return o.assert(t.key.path.length%2==0,"entity.key.path must be complete: "+JSON.stringify([t.key.path,t]))})),a=b.startTimer(),t.prev=4,t.next=7,this.getDoT().update(r);case 7:if(t.t0=t.sent,t.t0){t.next=10;break}t.t0=void 0;case 10:n=t.t0,t.next=19;break;case 13:return t.prev=13,t.t1=t.catch(4),w.inc({operation:"update"}),t.next=18,e.setImmediate();case 18:throw new O("datastore.update error",t.t1);case 19:return t.prev=19,a({operation:"update"}),t.finish(19);case 22:return t.abrupt("return",n);case 23:case"end":return t.stop()}}),t,this,[[4,13,19,22]])})));return function(e){return t.apply(this,arguments)}}(),a.delete=function(){var t=c(s().mark((function t(r){var n,a;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsArray(r),r.forEach((function(t){return o.assertIsObject(t)})),r.forEach((function(t){return o.assert(t.path.length%2==0,"key.path must be complete: "+JSON.stringify(t.path))})),a=b.startTimer(),t.prev=4,t.next=7,this.getDoT().delete(r);case 7:if(t.t0=t.sent,t.t0){t.next=10;break}t.t0=void 0;case 10:n=t.t0,t.next=19;break;case 13:return t.prev=13,t.t1=t.catch(4),w.inc({operation:"delete"}),t.next=18,e.setImmediate();case 18:throw new O("datastore.delete error",t.t1);case 19:return t.prev=19,a({operation:"delete"}),t.finish(19);case 22:return t.abrupt("return",n);case 23:case"end":return t.stop()}}),t,this,[[4,13,19,22]])})));return function(e){return t.apply(this,arguments)}}(),a.createQuery=function(t){try{return this.getDoT().createQuery(t)}catch(t){throw new O("datastore.createQuery error",t)}},a.runQuery=function(){var t=c(s().mark((function t(r){var n,o,a,i;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=b.startTimer(),t.prev=1,t.next=4,this.getDoT().runQuery(r);case 4:i=(a=t.sent)[1],n=[this.fixKeys(a[0]),i],t.next=15;break;case 10:return t.prev=10,t.t0=t.catch(1),t.next=14,e.setImmediate();case 14:throw new O("datastore.runQuery error",t.t0);case 15:return t.prev=15,o({operation:"query"}),t.finish(15);case 18:return t.abrupt("return",n);case 19:case"end":return t.stop()}}),t,this,[[1,10,15,18]])})));return function(e){return t.apply(this,arguments)}}(),a.query=function(){var t=c(s().mark((function t(n,a,i,u,c,f){var l,p,d,v,g,m;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(void 0===a&&(a=[]),void 0===i&&(i=2500),void 0===u&&(u=[]),void 0===c&&(c=[]),o.assertIsString(n),o.assertIsArray(a),o.assertIsNumber(i),t.prev=7,l=this.createQuery(n),p=y(a);!(d=p()).done;)o.assertIsObject(v=d.value),l.filter(h(r.PropertyFilter,v));for(g=y(u);!(m=g()).done;)l.order(m.value);return i>0&&l.limit(i),c.length>0&&l.select(c),t.next=15,this.runQuery(l);case 15:return t.abrupt("return",t.sent);case 18:return t.prev=18,t.t0=t.catch(7),t.next=22,e.setImmediate();case 22:throw new O("datastore.query error",t.t0,{kindName:n,filters:a,limit:i,ordering:u});case 23:case"end":return t.stop()}}),t,this,[[7,18]])})));return function(e,r,n,o,a,i){return t.apply(this,arguments)}}(),a.allocateOneId=function(){var t=c(s().mark((function t(e){var r;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e="Numbering"),o.assertIsString(e),t.next=4,this.datastore.allocateIds(this.key([e]),1);case 4:return o.assertIsString(r=t.sent[0][0].id),t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),a.runInTransaction=function(){var t=c(s().mark((function t(r){var n,o;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=this.datastore.transaction(),t.next=3,m.run(o,c(s().mark((function t(){var a,i,u,c;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.run();case 2:return i=(a=t.sent)[0],u=a[1],t.prev=5,t.next=8,r();case 8:n=t.sent,t.next=20;break;case 11:return t.prev=11,t.t0=t.catch(5),t.next=15,o.rollback();case 15:return g("Transaction failed, rollback initiated: %O %O %O %O",i,u,t.sent,t.t0),t.next=19,e.setImmediate();case 19:throw new O("datastore.transaction execution error",t.t0);case 20:return t.prev=20,t.next=23,o.commit();case 23:c=t.sent[0],t.next=32;break;case 26:return t.prev=26,t.t1=t.catch(20),g("Transaction commit failed: %O %O %O %O ret: %O",i,u,c,t.t1,n),t.next=31,e.setImmediate();case 31:throw new O("datastore.transaction execution error",t.t1);case 32:case"end":return t.stop()}}),t,null,[[5,11],[20,26]])}))));case 3:return t.abrupt("return",n);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}(),O=function(t){var e,r;function n(e,r,n){var o,a,i,s,u,c,l,p;return(p=t.call(this,e+": "+(null==r?void 0:r.message))||this).extensions=void 0,p.originalError=void 0,p.name||Object.defineProperty(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(p),"name",{value:"DstoreError"}),p.originalError=r,p.extensions=f({},n),p.stack=((null==(o=p.stack)?void 0:o.split("\n")[0])||"")+"\n"+((null==r||null==(a=r.stack)||null==(i=a.split("\n"))||null==(s=i.slice(1))?void 0:s.join("\n"))||"")+"\n"+((null==(u=p.stack)||null==(c=u.split("\n"))||null==(l=c.slice(1))?void 0:l.join("\n"))||""),p}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,p(e,r),n}(d(Error));Object.defineProperty(exports,"Datastore",{enumerable:!0,get:function(){return r.Datastore}}),Object.defineProperty(exports,"Key",{enumerable:!0,get:function(){return r.Key}}),Object.defineProperty(exports,"Query",{enumerable:!0,get:function(){return r.Query}}),Object.defineProperty(exports,"Transaction",{enumerable:!0,get:function(){return r.Transaction}}),exports.Dstore=k,exports.DstoreError=O,exports.KEYSYM=x;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("async_hooks"),e=require("timers/promises"),r=require("@google-cloud/datastore"),n=require("@google-cloud/datastore/build/src/entity"),o=require("assertate-debug"),a=require("debug"),i=require("prom-client");function s(){s=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function f(t,e,r,o){var a=Object.create((e&&e.prototype instanceof h?e:h).prototype),i=new I(o||[]);return n(a,"_invoke",{value:k(t,r,i)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var p={};function h(){}function d(){}function v(){}var y={};c(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(S([])));m&&m!==e&&r.call(m,a)&&(y=m);var b=v.prototype=h.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function x(t,e){function o(n,a,i,s){var u=l(t[n],t,a);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,i,s)}),(function(t){o("throw",t,i,s)})):e.resolve(f).then((function(t){c.value=t,i(c)}),(function(t){return o("throw",t,i,s)}))}s(u.arg)}var a;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function k(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var s=O(i,r);if(s){if(s===p)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;var a=o.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function S(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:_}}function _(){return{value:void 0,done:!0}}return d.prototype=v,n(b,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:d,configurable:!0}),d.displayName=c(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,c(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},t.awrap=function(t){return{__await:t}},w(x.prototype),c(x.prototype,i,(function(){return this})),t.AsyncIterator=x,t.async=function(e,r,n,o,a){void 0===a&&(a=Promise);var i=new x(f(e,r,n,o),a);return t.isGeneratorFunction(r)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},w(b),c(b,u,"Generator"),c(b,a,(function(){return this})),c(b,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=S,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return i.type="throw",i.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=r.call(a,"catchLoc"),u=r.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,p):this.complete(i)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function u(t,e,r,n,o,a,i){try{var s=t[a](i),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function c(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){u(a,n,o,i,s,"next",t)}function s(t){u(a,n,o,i,s,"throw",t)}i(void 0)}))}}function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f.apply(this,arguments)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function h(t,e,r){return h=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&p(o,r.prototype),o},h.apply(null,arguments)}function d(t){var e="function"==typeof Map?new Map:void 0;return d=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return h(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,t)},d(t)}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function y(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return v(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var g=a("ds:api"),m=new t.AsyncLocalStorage;i.register.removeSingleMetric("dstore_requests_seconds"),i.register.removeSingleMetric("dstore_failures_total");var b=new i.Histogram({name:"dstore_requests_seconds",help:"How long did Datastore operations take?",labelNames:["operation"]}),w=new i.Counter({name:"dstore_failures_total",help:"How many Datastore operations failed?",labelNames:["operation"]}),x=r.Datastore.KEY,k=function(){function t(t,e,r){this.datastore=void 0,this.projectId=void 0,this.logger=void 0,this.engine="Dstore",this.engines=[],this.urlSaveKey=new n.entity.URLSafeKey,this.datastore=t,this.projectId=e,this.logger=r,o.assertIsObject(t),this.engines.push(this.engine)}var a=t.prototype;return a.getDoT=function(){return m.getStore()||this.datastore},a.key=function(t){return this.datastore.key(t)},a.keySerialize=function(t){var e;return t?this.urlSaveKey.legacyEncode(null!=(e=this.projectId)?e:"",t):""},a.keyFromSerialized=function(t){return this.urlSaveKey.legacyDecode(t)},a.readKey=function(t){o.assertIsObject(t);var e=t[r.Datastore.KEY];return t._keyStr&&!e&&(e=this.keyFromSerialized(t._keyStr)),o.assertIsObject(e,"entity[Datastore.KEY]/entity._keyStr","Entity is missing the datastore Key: "+JSON.stringify(t)),e},a.fixKeys=function(t){var e=this;return t.forEach((function(t){null!=t&&t[r.Datastore.KEY]&&t[r.Datastore.KEY]&&(o.assertIsDefined(t[r.Datastore.KEY]),o.assertIsObject(t[r.Datastore.KEY]),t._keyStr=e.keySerialize(t[r.Datastore.KEY]))})),t},a.get=function(){var t=c(s().mark((function t(e){var r;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsObject(e),o.assert(!Array.isArray(e)),o.assert(e.path.length%2==0,"key.path must be complete: "+JSON.stringify(e.path)),t.next=5,this.getMulti([e]);case 5:return t.abrupt("return",(null==(r=t.sent)?void 0:r[0])||null);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),a.getMulti=function(){var t=c(s().mark((function t(n){var a,i,u,c;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=b.startTimer(),t.prev=1,t.t0=this,!(n.length>0)){t.next=15;break}return t.next=6,this.getDoT().get(n);case 6:if(t.t2=u=t.sent,null!=t.t2){t.next=11;break}t.t3=void 0,t.next=12;break;case 11:t.t3=u[0];case 12:t.t1=t.t3,t.next=16;break;case 15:t.t1=[];case 16:t.t4=t.t1,a=t.t0.fixKeys.call(t.t0,t.t4),t.next=26;break;case 20:return t.prev=20,t.t5=t.catch(1),w.inc({operation:"get"}),t.next=25,e.setImmediate();case 25:throw new O("datastore.getMulti error",t.t5,{keys:n});case 26:return t.prev=26,i({operation:"get"}),t.finish(26);case 29:return o.assertIsArray(a),c={},a.forEach((function(t){c[JSON.stringify(t[r.Datastore.KEY])]=t})),t.abrupt("return",n.map((function(t){return c[JSON.stringify(t)]||null})));case 34:case"end":return t.stop()}}),t,this,[[1,20,26,29]])})));return function(e){return t.apply(this,arguments)}}(),a.set=function(){var t=c(s().mark((function t(e,r){var n;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsObject(e),o.assertIsObject(r),n={key:e,data:r},t.next=5,this.save([n]);case 5:return t.abrupt("return",n.key);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),a.save=function(){var t=c(s().mark((function t(n){var a,i,u,c,l,p,h,d;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(o.assertIsArray(n),i=b.startTimer(),t.prev=2,u=y(n);!(c=u()).done;)o.assertIsObject((l=c.value).key),o.assertIsObject(l.data),this.fixKeys([l.data]),l.excludeLargeProperties=void 0===l.excludeLargeProperties||l.excludeLargeProperties,l.data=f({},l.data,{_keyStr:void 0});return t.next=6,this.getDoT().save(n);case 6:if(t.t0=t.sent,t.t0){t.next=9;break}t.t0=void 0;case 9:for(a=t.t0,p=y(n);!(h=p()).done;)(d=h.value).data[r.Datastore.KEY]=d.key,this.fixKeys([d.data]);t.next=19;break;case 13:return t.prev=13,t.t1=t.catch(2),w.inc({operation:"save"}),t.next=18,e.setImmediate();case 18:throw new O("datastore.save error",t.t1);case 19:return t.prev=19,i({operation:"save"}),t.finish(19);case 22:return t.abrupt("return",a);case 23:case"end":return t.stop()}}),t,this,[[2,13,19,22]])})));return function(e){return t.apply(this,arguments)}}(),a.insert=function(){var t=c(s().mark((function t(r){var n,a;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsArray(r),a=b.startTimer(),t.prev=2,t.next=5,this.getDoT().insert(r);case 5:if(t.t0=t.sent,t.t0){t.next=8;break}t.t0=void 0;case 8:n=t.t0,t.next=17;break;case 11:return t.prev=11,t.t1=t.catch(2),w.inc({operation:"insert"}),t.next=16,e.setImmediate();case 16:throw new O("datastore.insert error",t.t1);case 17:return t.prev=17,a({operation:"insert"}),t.finish(17);case 20:return t.abrupt("return",n);case 21:case"end":return t.stop()}}),t,this,[[2,11,17,20]])})));return function(e){return t.apply(this,arguments)}}(),a.update=function(){var t=c(s().mark((function t(r){var n,a;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsArray(r),r.forEach((function(t){return o.assertIsObject(t.key)})),r.forEach((function(t){return o.assert(t.key.path.length%2==0,"entity.key.path must be complete: "+JSON.stringify([t.key.path,t]))})),a=b.startTimer(),t.prev=4,t.next=7,this.getDoT().update(r);case 7:if(t.t0=t.sent,t.t0){t.next=10;break}t.t0=void 0;case 10:n=t.t0,t.next=19;break;case 13:return t.prev=13,t.t1=t.catch(4),w.inc({operation:"update"}),t.next=18,e.setImmediate();case 18:throw new O("datastore.update error",t.t1);case 19:return t.prev=19,a({operation:"update"}),t.finish(19);case 22:return t.abrupt("return",n);case 23:case"end":return t.stop()}}),t,this,[[4,13,19,22]])})));return function(e){return t.apply(this,arguments)}}(),a.delete=function(){var t=c(s().mark((function t(r){var n,a;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o.assertIsArray(r),r.forEach((function(t){return o.assertIsObject(t)})),r.forEach((function(t){return o.assert(t.path.length%2==0,"key.path must be complete: "+JSON.stringify(t.path))})),a=b.startTimer(),t.prev=4,t.next=7,this.getDoT().delete(r);case 7:if(t.t0=t.sent,t.t0){t.next=10;break}t.t0=void 0;case 10:n=t.t0,t.next=19;break;case 13:return t.prev=13,t.t1=t.catch(4),w.inc({operation:"delete"}),t.next=18,e.setImmediate();case 18:throw new O("datastore.delete error",t.t1);case 19:return t.prev=19,a({operation:"delete"}),t.finish(19);case 22:return t.abrupt("return",n);case 23:case"end":return t.stop()}}),t,this,[[4,13,19,22]])})));return function(e){return t.apply(this,arguments)}}(),a.createQuery=function(t){try{return this.getDoT().createQuery(t)}catch(t){throw new O("datastore.createQuery error",t)}},a.runQuery=function(){var t=c(s().mark((function t(r){var n,o,a,i;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=b.startTimer(),t.prev=1,t.next=4,this.getDoT().runQuery(r);case 4:i=(a=t.sent)[1],n=[this.fixKeys(a[0]),i],t.next=15;break;case 10:return t.prev=10,t.t0=t.catch(1),t.next=14,e.setImmediate();case 14:throw new O("datastore.runQuery error",t.t0);case 15:return t.prev=15,o({operation:"query"}),t.finish(15);case 18:return t.abrupt("return",n);case 19:case"end":return t.stop()}}),t,this,[[1,10,15,18]])})));return function(e){return t.apply(this,arguments)}}(),a.query=function(){var t=c(s().mark((function t(n,a,i,u,c,f){var l,p,d,v,g,m;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(void 0===a&&(a=[]),void 0===i&&(i=2500),void 0===u&&(u=[]),void 0===c&&(c=[]),o.assertIsString(n),o.assertIsArray(a),o.assertIsNumber(i),t.prev=7,l=this.createQuery(n),p=y(a);!(d=p()).done;)o.assertIsObject(v=d.value),l.filter(h(r.PropertyFilter,v));for(g=y(u);!(m=g()).done;)l.order(m.value);return i>0&&l.limit(i),c.length>0&&l.select(c),t.next=15,this.runQuery(l);case 15:return t.abrupt("return",t.sent);case 18:return t.prev=18,t.t0=t.catch(7),t.next=22,e.setImmediate();case 22:throw new O("datastore.query error",t.t0,{kindName:n,filters:a,limit:i,ordering:u});case 23:case"end":return t.stop()}}),t,this,[[7,18]])})));return function(e,r,n,o,a,i){return t.apply(this,arguments)}}(),a.allocateOneId=function(){var t=c(s().mark((function t(e){var r;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return void 0===e&&(e="Numbering"),o.assertIsString(e),t.next=4,this.datastore.allocateIds(this.key([e]),1);case 4:return o.assertIsString(r=t.sent[0][0].id),t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),a.runInTransaction=function(){var t=c(s().mark((function t(r){var n,o;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=this.datastore.transaction(),t.next=3,m.run(o,c(s().mark((function t(){var a,i,u,c;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,o.run();case 2:return i=(a=t.sent)[0],u=a[1],t.prev=5,t.next=8,r();case 8:n=t.sent,t.next=20;break;case 11:return t.prev=11,t.t0=t.catch(5),t.next=15,o.rollback();case 15:return g("Transaction failed, rollback initiated: %O %O %O %O",i,u,t.sent,t.t0),t.next=19,e.setImmediate();case 19:throw new O("datastore.transaction execution error",t.t0);case 20:return t.prev=20,t.next=23,o.commit();case 23:c=t.sent[0],t.next=32;break;case 26:return t.prev=26,t.t1=t.catch(20),g("Transaction commit failed: %O %O %O %O ret: %O",i,u,c,t.t1,n),t.next=31,e.setImmediate();case 31:throw new O("datastore.transaction execution error",t.t1);case 32:case"end":return t.stop()}}),t,null,[[5,11],[20,26]])}))));case 3:return t.abrupt("return",n);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}(),O=function(t){var e,r;function n(e,r,n){var o,a,i,s,u,c,l,p;return(p=t.call(this,e+": "+(null==r?void 0:r.message))||this).extensions=void 0,p.originalError=void 0,p.name||Object.defineProperty(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(p),"name",{value:"DstoreError"}),p.originalError=r,p.extensions=f({},n),p.stack=((null==(o=p.stack)?void 0:o.split("\n")[0])||"")+"\n"+((null==r||null==(a=r.stack)||null==(i=a.split("\n"))||null==(s=i.slice(1))?void 0:s.join("\n"))||"")+"\n"+((null==(u=p.stack)||null==(c=u.split("\n"))||null==(l=c.slice(1))?void 0:l.join("\n"))||""),p}return r=t,(e=n).prototype=Object.create(r.prototype),e.prototype.constructor=e,p(e,r),n}(d(Error));Object.defineProperty(exports,"Datastore",{enumerable:!0,get:function(){return r.Datastore}}),Object.defineProperty(exports,"Key",{enumerable:!0,get:function(){return r.Key}}),Object.defineProperty(exports,"Query",{enumerable:!0,get:function(){return r.Query}}),Object.defineProperty(exports,"Transaction",{enumerable:!0,get:function(){return r.Transaction}}),exports.Dstore=k,exports.DstoreError=O,exports.KEYSYM=x;
|
|
2
2
|
//# sourceMappingURL=datastore-api.cjs.production.min.js.map
|