summaryrefslogtreecommitdiffstats
path: root/node_modules/mongoose/lib/helpers/schema
diff options
context:
space:
mode:
authorGravatar Piotr Russ <mail@pruss.it> 2020-11-18 23:26:45 +0100
committerGravatar Piotr Russ <mail@pruss.it> 2020-11-18 23:26:45 +0100
commit81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 (patch)
tree8b959d50c5a614cbf9fcb346ed556140374d4b6d /node_modules/mongoose/lib/helpers/schema
parent1870f3fdf43707a15fda0f609a021f516f45eb63 (diff)
downloadwebsite_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.gz
website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.tar.bz2
website_creator-81ddf9b700bc48a1f8e472209f080f9c1d9a9b09.zip
rm node_modules
Diffstat (limited to 'node_modules/mongoose/lib/helpers/schema')
-rw-r--r--node_modules/mongoose/lib/helpers/schema/addAutoId.js7
-rw-r--r--node_modules/mongoose/lib/helpers/schema/applyPlugins.js44
-rw-r--r--node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js16
-rw-r--r--node_modules/mongoose/lib/helpers/schema/cleanPositionalOperators.js12
-rw-r--r--node_modules/mongoose/lib/helpers/schema/getIndexes.js155
-rw-r--r--node_modules/mongoose/lib/helpers/schema/getPath.js35
-rw-r--r--node_modules/mongoose/lib/helpers/schema/handleIdOption.js20
-rw-r--r--node_modules/mongoose/lib/helpers/schema/handleTimestampOption.js24
-rw-r--r--node_modules/mongoose/lib/helpers/schema/merge.js19
9 files changed, 0 insertions, 332 deletions
diff --git a/node_modules/mongoose/lib/helpers/schema/addAutoId.js b/node_modules/mongoose/lib/helpers/schema/addAutoId.js
deleted file mode 100644
index 11a1f23..0000000
--- a/node_modules/mongoose/lib/helpers/schema/addAutoId.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict';
-
-module.exports = function addAutoId(schema) {
- const _obj = { _id: { auto: true } };
- _obj._id[schema.options.typeKey] = 'ObjectId';
- schema.add(_obj);
-}; \ No newline at end of file
diff --git a/node_modules/mongoose/lib/helpers/schema/applyPlugins.js b/node_modules/mongoose/lib/helpers/schema/applyPlugins.js
deleted file mode 100644
index f1daf40..0000000
--- a/node_modules/mongoose/lib/helpers/schema/applyPlugins.js
+++ /dev/null
@@ -1,44 +0,0 @@
-'use strict';
-
-module.exports = function applyPlugins(schema, plugins, options, cacheKey) {
- if (schema[cacheKey]) {
- return;
- }
- schema[cacheKey] = true;
-
- if (!options || !options.skipTopLevel) {
- for (const plugin of plugins) {
- schema.plugin(plugin[0], plugin[1]);
- }
- }
-
- options = Object.assign({}, options);
- delete options.skipTopLevel;
-
- if (options.applyPluginsToChildSchemas !== false) {
- for (const path of Object.keys(schema.paths)) {
- const type = schema.paths[path];
- if (type.schema != null) {
- applyPlugins(type.schema, plugins, options, cacheKey);
-
- // Recompile schema because plugins may have changed it, see gh-7572
- type.caster.prototype.$__setSchema(type.schema);
- }
- }
- }
-
- const discriminators = schema.discriminators;
- if (discriminators == null) {
- return;
- }
-
- const applyPluginsToDiscriminators = options.applyPluginsToDiscriminators;
-
- const keys = Object.keys(discriminators);
- for (const discriminatorKey of keys) {
- const discriminatorSchema = discriminators[discriminatorKey];
-
- applyPlugins(discriminatorSchema, plugins,
- { skipTopLevel: !applyPluginsToDiscriminators }, cacheKey);
- }
-}; \ No newline at end of file
diff --git a/node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js b/node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js
deleted file mode 100644
index 168156d..0000000
--- a/node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict';
-
-const get = require('../get');
-
-module.exports = function applyWriteConcern(schema, options) {
- const writeConcern = get(schema, 'options.writeConcern', {});
- if (!('w' in options) && writeConcern.w != null) {
- options.w = writeConcern.w;
- }
- if (!('j' in options) && writeConcern.j != null) {
- options.j = writeConcern.j;
- }
- if (!('wtimeout' in options) && writeConcern.wtimeout != null) {
- options.wtimeout = writeConcern.wtimeout;
- }
-};
diff --git a/node_modules/mongoose/lib/helpers/schema/cleanPositionalOperators.js b/node_modules/mongoose/lib/helpers/schema/cleanPositionalOperators.js
deleted file mode 100644
index b467be4..0000000
--- a/node_modules/mongoose/lib/helpers/schema/cleanPositionalOperators.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict';
-
-/**
- * For consistency's sake, we replace positional operator `$` and array filters
- * `$[]` and `$[foo]` with `0` when looking up schema paths.
- */
-
-module.exports = function cleanPositionalOperators(path) {
- return path.
- replace(/\.\$(\[[^\]]*\])?\./g, '.0.').
- replace(/\.(\[[^\]]*\])?\$$/g, '.0');
-}; \ No newline at end of file
diff --git a/node_modules/mongoose/lib/helpers/schema/getIndexes.js b/node_modules/mongoose/lib/helpers/schema/getIndexes.js
deleted file mode 100644
index be907db..0000000
--- a/node_modules/mongoose/lib/helpers/schema/getIndexes.js
+++ /dev/null
@@ -1,155 +0,0 @@
-'use strict';
-
-const get = require('../get');
-const helperIsObject = require('../isObject');
-
-/*!
- * Gather all indexes defined in the schema, including single nested,
- * document arrays, and embedded discriminators.
- */
-
-module.exports = function getIndexes(schema) {
- let indexes = [];
- const schemaStack = new WeakMap();
- const indexTypes = schema.constructor.indexTypes;
- const indexByName = new Map();
-
- collectIndexes(schema);
- return indexes;
-
- function collectIndexes(schema, prefix, baseSchema) {
- // Ignore infinitely nested schemas, if we've already seen this schema
- // along this path there must be a cycle
- if (schemaStack.has(schema)) {
- return;
- }
- schemaStack.set(schema, true);
-
- prefix = prefix || '';
- const keys = Object.keys(schema.paths);
-
- for (const key of keys) {
- const path = schema.paths[key];
- if (baseSchema != null && baseSchema.paths[key]) {
- // If looking at an embedded discriminator schema, don't look at paths
- // that the
- continue;
- }
-
- if (path.$isMongooseDocumentArray || path.$isSingleNested) {
- if (get(path, 'options.excludeIndexes') !== true &&
- get(path, 'schemaOptions.excludeIndexes') !== true &&
- get(path, 'schema.options.excludeIndexes') !== true) {
- collectIndexes(path.schema, prefix + key + '.');
- }
-
- if (path.schema.discriminators != null) {
- const discriminators = path.schema.discriminators;
- const discriminatorKeys = Object.keys(discriminators);
- for (const discriminatorKey of discriminatorKeys) {
- collectIndexes(discriminators[discriminatorKey],
- prefix + key + '.', path.schema);
- }
- }
-
- // Retained to minimize risk of backwards breaking changes due to
- // gh-6113
- if (path.$isMongooseDocumentArray) {
- continue;
- }
- }
-
- const index = path._index || (path.caster && path.caster._index);
-
- if (index !== false && index !== null && index !== undefined) {
- const field = {};
- const isObject = helperIsObject(index);
- const options = isObject ? index : {};
- const type = typeof index === 'string' ? index :
- isObject ? index.type :
- false;
-
- if (type && indexTypes.indexOf(type) !== -1) {
- field[prefix + key] = type;
- } else if (options.text) {
- field[prefix + key] = 'text';
- delete options.text;
- } else {
- const isDescendingIndex = Number(index) === -1;
- field[prefix + key] = isDescendingIndex ? -1 : 1;
- }
-
- delete options.type;
- if (!('background' in options)) {
- options.background = true;
- }
- if (schema.options.autoIndex != null) {
- options._autoIndex = schema.options.autoIndex;
- }
-
- const indexName = options && options.name;
- if (typeof indexName === 'string') {
- if (indexByName.has(indexName)) {
- Object.assign(indexByName.get(indexName), field);
- } else {
- indexes.push([field, options]);
- indexByName.set(indexName, field);
- }
- } else {
- indexes.push([field, options]);
- indexByName.set(indexName, field);
- }
- }
- }
-
- schemaStack.delete(schema);
-
- if (prefix) {
- fixSubIndexPaths(schema, prefix);
- } else {
- schema._indexes.forEach(function(index) {
- if (!('background' in index[1])) {
- index[1].background = true;
- }
- });
- indexes = indexes.concat(schema._indexes);
- }
- }
-
- /*!
- * Checks for indexes added to subdocs using Schema.index().
- * These indexes need their paths prefixed properly.
- *
- * schema._indexes = [ [indexObj, options], [indexObj, options] ..]
- */
-
- function fixSubIndexPaths(schema, prefix) {
- const subindexes = schema._indexes;
- const len = subindexes.length;
- for (let i = 0; i < len; ++i) {
- const indexObj = subindexes[i][0];
- const indexOptions = subindexes[i][1];
- const keys = Object.keys(indexObj);
- const klen = keys.length;
- const newindex = {};
-
- // use forward iteration, order matters
- for (let j = 0; j < klen; ++j) {
- const key = keys[j];
- newindex[prefix + key] = indexObj[key];
- }
-
- const newIndexOptions = Object.assign({}, indexOptions);
- if (indexOptions != null && indexOptions.partialFilterExpression != null) {
- newIndexOptions.partialFilterExpression = {};
- const partialFilterExpression = indexOptions.partialFilterExpression;
- for (const key of Object.keys(partialFilterExpression)) {
- newIndexOptions.partialFilterExpression[prefix + key] =
- partialFilterExpression[key];
- }
- }
-
- indexes.push([newindex, newIndexOptions]);
- }
- }
-};
diff --git a/node_modules/mongoose/lib/helpers/schema/getPath.js b/node_modules/mongoose/lib/helpers/schema/getPath.js
deleted file mode 100644
index ccbc67c..0000000
--- a/node_modules/mongoose/lib/helpers/schema/getPath.js
+++ /dev/null
@@ -1,35 +0,0 @@
-'use strict';
-
-/*!
- * Behaves like `Schema#path()`, except for it also digs into arrays without
- * needing to put `.0.`, so `getPath(schema, 'docArr.elProp')` works.
- */
-
-module.exports = function getPath(schema, path) {
- let schematype = schema.path(path);
- if (schematype != null) {
- return schematype;
- }
-
- const pieces = path.split('.');
- let cur = '';
- let isArray = false;
-
- for (const piece of pieces) {
- if (/^\d+$/.test(piece) && isArray) {
- continue;
- }
- cur = cur.length === 0 ? piece : cur + '.' + piece;
-
- schematype = schema.path(cur);
- if (schematype != null && schematype.schema) {
- schema = schematype.schema;
- cur = '';
- if (schematype.$isMongooseDocumentArray) {
- isArray = true;
- }
- }
- }
-
- return schematype;
-}; \ No newline at end of file
diff --git a/node_modules/mongoose/lib/helpers/schema/handleIdOption.js b/node_modules/mongoose/lib/helpers/schema/handleIdOption.js
deleted file mode 100644
index 569bf9f..0000000
--- a/node_modules/mongoose/lib/helpers/schema/handleIdOption.js
+++ /dev/null
@@ -1,20 +0,0 @@
-'use strict';
-
-const addAutoId = require('./addAutoId');
-
-module.exports = function handleIdOption(schema, options) {
- if (options == null || options._id == null) {
- return schema;
- }
-
- schema = schema.clone();
- if (!options._id) {
- schema.remove('_id');
- schema.options._id = false;
- } else if (!schema.paths['_id']) {
- addAutoId(schema);
- schema.options._id = true;
- }
-
- return schema;
-}; \ No newline at end of file
diff --git a/node_modules/mongoose/lib/helpers/schema/handleTimestampOption.js b/node_modules/mongoose/lib/helpers/schema/handleTimestampOption.js
deleted file mode 100644
index 1551b7c..0000000
--- a/node_modules/mongoose/lib/helpers/schema/handleTimestampOption.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-
-module.exports = handleTimestampOption;
-
-/*!
- * ignore
- */
-
-function handleTimestampOption(arg, prop) {
- if (arg == null) {
- return null;
- }
-
- if (typeof arg === 'boolean') {
- return prop;
- }
- if (typeof arg[prop] === 'boolean') {
- return arg[prop] ? prop : null;
- }
- if (!(prop in arg)) {
- return prop;
- }
- return arg[prop];
-} \ No newline at end of file
diff --git a/node_modules/mongoose/lib/helpers/schema/merge.js b/node_modules/mongoose/lib/helpers/schema/merge.js
deleted file mode 100644
index d206500..0000000
--- a/node_modules/mongoose/lib/helpers/schema/merge.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict';
-
-module.exports = function merge(s1, s2) {
- s1.add(s2.tree || {});
-
- s1.callQueue = s1.callQueue.concat(s2.callQueue);
- s1.method(s2.methods);
- s1.static(s2.statics);
-
- for (const query in s2.query) {
- s1.query[query] = s2.query[query];
- }
-
- for (const virtual in s2.virtuals) {
- s1.virtuals[virtual] = s2.virtuals[virtual].clone();
- }
-
- s1.s.hooks.merge(s2.s.hooks, false);
-};