@google-cloud/firestore
Advanced tools
Comparing version 4.9.1 to 4.9.2
@@ -16,2 +16,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const firestore_v1_proto_api_1 = require("../protos/firestore_v1_proto_api"); | ||
const document_1 = require("./document"); | ||
@@ -21,2 +22,3 @@ const reference_1 = require("./reference"); | ||
const validate_1 = require("./validate"); | ||
var BundleElement = firestore_v1_proto_api_1.firestore.BundleElement; | ||
const BUNDLE_VERSION = 1; | ||
@@ -118,3 +120,7 @@ /** | ||
elementToLengthPrefixedBuffer(bundleElement) { | ||
const buffer = Buffer.from(JSON.stringify(bundleElement), 'utf-8'); | ||
// Convert to a valid proto message object then take its JSON representation. | ||
// This take cares of stuff like converting internal byte array fields | ||
// to Base64 encodings. | ||
const message = BundleElement.fromObject(bundleElement).toJSON(); | ||
const buffer = Buffer.from(JSON.stringify(message), 'utf-8'); | ||
const lengthBuffer = Buffer.from(buffer.length.toString()); | ||
@@ -121,0 +127,0 @@ return Buffer.concat([lengthBuffer, buffer]); |
@@ -393,6 +393,7 @@ "use strict"; | ||
toDocumentProto() { | ||
var _a, _b; | ||
return { | ||
name: this._ref.formattedName, | ||
createTime: this.createTime, | ||
updateTime: this.updateTime, | ||
createTime: (_a = this.createTime) === null || _a === void 0 ? void 0 : _a.toProto().timestampValue, | ||
updateTime: (_b = this.updateTime) === null || _b === void 0 ? void 0 : _b.toProto().timestampValue, | ||
fields: this._fieldsProto, | ||
@@ -399,0 +400,0 @@ }; |
@@ -471,2 +471,14 @@ /*! | ||
/** | ||
* Function executed by {@link Firestore#runTransaction} within the transaction | ||
* context. | ||
* | ||
* @callback Firestore~updateFunction | ||
* @template T | ||
* @param {Transaction} transaction The transaction object for this | ||
* transaction. | ||
* @returns {Promise<T>} The promise returned at the end of the transaction. | ||
* This promise will be returned by {@link Firestore#runTransaction} if the | ||
* transaction completed successfully. | ||
*/ | ||
/** | ||
* Executes the given updateFunction and commits the changes applied within | ||
@@ -479,8 +491,9 @@ * the transaction. | ||
* | ||
* @param {function(Transaction)} updateFunction The function to execute | ||
* within the transaction context. | ||
* @template T | ||
* @param {Firestore~updateFunction} updateFunction The user function to | ||
* execute within the transaction context. | ||
* @param {object=} transactionOptions Transaction options. | ||
* @param {number=} transactionOptions.maxAttempts - The maximum number of | ||
* attempts for this transaction. | ||
* @returns {Promise} If the transaction completed successfully or was | ||
* @returns {Promise<T>} If the transaction completed successfully or was | ||
* explicitly aborted (by the updateFunction returning a failed Promise), the | ||
@@ -487,0 +500,0 @@ * Promise returned by the updateFunction will be returned here. Else if the |
@@ -684,2 +684,14 @@ "use strict"; | ||
/** | ||
* Function executed by {@link Firestore#runTransaction} within the transaction | ||
* context. | ||
* | ||
* @callback Firestore~updateFunction | ||
* @template T | ||
* @param {Transaction} transaction The transaction object for this | ||
* transaction. | ||
* @returns {Promise<T>} The promise returned at the end of the transaction. | ||
* This promise will be returned by {@link Firestore#runTransaction} if the | ||
* transaction completed successfully. | ||
*/ | ||
/** | ||
* Executes the given updateFunction and commits the changes applied within | ||
@@ -692,8 +704,9 @@ * the transaction. | ||
* | ||
* @param {function(Transaction)} updateFunction The function to execute | ||
* within the transaction context. | ||
* @template T | ||
* @param {Firestore~updateFunction} updateFunction The user function to | ||
* execute within the transaction context. | ||
* @param {object=} transactionOptions Transaction options. | ||
* @param {number=} transactionOptions.maxAttempts - The maximum number of | ||
* attempts for this transaction. | ||
* @returns {Promise} If the transaction completed successfully or was | ||
* @returns {Promise<T>} If the transaction completed successfully or was | ||
* explicitly aborted (by the updateFunction returning a failed Promise), the | ||
@@ -700,0 +713,0 @@ * Promise returned by the updateFunction will be returned here. Else if the |
@@ -235,3 +235,3 @@ "use strict"; | ||
if (this.seconds) { | ||
timestamp.seconds = this.seconds; | ||
timestamp.seconds = this.seconds.toString(); | ||
} | ||
@@ -238,0 +238,0 @@ if (this.nanoseconds) { |
@@ -7,2 +7,9 @@ # Changelog | ||
### [4.9.2](https://www.github.com/googleapis/nodejs-firestore/compare/v4.9.1...v4.9.2) (2021-02-05) | ||
### Bug Fixes | ||
* support byte values in Bundles ([#1395](https://www.github.com/googleapis/nodejs-firestore/issues/1395)) ([8cf53a9](https://www.github.com/googleapis/nodejs-firestore/commit/8cf53a92dc13324562ca1a1e841312e43f5c383e)) | ||
### [4.9.1](https://www.github.com/googleapis/nodejs-firestore/compare/v4.9.0...v4.9.1) (2021-01-26) | ||
@@ -9,0 +16,0 @@ |
{ | ||
"name": "@google-cloud/firestore", | ||
"description": "Firestore Client Library for Node.js", | ||
"version": "4.9.1", | ||
"version": "4.9.2", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "author": "Google Inc.", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4512518
84006