Файловый менеджер - Редактировать - /home/freeclou/app.optimyar.com/front-web/build/assets/fonts/iran-yekan/MobileFonts/wgdpf7/schema.zip
Назад
PK <n[e��n n operators/bitwise.jsnu �Iw�� /*! * Module requirements. */ 'use strict'; const CastError = require('../../error/cast'); /*! * ignore */ function handleBitwiseOperator(val) { const _this = this; if (Array.isArray(val)) { return val.map(function(v) { return _castNumber(_this.path, v); }); } else if (Buffer.isBuffer(val)) { return val; } // Assume trying to cast to number return _castNumber(_this.path, val); } /*! * ignore */ function _castNumber(path, num) { const v = Number(num); if (isNaN(v)) { throw new CastError('number', num, path); } return v; } module.exports = handleBitwiseOperator; PK <n[��� � operators/exists.jsnu �Iw�� 'use strict'; const castBoolean = require('../../cast/boolean'); /*! * ignore */ module.exports = function(val) { const path = this != null ? this.path : null; return castBoolean(val, path); }; PK <n[��2 2 operators/geospatial.jsnu �Iw�� /*! * Module requirements. */ 'use strict'; const castArraysOfNumbers = require('./helpers').castArraysOfNumbers; const castToNumber = require('./helpers').castToNumber; /*! * ignore */ exports.cast$geoIntersects = cast$geoIntersects; exports.cast$near = cast$near; exports.cast$within = cast$within; function cast$near(val) { const SchemaArray = require('../array'); if (Array.isArray(val)) { castArraysOfNumbers(val, this); return val; } _castMinMaxDistance(this, val); if (val && val.$geometry) { return cast$geometry(val, this); } if (!Array.isArray(val)) { throw new TypeError('$near must be either an array or an object ' + 'with a $geometry property'); } return SchemaArray.prototype.castForQuery.call(this, val); } function cast$geometry(val, self) { switch (val.$geometry.type) { case 'Polygon': case 'LineString': case 'Point': castArraysOfNumbers(val.$geometry.coordinates, self); break; default: // ignore unknowns break; } _castMinMaxDistance(self, val); return val; } function cast$within(val) { _castMinMaxDistance(this, val); if (val.$box || val.$polygon) { const type = val.$box ? '$box' : '$polygon'; val[type].forEach(arr => { if (!Array.isArray(arr)) { const msg = 'Invalid $within $box argument. ' + 'Expected an array, received ' + arr; throw new TypeError(msg); } arr.forEach((v, i) => { arr[i] = castToNumber.call(this, v); }); }); } else if (val.$center || val.$centerSphere) { const type = val.$center ? '$center' : '$centerSphere'; val[type].forEach((item, i) => { if (Array.isArray(item)) { item.forEach((v, j) => { item[j] = castToNumber.call(this, v); }); } else { val[type][i] = castToNumber.call(this, item); } }); } else if (val.$geometry) { cast$geometry(val, this); } return val; } function cast$geoIntersects(val) { const geo = val.$geometry; if (!geo) { return; } cast$geometry(val, this); return val; } function _castMinMaxDistance(self, val) { if (val.$maxDistance) { val.$maxDistance = castToNumber.call(self, val.$maxDistance); } if (val.$minDistance) { val.$minDistance = castToNumber.call(self, val.$minDistance); } } PK <n[���0� � operators/helpers.jsnu �Iw�� 'use strict'; /*! * Module requirements. */ const SchemaNumber = require('../number'); /*! * @ignore */ exports.castToNumber = castToNumber; exports.castArraysOfNumbers = castArraysOfNumbers; /*! * @ignore */ function castToNumber(val) { return SchemaNumber.cast()(val); } function castArraysOfNumbers(arr, self) { arr.forEach(function(v, i) { if (Array.isArray(v)) { castArraysOfNumbers(v, self); } else { arr[i] = castToNumber.call(self, v); } }); } PK <n["x~�n n operators/text.jsnu �Iw�� 'use strict'; const CastError = require('../../error/cast'); const castBoolean = require('../../cast/boolean'); const castString = require('../../cast/string'); /*! * Casts val to an object suitable for `$text`. Throws an error if the object * can't be casted. * * @param {Any} val value to cast * @param {String} [path] path to associate with any errors that occured * @return {Object} casted object * @see https://docs.mongodb.com/manual/reference/operator/query/text/ * @api private */ module.exports = function(val, path) { if (val == null || typeof val !== 'object') { throw new CastError('$text', val, path); } if (val.$search != null) { val.$search = castString(val.$search, path + '.$search'); } if (val.$language != null) { val.$language = castString(val.$language, path + '.$language'); } if (val.$caseSensitive != null) { val.$caseSensitive = castBoolean(val.$caseSensitive, path + '.$castSensitive'); } if (val.$diacriticSensitive != null) { val.$diacriticSensitive = castBoolean(val.$diacriticSensitive, path + '.$diacriticSensitive'); } return val; }; PK <n[t��� � operators/type.jsnu �Iw�� 'use strict'; /*! * ignore */ module.exports = function(val) { if (typeof val !== 'number' && typeof val !== 'string') { throw new Error('$type parameter must be number or string'); } return val; }; PK <n[�#��# �# SingleNestedPath.jsnu �Iw�� 'use strict'; /*! * Module dependencies. */ const CastError = require('../error/cast'); const EventEmitter = require('events').EventEmitter; const ObjectExpectedError = require('../error/objectExpected'); const SchemaSingleNestedOptions = require('../options/SchemaSingleNestedOptions'); const SchemaType = require('../schematype'); const $exists = require('./operators/exists'); const castToNumber = require('./operators/helpers').castToNumber; const discriminator = require('../helpers/model/discriminator'); const geospatial = require('./operators/geospatial'); const get = require('../helpers/get'); const getConstructor = require('../helpers/discriminator/getConstructor'); const handleIdOption = require('../helpers/schema/handleIdOption'); const internalToObjectOptions = require('../options').internalToObjectOptions; let Subdocument; module.exports = SingleNestedPath; /** * Single nested subdocument SchemaType constructor. * * @param {Schema} schema * @param {String} key * @param {Object} options * @inherits SchemaType * @api public */ function SingleNestedPath(schema, path, options) { schema = handleIdOption(schema, options); this.caster = _createConstructor(schema); this.caster.path = path; this.caster.prototype.$basePath = path; this.schema = schema; this.$isSingleNested = true; SchemaType.call(this, path, options, 'Embedded'); } /*! * ignore */ SingleNestedPath.prototype = Object.create(SchemaType.prototype); SingleNestedPath.prototype.constructor = SingleNestedPath; SingleNestedPath.prototype.OptionsConstructor = SchemaSingleNestedOptions; /*! * ignore */ function _createConstructor(schema, baseClass) { // lazy load Subdocument || (Subdocument = require('../types/subdocument')); const _embedded = function SingleNested(value, path, parent) { const _this = this; this.$parent = parent; Subdocument.apply(this, arguments); this.$session(this.ownerDocument().$session()); if (parent) { parent.on('save', function() { _this.emit('save', _this); _this.constructor.emit('save', _this); }); parent.on('isNew', function(val) { _this.isNew = val; _this.emit('isNew', val); _this.constructor.emit('isNew', val); }); } }; const proto = baseClass != null ? baseClass.prototype : Subdocument.prototype; _embedded.prototype = Object.create(proto); _embedded.prototype.$__setSchema(schema); _embedded.prototype.constructor = _embedded; _embedded.schema = schema; _embedded.$isSingleNested = true; _embedded.events = new EventEmitter(); _embedded.prototype.toBSON = function() { return this.toObject(internalToObjectOptions); }; // apply methods for (const i in schema.methods) { _embedded.prototype[i] = schema.methods[i]; } // apply statics for (const i in schema.statics) { _embedded[i] = schema.statics[i]; } for (const i in EventEmitter.prototype) { _embedded[i] = EventEmitter.prototype[i]; } return _embedded; } /*! * Special case for when users use a common location schema to represent * locations for use with $geoWithin. * https://docs.mongodb.org/manual/reference/operator/query/geoWithin/ * * @param {Object} val * @api private */ SingleNestedPath.prototype.$conditionalHandlers.$geoWithin = function handle$geoWithin(val) { return { $geometry: this.castForQuery(val.$geometry) }; }; /*! * ignore */ SingleNestedPath.prototype.$conditionalHandlers.$near = SingleNestedPath.prototype.$conditionalHandlers.$nearSphere = geospatial.cast$near; SingleNestedPath.prototype.$conditionalHandlers.$within = SingleNestedPath.prototype.$conditionalHandlers.$geoWithin = geospatial.cast$within; SingleNestedPath.prototype.$conditionalHandlers.$geoIntersects = geospatial.cast$geoIntersects; SingleNestedPath.prototype.$conditionalHandlers.$minDistance = castToNumber; SingleNestedPath.prototype.$conditionalHandlers.$maxDistance = castToNumber; SingleNestedPath.prototype.$conditionalHandlers.$exists = $exists; /** * Casts contents * * @param {Object} value * @api private */ SingleNestedPath.prototype.cast = function(val, doc, init, priorVal) { if (val && val.$isSingleNested && val.parent === doc) { return val; } if (val != null && (typeof val !== 'object' || Array.isArray(val))) { throw new ObjectExpectedError(this.path, val); } const Constructor = getConstructor(this.caster, val); let subdoc; // Only pull relevant selected paths and pull out the base path const parentSelected = get(doc, '$__.selected', {}); const path = this.path; const selected = Object.keys(parentSelected).reduce((obj, key) => { if (key.startsWith(path + '.')) { obj[key.substr(path.length + 1)] = parentSelected[key]; } return obj; }, {}); if (init) { subdoc = new Constructor(void 0, selected, doc); subdoc.init(val); } else { if (Object.keys(val).length === 0) { return new Constructor({}, selected, doc, undefined, { priorDoc: priorVal }); } return new Constructor(val, selected, doc, undefined, { priorDoc: priorVal }); } return subdoc; }; /** * Casts contents for query * * @param {string} [$conditional] optional query operator (like `$eq` or `$in`) * @param {any} value * @api private */ SingleNestedPath.prototype.castForQuery = function($conditional, val, options) { let handler; if (arguments.length === 2) { handler = this.$conditionalHandlers[$conditional]; if (!handler) { throw new Error('Can\'t use ' + $conditional); } return handler.call(this, val); } val = $conditional; if (val == null) { return val; } if (this.options.runSetters) { val = this._applySetters(val); } const Constructor = getConstructor(this.caster, val); const overrideStrict = options != null && options.strict != null ? options.strict : void 0; try { val = new Constructor(val, overrideStrict); } catch (error) { // Make sure we always wrap in a CastError (gh-6803) if (!(error instanceof CastError)) { throw new CastError('Embedded', val, this.path, error, this); } throw error; } return val; }; /** * Async validation on this single nested doc. * * @api private */ SingleNestedPath.prototype.doValidate = function(value, fn, scope, options) { const Constructor = getConstructor(this.caster, value); if (options && options.skipSchemaValidators) { if (!(value instanceof Constructor)) { value = new Constructor(value, null, scope); } return value.validate(fn); } SchemaType.prototype.doValidate.call(this, value, function(error) { if (error) { return fn(error); } if (!value) { return fn(null); } value.validate(fn); }, scope, options); }; /** * Synchronously validate this single nested doc * * @api private */ SingleNestedPath.prototype.doValidateSync = function(value, scope, options) { if (!options || !options.skipSchemaValidators) { const schemaTypeError = SchemaType.prototype.doValidateSync.call(this, value, scope); if (schemaTypeError) { return schemaTypeError; } } if (!value) { return; } return value.validateSync(); }; /** * Adds a discriminator to this single nested subdocument. * * ####Example: * const shapeSchema = Schema({ name: String }, { discriminatorKey: 'kind' }); * const schema = Schema({ shape: shapeSchema }); * * const singleNestedPath = parentSchema.path('shape'); * singleNestedPath.discriminator('Circle', Schema({ radius: Number })); * * @param {String} name * @param {Schema} schema fields to add to the schema for instances of this sub-class * @param {String} [value] the string stored in the `discriminatorKey` property. If not specified, Mongoose uses the `name` parameter. * @return {Function} the constructor Mongoose will use for creating instances of this discriminator model * @see discriminators /docs/discriminators.html * @api public */ SingleNestedPath.prototype.discriminator = function(name, schema, value) { schema = discriminator(this.caster, name, schema, value); this.caster.discriminators[name] = _createConstructor(schema, this.caster); return this.caster.discriminators[name]; }; /** * Sets a default option for all SingleNestedPath instances. * * ####Example: * * // Make all numbers have option `min` equal to 0. * mongoose.Schema.Embedded.set('required', true); * * @param {String} option - The option you'd like to set the value for * @param {*} value - value for option * @return {undefined} * @function set * @static * @api public */ SingleNestedPath.defaultOptions = {}; SingleNestedPath.set = SchemaType.set; /*! * ignore */ SingleNestedPath.prototype.clone = function() { const options = Object.assign({}, this.options); const schematype = new this.constructor(this.schema, this.path, options); schematype.validators = this.validators.slice(); if (this.requiredValidator !== undefined) { schematype.requiredValidator = this.requiredValidator; } schematype.caster.discriminators = Object.assign({}, this.caster.discriminators); return schematype; }; PK <n[a�%��>