/
var
/
www
/
greso.tech
/
server
/
nsm
/
node_modules
/
@google-cloud
/
firestore
/
build
/
src
/
/var/www/greso.tech/server/nsm/node_modules/@google-cloud/firestore/build/src
mkdir
upload
Name
Size
Mode
Actions
v1/
-
0755
rm
v1beta1/
-
0755
rm
backoff.d.ts
5547
0644
edit
dl
rm
backoff.js
7650
0644
edit
dl
rm
bulk-writer.d.ts
19230
0644
edit
dl
rm
bulk-writer.js
36112
0644
edit
dl
rm
bundle.d.ts
835
0644
edit
dl
rm
bundle.js
8427
0644
edit
dl
rm
collection-group.d.ts
3602
0644
edit
dl
rm
collection-group.js
4553
0644
edit
dl
rm
convert.d.ts
2776
0644
edit
dl
rm
convert.js
7168
0644
edit
dl
rm
document-change.d.ts
5033
0644
edit
dl
rm
document-change.js
5284
0644
edit
dl
rm
document-reader.d.ts
1842
0644
edit
dl
rm
document-reader.js
5394
0644
edit
dl
rm
document.d.ts
18149
0644
edit
dl
rm
document.js
30404
0644
edit
dl
rm
field-value.d.ts
8598
0644
edit
dl
rm
field-value.js
13884
0644
edit
dl
rm
filter.d.ts
6832
0644
edit
dl
rm
filter.js
6973
0644
edit
dl
rm
geo-point.d.ts
2644
0644
edit
dl
rm
geo-point.js
3217
0644
edit
dl
rm
index.d.ts
38229
0644
edit
dl
rm
index.js
63443
0644
edit
dl
rm
logger.d.ts
1310
0644
edit
dl
rm
logger.js
2112
0644
edit
dl
rm
order.d.ts
1096
0644
edit
dl
rm
order.js
7525
0644
edit
dl
rm
path.d.ts
12118
0644
edit
dl
rm
path.js
18995
0644
edit
dl
rm
pool.d.ts
4432
0644
edit
dl
rm
pool.js
10116
0644
edit
dl
rm
query-partition.d.ts
4011
0644
edit
dl
rm
query-partition.js
5761
0644
edit
dl
rm
rate-limiter.d.ts
3015
0644
edit
dl
rm
rate-limiter.js
5850
0644
edit
dl
rm
recursive-delete.d.ts
5714
0644
edit
dl
rm
recursive-delete.js
10040
0644
edit
dl
rm
reference.d.ts
53096
0644
edit
dl
rm
reference.js
103221
0644
edit
dl
rm
serializer.d.ts
2942
0644
edit
dl
rm
serializer.js
12817
0644
edit
dl
rm
status-code.d.ts
1121
0644
edit
dl
rm
status-code.js
712
0644
edit
dl
rm
timestamp.d.ts
6987
0644
edit
dl
rm
timestamp.js
9697
0644
edit
dl
rm
transaction.d.ts
10098
0644
edit
dl
rm
transaction.js
19139
0644
edit
dl
rm
types.d.ts
3992
0644
edit
dl
rm
types.js
1387
0644
edit
dl
rm
util.d.ts
4066
0644
edit
dl
rm
util.js
7373
0644
edit
dl
rm
validate.d.ts
6527
0644
edit
dl
rm
validate.js
12314
0644
edit
dl
rm
watch.d.ts
9738
0644
edit
dl
rm
watch.js
24988
0644
edit
dl
rm
write-batch.d.ts
10521
0644
edit
dl
rm
write-batch.js
27233
0644
edit
dl
rm
Edit:
/var/www/greso.tech/server/nsm/node_modules/@google-cloud/firestore/build/src/validate.js
(12314B)
"use strict"; /*! * Copyright 2017 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.validateEnumValue = exports.validateMaxNumberOfArguments = exports.validateMinNumberOfArguments = exports.validateOptional = exports.invalidArgumentMessage = exports.validateTimestamp = exports.validateInteger = exports.validateNumber = exports.validateBoolean = exports.validateHost = exports.validateString = exports.validateObject = exports.validateFunction = exports.customObjectMessage = void 0; const url_1 = require("url"); const util_1 = require("./util"); const timestamp_1 = require("./timestamp"); /** * Generates an error message to use with custom objects that cannot be * serialized. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param value The value that failed serialization. * @param path The field path that the object is assigned to. */ function customObjectMessage(arg, value, path) { const fieldPathMessage = path ? ` (found in field "${path}")` : ''; if ((0, util_1.isObject)(value)) { // We use the base class name as the type name as the sentinel classes // returned by the public FieldValue API are subclasses of FieldValue. By // using the base name, we reduce the number of special cases below. const typeName = value.constructor.name; switch (typeName) { case 'DocumentReference': case 'FieldPath': case 'FieldValue': case 'GeoPoint': case 'Timestamp': return (`${invalidArgumentMessage(arg, 'Firestore document')} Detected an object of type "${typeName}" that doesn't match the ` + `expected instance${fieldPathMessage}. Please ensure that the ` + 'Firestore types you are using are from the same NPM package.)'); case 'Object': return `${invalidArgumentMessage(arg, 'Firestore document')} Invalid use of type "${typeof value}" as a Firestore argument${fieldPathMessage}.`; default: return (`${invalidArgumentMessage(arg, 'Firestore document')} Couldn't serialize object of type "${typeName}"${fieldPathMessage}. Firestore doesn't support JavaScript ` + 'objects with custom prototypes (i.e. objects that were created ' + 'via the "new" operator).'); } } else { return `${invalidArgumentMessage(arg, 'Firestore document')} Input is not a plain JavaScript object${fieldPathMessage}.`; } } exports.customObjectMessage = customObjectMessage; /** * Validates that 'value' is a function. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param value The input to validate. * @param options Options that specify whether the function can be omitted. */ function validateFunction(arg, value, options) { if (!validateOptional(value, options)) { if (!(0, util_1.isFunction)(value)) { throw new Error(invalidArgumentMessage(arg, 'function')); } } } exports.validateFunction = validateFunction; /** * Validates that 'value' is an object. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param value The input to validate. * @param options Options that specify whether the object can be omitted. */ function validateObject(arg, value, options) { if (!validateOptional(value, options)) { if (!(0, util_1.isObject)(value)) { throw new Error(invalidArgumentMessage(arg, 'object')); } } } exports.validateObject = validateObject; /** * Validates that 'value' is a string. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param value The input to validate. * @param options Options that specify whether the string can be omitted. */ function validateString(arg, value, options) { if (!validateOptional(value, options)) { if (typeof value !== 'string') { throw new Error(invalidArgumentMessage(arg, 'string')); } } } exports.validateString = validateString; /** * Validates that 'value' is a host. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param value The input to validate. * @param options Options that specify whether the host can be omitted. */ function validateHost(arg, value, options) { if (!validateOptional(value, options)) { validateString(arg, value); const urlString = `http://${value}/`; let parsed; try { parsed = new url_1.URL(urlString); } catch (e) { throw new Error(invalidArgumentMessage(arg, 'host')); } if (parsed.search !== '' || parsed.pathname !== '/' || parsed.username !== '') { throw new Error(invalidArgumentMessage(arg, 'host')); } } } exports.validateHost = validateHost; /** * Validates that 'value' is a boolean. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param value The input to validate. * @param options Options that specify whether the boolean can be omitted. */ function validateBoolean(arg, value, options) { if (!validateOptional(value, options)) { if (typeof value !== 'boolean') { throw new Error(invalidArgumentMessage(arg, 'boolean')); } } } exports.validateBoolean = validateBoolean; /** * Validates that 'value' is a number. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param value The input to validate. * @param options Options that specify whether the number can be omitted. */ function validateNumber(arg, value, options) { const min = options !== undefined && options.minValue !== undefined ? options.minValue : -Infinity; const max = options !== undefined && options.maxValue !== undefined ? options.maxValue : Infinity; if (!validateOptional(value, options)) { if (typeof value !== 'number' || isNaN(value)) { throw new Error(invalidArgumentMessage(arg, 'number')); } else if (value < min || value > max) { throw new Error(`${formatArgumentName(arg)} must be within [${min}, ${max}] inclusive, but was: ${value}`); } } } exports.validateNumber = validateNumber; /** * Validates that 'value' is a integer. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param value The input to validate. * @param options Options that specify whether the integer can be omitted. */ function validateInteger(arg, value, options) { const min = options !== undefined && options.minValue !== undefined ? options.minValue : -Infinity; const max = options !== undefined && options.maxValue !== undefined ? options.maxValue : Infinity; if (!validateOptional(value, options)) { if (typeof value !== 'number' || isNaN(value) || value % 1 !== 0) { throw new Error(invalidArgumentMessage(arg, 'integer')); } else if (value < min || value > max) { throw new Error(`${formatArgumentName(arg)} must be within [${min}, ${max}] inclusive, but was: ${value}`); } } } exports.validateInteger = validateInteger; /** * Validates that 'value' is a Timestamp. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param value The input to validate. * @param options Options that specify whether the Timestamp can be omitted. */ function validateTimestamp(arg, value, options) { if (!validateOptional(value, options)) { if (!(value instanceof timestamp_1.Timestamp)) { throw new Error(invalidArgumentMessage(arg, 'Timestamp')); } } } exports.validateTimestamp = validateTimestamp; /** * Generates an error message to use with invalid arguments. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @param expectedType The expected input type. */ function invalidArgumentMessage(arg, expectedType) { return `${formatArgumentName(arg)} is not a valid ${expectedType}.`; } exports.invalidArgumentMessage = invalidArgumentMessage; /** * Enforces the 'options.optional' constraint for 'value'. * * @private * @internal * @param value The input to validate. * @param options Whether the function can be omitted. * @return Whether the object is omitted and is allowed to be omitted. */ function validateOptional(value, options) { return (value === undefined && options !== undefined && options.optional === true); } exports.validateOptional = validateOptional; /** * Formats the given word as plural conditionally given the preceding number. * * @private * @internal * @param num The number to use for formatting. * @param str The string to format. */ function formatPlural(num, str) { return `${num} ${str}` + (num === 1 ? '' : 's'); } /** * Creates a descriptive name for the provided argument name or index. * * @private * @internal * @param arg The argument name or argument index (for varargs methods). * @return Either the argument name or its index description. */ function formatArgumentName(arg) { return typeof arg === 'string' ? `Value for argument "${arg}"` : `Element at index ${arg}`; } /** * Verifies that 'args' has at least 'minSize' elements. * * @private * @internal * @param funcName The function name to use in the error message. * @param args The array (or array-like structure) to verify. * @param minSize The minimum number of elements to enforce. * @throws if the expectation is not met. */ function validateMinNumberOfArguments(funcName, args, minSize) { if (args.length < minSize) { throw new Error(`Function "${funcName}()" requires at least ` + `${formatPlural(minSize, 'argument')}.`); } } exports.validateMinNumberOfArguments = validateMinNumberOfArguments; /** * Verifies that 'args' has at most 'maxSize' elements. * * @private * @internal * @param funcName The function name to use in the error message. * @param args The array (or array-like structure) to verify. * @param maxSize The maximum number of elements to enforce. * @throws if the expectation is not met. */ function validateMaxNumberOfArguments(funcName, args, maxSize) { if (args.length > maxSize) { throw new Error(`Function "${funcName}()" accepts at most ` + `${formatPlural(maxSize, 'argument')}.`); } } exports.validateMaxNumberOfArguments = validateMaxNumberOfArguments; /** * Validates that the provided named option equals one of the expected values. * * @param arg The argument name or argument index (for varargs methods).). * @param value The input to validate. * @param allowedValues A list of expected values. * @param options Whether the input can be omitted. * @private * @internal */ function validateEnumValue(arg, value, allowedValues, options) { if (!validateOptional(value, options)) { const expectedDescription = []; for (const allowed of allowedValues) { if (allowed === value) { return; } expectedDescription.push(allowed); } throw new Error(`${formatArgumentName(arg)} is invalid. Acceptable values are: ${expectedDescription.join(', ')}`); } } exports.validateEnumValue = validateEnumValue; //# sourceMappingURL=validate.js.map
Save
cmd:
run