simpl-schema
Advanced tools
Comparing version 3.0.1 to 3.1.0
@@ -33,2 +33,7 @@ "use strict"; | ||
const cleanOptions = Object.assign(Object.assign({ isModifier: (0, index_js_1.looksLikeModifier)(doc), isUpsert: false }, ss._cleanOptions), options); | ||
Object.getOwnPropertyNames(cleanOptions).forEach((opt) => { | ||
if (!SimpleSchema_js_1.SimpleSchema.supportedCleanOptions.has(opt)) { | ||
console.warn(`Unsupported "${opt}" option passed to SimpleSchema clean`); | ||
} | ||
}); | ||
// Clone so we do not mutate | ||
@@ -35,0 +40,0 @@ const cleanDoc = cleanOptions.mutate === true ? doc : (0, clone_1.default)(doc); |
@@ -104,2 +104,7 @@ "use strict"; | ||
delete this._constructorOptions.clean; // stored separately below | ||
Object.getOwnPropertyNames(this._constructorOptions).forEach((opt) => { | ||
if (!SimpleSchema.supportedConstructorOptions.has(opt)) { | ||
console.warn(`Unsupported "${opt}" option passed to SimpleSchema constructor`); | ||
} | ||
}); | ||
// Schema-level defaults for cleaning | ||
@@ -808,2 +813,30 @@ this._cleanOptions = Object.assign(Object.assign({}, SimpleSchema._constructorOptionDefaults.clean), ((_a = options.clean) !== null && _a !== void 0 ? _a : {})); | ||
exports.SimpleSchema = SimpleSchema; | ||
/** | ||
* Packages that want to allow and check additional options | ||
* should add the option names to this set. | ||
*/ | ||
SimpleSchema.supportedConstructorOptions = new Set([ | ||
'clean', | ||
'getErrorMessage', | ||
'humanizeAutoLabels', | ||
'keepRawDefinition', | ||
'requiredByDefault' | ||
]); | ||
/** | ||
* Packages that want to allow and check additional options | ||
* should add the option names to this set. | ||
*/ | ||
SimpleSchema.supportedCleanOptions = new Set([ | ||
'autoConvert', | ||
'extendAutoValueContext', | ||
'filter', | ||
'getAutoValues', | ||
'isModifier', | ||
'isUpsert', | ||
'mongoObject', | ||
'mutate', | ||
'removeEmptyStrings', | ||
'removeNullsFromArrays', | ||
'trimStrings' | ||
]); | ||
SimpleSchema.version = 2; | ||
@@ -810,0 +843,0 @@ // Global constructor options |
@@ -28,2 +28,7 @@ import clone from 'clone'; | ||
const cleanOptions = Object.assign(Object.assign({ isModifier: looksLikeModifier(doc), isUpsert: false }, ss._cleanOptions), options); | ||
Object.getOwnPropertyNames(cleanOptions).forEach((opt) => { | ||
if (!SimpleSchema.supportedCleanOptions.has(opt)) { | ||
console.warn(`Unsupported "${opt}" option passed to SimpleSchema clean`); | ||
} | ||
}); | ||
// Clone so we do not mutate | ||
@@ -30,0 +35,0 @@ const cleanDoc = cleanOptions.mutate === true ? doc : clone(doc); |
@@ -9,2 +9,12 @@ import { ClientError } from './errors.js'; | ||
static defaultLabel?: string; | ||
/** | ||
* Packages that want to allow and check additional options | ||
* should add the option names to this set. | ||
*/ | ||
static supportedConstructorOptions: Set<string>; | ||
/** | ||
* Packages that want to allow and check additional options | ||
* should add the option names to this set. | ||
*/ | ||
static supportedCleanOptions: Set<string>; | ||
static validationErrorTransform?: (error: ClientError<ValidationError[]>) => Error; | ||
@@ -11,0 +21,0 @@ static version: number; |
@@ -97,2 +97,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
delete this._constructorOptions.clean; // stored separately below | ||
Object.getOwnPropertyNames(this._constructorOptions).forEach((opt) => { | ||
if (!SimpleSchema.supportedConstructorOptions.has(opt)) { | ||
console.warn(`Unsupported "${opt}" option passed to SimpleSchema constructor`); | ||
} | ||
}); | ||
// Schema-level defaults for cleaning | ||
@@ -800,2 +805,30 @@ this._cleanOptions = Object.assign(Object.assign({}, SimpleSchema._constructorOptionDefaults.clean), ((_a = options.clean) !== null && _a !== void 0 ? _a : {})); | ||
} | ||
/** | ||
* Packages that want to allow and check additional options | ||
* should add the option names to this set. | ||
*/ | ||
SimpleSchema.supportedConstructorOptions = new Set([ | ||
'clean', | ||
'getErrorMessage', | ||
'humanizeAutoLabels', | ||
'keepRawDefinition', | ||
'requiredByDefault' | ||
]); | ||
/** | ||
* Packages that want to allow and check additional options | ||
* should add the option names to this set. | ||
*/ | ||
SimpleSchema.supportedCleanOptions = new Set([ | ||
'autoConvert', | ||
'extendAutoValueContext', | ||
'filter', | ||
'getAutoValues', | ||
'isModifier', | ||
'isUpsert', | ||
'mongoObject', | ||
'mutate', | ||
'removeEmptyStrings', | ||
'removeNullsFromArrays', | ||
'trimStrings' | ||
]); | ||
SimpleSchema.version = 2; | ||
@@ -802,0 +835,0 @@ // Global constructor options |
{ | ||
"name": "simpl-schema", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "A schema validation package that supports direct validation of MongoDB update modifier objects.", | ||
@@ -32,3 +32,4 @@ "author": "Eric Dobbertin <eric@dairystatedesigns.com>", | ||
"engines": { | ||
"node": ">=14.16" | ||
"node": ">=14.16", | ||
"npm": ">=8" | ||
}, | ||
@@ -35,0 +36,0 @@ "browserslist": "> 0.5%, last 2 versions, Firefox ESR, not dead", |
@@ -573,3 +573,3 @@ # SimpleSchema (simpl-schema NPM package) | ||
}, | ||
{ keepRawDefintion: true } | ||
{ keepRawDefinition: true } | ||
); | ||
@@ -576,0 +576,0 @@ userSchema.rawDefinition; |
308918
5866