@google-cloud/firestore
Advanced tools
Comparing version 6.5.0 to 6.6.0
@@ -85,3 +85,3 @@ /*! | ||
* conjunction of the given {@link Filter}s. A conjunction filter includes | ||
* a document if it satisfies any of the given {@link Filter}s. | ||
* a document if it satisfies all of the given {@link Filter}s. | ||
* | ||
@@ -88,0 +88,0 @@ * The returned Filter can be applied to [Query.where()]{@link Query#where}, |
@@ -91,3 +91,3 @@ "use strict"; | ||
* conjunction of the given {@link Filter}s. A conjunction filter includes | ||
* a document if it satisfies any of the given {@link Filter}s. | ||
* a document if it satisfies all of the given {@link Filter}s. | ||
* | ||
@@ -94,0 +94,0 @@ * The returned Filter can be applied to [Query.where()]{@link Query#where}, |
@@ -401,3 +401,8 @@ /*! | ||
* `DocumentReference<T>.onSnapshot()`, `CollectionReference<T>.onSnapshot()`, or | ||
* `Query<T>.onSnapshot()`. | ||
* `Query<T>.onSnapshot()`. If specified, this setting value will take precedent over the | ||
* environment variable `FIRESTORE_PREFER_REST`. If not specified, the | ||
* SDK will use the value specified in the environment variable `FIRESTORE_PREFER_REST`. | ||
* Valid values of `FIRESTORE_PREFER_REST` are `true` ('1') or `false` (`0`). Values are | ||
* not case-sensitive. Any other value for the environment variable will be ignored and | ||
* a warning will be logged to the console. | ||
*/ | ||
@@ -404,0 +409,0 @@ constructor(settings?: firestore.Settings); |
@@ -380,3 +380,8 @@ "use strict"; | ||
* `DocumentReference<T>.onSnapshot()`, `CollectionReference<T>.onSnapshot()`, or | ||
* `Query<T>.onSnapshot()`. | ||
* `Query<T>.onSnapshot()`. If specified, this setting value will take precedent over the | ||
* environment variable `FIRESTORE_PREFER_REST`. If not specified, the | ||
* SDK will use the value specified in the environment variable `FIRESTORE_PREFER_REST`. | ||
* Valid values of `FIRESTORE_PREFER_REST` are `true` ('1') or `false` (`0`). Values are | ||
* not case-sensitive. Any other value for the environment variable will be ignored and | ||
* a warning will be logged to the console. | ||
*/ | ||
@@ -552,2 +557,11 @@ constructor(settings) { | ||
let url = null; | ||
// If preferRest is not specified in settings, but is set as environment variable, | ||
// then use the environment variable value. | ||
const preferRestEnvValue = (0, util_1.tryGetPreferRestEnvironmentVariable)(); | ||
if (settings.preferRest === undefined && preferRestEnvValue !== undefined) { | ||
settings = { | ||
...settings, | ||
preferRest: preferRestEnvValue, | ||
}; | ||
} | ||
// If the environment variable is set, it should always take precedence | ||
@@ -554,0 +568,0 @@ // over any user passed in settings. |
@@ -123,1 +123,14 @@ /*! | ||
export declare function wrapError(err: Error, stack: string): Error; | ||
/** | ||
* Parses the value of the environment variable FIRESTORE_PREFER_REST, and | ||
* returns a value indicating if the environment variable enables or disables | ||
* preferRest. | ||
* | ||
* This function will warn to the console if the environment variable is set | ||
* to an unsupported value. | ||
* | ||
* @return `true` if the environment variable enables `preferRest`, | ||
* `false` if the environment variable disables `preferRest`, or `undefined` | ||
* if the environment variable is not set or is set to an unsupported value. | ||
*/ | ||
export declare function tryGetPreferRestEnvironmentVariable(): boolean | undefined; |
@@ -18,3 +18,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.wrapError = exports.silencePromise = exports.getRetryParams = exports.getRetryCodes = exports.isPermanentRpcError = exports.isFunction = exports.isEmpty = exports.isPlainObject = exports.isObject = exports.requestTag = exports.autoId = exports.Deferred = void 0; | ||
exports.tryGetPreferRestEnvironmentVariable = exports.wrapError = exports.silencePromise = exports.getRetryParams = exports.getRetryCodes = exports.isPermanentRpcError = exports.isFunction = exports.isEmpty = exports.isPlainObject = exports.isObject = exports.requestTag = exports.autoId = exports.Deferred = void 0; | ||
const crypto_1 = require("crypto"); | ||
@@ -196,2 +196,33 @@ const gapicConfig = require("./v1/firestore_client_config.json"); | ||
exports.wrapError = wrapError; | ||
/** | ||
* Parses the value of the environment variable FIRESTORE_PREFER_REST, and | ||
* returns a value indicating if the environment variable enables or disables | ||
* preferRest. | ||
* | ||
* This function will warn to the console if the environment variable is set | ||
* to an unsupported value. | ||
* | ||
* @return `true` if the environment variable enables `preferRest`, | ||
* `false` if the environment variable disables `preferRest`, or `undefined` | ||
* if the environment variable is not set or is set to an unsupported value. | ||
*/ | ||
function tryGetPreferRestEnvironmentVariable() { | ||
var _a; | ||
const rawValue = (_a = process.env.FIRESTORE_PREFER_REST) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase(); | ||
if (rawValue === undefined) { | ||
return undefined; | ||
} | ||
else if (rawValue === '1' || rawValue === 'true') { | ||
return true; | ||
} | ||
else if (rawValue === '0' || rawValue === 'false') { | ||
return false; | ||
} | ||
else { | ||
// eslint-disable-next-line no-console | ||
console.warn(`An unsupported value was specified for the environment variable FIRESTORE_PREFER_REST. Value ${rawValue} is unsupported.`); | ||
return undefined; | ||
} | ||
} | ||
exports.tryGetPreferRestEnvironmentVariable = tryGetPreferRestEnvironmentVariable; | ||
//# sourceMappingURL=util.js.map |
@@ -621,3 +621,3 @@ "use strict"; | ||
* Streams batches of document updates and deletes, in order. This method is | ||
* only available via the gRPC API (not REST). | ||
* only available via gRPC or WebChannel (not REST). | ||
* | ||
@@ -641,4 +641,4 @@ * @param {object} [options] | ||
/** | ||
* Listens to changes. This method is only available via the gRPC API (not | ||
* REST). | ||
* Listens to changes. This method is only available via gRPC or WebChannel | ||
* (not REST). | ||
* | ||
@@ -645,0 +645,0 @@ * @param {object} [options] |
[ | ||
"../../protos/google/firestore/v1/aggregation_result.proto", | ||
"../../protos/google/firestore/v1/bloom_filter.proto", | ||
"../../protos/google/firestore/v1/common.proto", | ||
@@ -4,0 +5,0 @@ "../../protos/google/firestore/v1/document.proto", |
{ | ||
"name": "@google-cloud/firestore", | ||
"description": "Firestore Client Library for Node.js", | ||
"version": "6.5.0", | ||
"version": "6.6.0", | ||
"license": "Apache-2.0", | ||
@@ -33,5 +33,5 @@ "author": "Google Inc.", | ||
"docs": "jsdoc -c .jsdoc.js", | ||
"system-test:rest": "USE_REST_FALLBACK=YES mocha build/system-test --timeout 600000", | ||
"system-test:rest": "FIRESTORE_PREFER_REST=true mocha build/system-test --timeout 600000", | ||
"system-test:grpc": "mocha build/system-test --timeout 600000", | ||
"system-test:emulator:rest": "FIRESTORE_EMULATOR_HOST=localhost:8080 USE_REST_FALLBACK=YES mocha build/system-test --timeout 600000", | ||
"system-test:emulator:rest": "FIRESTORE_EMULATOR_HOST=localhost:8080 FIRESTORE_PREFER_REST=true mocha build/system-test --timeout 600000", | ||
"system-test:emulator:grpc": "FIRESTORE_EMULATOR_HOST=localhost:8080 mocha build/system-test --timeout 600000", | ||
@@ -38,0 +38,0 @@ "system-test": "npm run system-test:grpc && npm run system-test:rest", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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 not supported yet
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 not supported yet
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 not supported yet
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 not supported yet
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 not supported yet
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 not supported yet
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 not supported yet
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 not supported yet
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
Sorry, the diff of this file is too big to display
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
133
4309840
67048
4
5