From 4f271e7a1763fbb440b136b933c440379a84a4b6 Mon Sep 17 00:00:00 2001 From: Eric Dobbertin Date: Tue, 23 Aug 2016 00:22:28 -0500 Subject: [PATCH] Publish 2.0.0-rc.1 --- .npm/package/npm-shrinkwrap.json | 180 ++++++++++++++++++++++++++++++- .versions | 15 +++ CHANGELOG.md | 66 +++++++----- package.js | 5 +- 4 files changed, 234 insertions(+), 32 deletions(-) create mode 100644 .versions diff --git a/.npm/package/npm-shrinkwrap.json b/.npm/package/npm-shrinkwrap.json index 6ede497..49f7df4 100644 --- a/.npm/package/npm-shrinkwrap.json +++ b/.npm/package/npm-shrinkwrap.json @@ -1,12 +1,188 @@ { "dependencies": { + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "from": "align-text@>=0.1.3 <0.2.0" + }, + "amdefine": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.0.tgz", + "from": "amdefine@>=0.0.4" + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "from": "async@>=1.4.0 <2.0.0" + }, + "babel-polyfill": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.13.0.tgz", + "from": "babel-polyfill@>=6.9.1 <7.0.0" + }, + "babel-runtime": { + "version": "6.11.6", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.11.6.tgz", + "from": "babel-runtime@>=6.9.1 <7.0.0" + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "from": "camelcase@>=1.0.2 <2.0.0" + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "from": "center-align@>=0.1.1 <0.2.0" + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "from": "cliui@>=2.1.0 <3.0.0", + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "from": "wordwrap@0.0.2" + } + } + }, + "clone": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.2.tgz", + "from": "clone@>=1.0.2 <2.0.0" + }, + "core-js": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", + "from": "core-js@>=2.4.0 <3.0.0" + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "from": "decamelize@>=1.0.0 <2.0.0" + }, + "deep-extend": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.1.tgz", + "from": "deep-extend@>=0.4.1 <0.5.0" + }, + "handlebars": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.5.tgz", + "from": "handlebars@>=4.0.5 <5.0.0" + }, + "is-buffer": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.4.tgz", + "from": "is-buffer@>=1.0.2 <2.0.0" + }, + "kind-of": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.0.4.tgz", + "from": "kind-of@>=3.0.2 <4.0.0" + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "from": "lazy-cache@>=1.0.3 <2.0.0" + }, + "lodash": { + "version": "4.15.0", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.15.0.tgz", + "from": "lodash@>=4.5.1 <5.0.0" + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "from": "longest@>=1.0.1 <2.0.0" + }, + "message-box": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/message-box/-/message-box-0.0.1.tgz", + "from": "message-box@0.0.1" + }, + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "from": "minimist@>=0.0.1 <0.1.0" + }, "mongo-object": { "version": "0.0.1", + "resolved": "https://registry.npmjs.org/mongo-object/-/mongo-object-0.0.1.tgz", + "from": "mongo-object@0.0.1" + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "from": "optimist@>=0.6.1 <0.7.0" + }, + "regenerator-runtime": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.9.5.tgz", + "from": "regenerator-runtime@>=0.9.5 <0.10.0" + }, + "repeat-string": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.5.4.tgz", + "from": "repeat-string@>=1.5.2 <2.0.0" + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "from": "right-align@>=0.1.1 <0.2.0" + }, + "simpl-schema": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/simpl-schema/-/simpl-schema-0.0.3.tgz", + "from": "simpl-schema@0.0.3" + }, + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "from": "source-map@>=0.4.4 <0.5.0" + }, + "uglify-js": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.3.tgz", + "from": "uglify-js@>=2.6.0 <3.0.0", "dependencies": { - "lodash": { - "version": "4.6.1" + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "from": "async@>=0.2.6 <0.3.0" + }, + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "from": "source-map@>=0.5.1 <0.6.0" } } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "from": "uglify-to-browserify@>=1.0.0 <1.1.0" + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "from": "underscore@>=1.8.3 <2.0.0" + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "from": "window-size@0.1.0" + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "from": "wordwrap@>=0.0.2 <0.1.0" + }, + "yargs": { + "version": "3.10.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "from": "yargs@>=3.10.0 <3.11.0" } } } diff --git a/.versions b/.versions new file mode 100644 index 0000000..be6d4a6 --- /dev/null +++ b/.versions @@ -0,0 +1,15 @@ +aldeed:simple-schema@2.0.0-rc.1 +babel-compiler@6.5.2 +babel-runtime@0.1.7 +base64@1.0.9 +check@1.1.0 +ecmascript@0.4.1 +ecmascript-runtime@0.2.9 +ejson@1.0.12 +mdg:validation-error@0.5.1 +meteor@1.1.16 +modules@0.5.2 +modules-runtime@0.6.5 +promise@0.6.6 +tracker@1.0.15 +underscore@1.0.9 diff --git a/CHANGELOG.md b/CHANGELOG.md index 77ff0e4..a0f8250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -88,35 +88,43 @@ A simple, reactive schema validation smart package for Meteor. ### 2.0.0 -- You must now `import { SimpleSchema } from 'meteor/aldeed:simple-schema';` wherever you use `SimpleSchema` -- `SimpleSchemaValidationContext` is now `SimpleSchema.ValidationContext` -- If you prefer keys to be optional by default, you can pass `requiredByDefault: false` as a SimpleSchema constructor option and then use `required: true` for each key that should be required. -- Implicit keys are no longer added for you. You must define every key. The one exception is array items when using shorthand (see next change) -- You can now use shorthand for keys when your schema is extra super duper simple. See "Shorthand Syntax" in the README. -- `validationContext.resetValidation()` is renamed to `validationContext.reset()` -- `validationContext.removeInvalidKeys()` has been removed since it is effectively the same as `validationContext.reset()`. -- Removed `validationContext.getErrorObject()` since the `ValidationError` thrown by `simpleSchema.validate()` fills this need. -- A `SimpleSchema` can no longer be used with the `check` package `check` function. Instead, use `simpleSchema.validate()`, which throws a more helpful ValidationError and satisfies `audit-argument-checks`. -- `validationContext.validateOne()` is removed and instead you can pass a `keys` array as an option to `validationContext.validate()` -- `invalidKeys()` is changed to `validationErrors()`, `_invalidKeys` is changed to `_validationErrors`, and `addInvalidKeys` is changed to `addValidationErrors` -- The error objects returned by `validationErrors()` and attached to thrown `ValidationError` objects now have additional properties that help describe the particular error. -- `decimal` is no longer a valid schema option. Instead, decimal/float is the default, and you can set the `type` to `SimpleSchema.Integer` to specify that you want only integers. -- In custom validation functions, you can now do `this.addValidationErrors(errors)`, where errors is an array of error objects. This allows you to add errors for keys other than the one you are validating. -- The `SimpleSchema.ErrorTypes` object now contains constants for all of the built-in error type strings. -- If you returned the error strings "expectedString", "expectedNumber", "expectedBoolean", "expectedArray", "expectedObject", or "expectedConstructor" prior to 2.0, you should now return SimpleSchema.ErrorTypes.EXPECTED_TYPE instead. -- Error message changes: - - SimpleSchema now uses `MessageBox` to manage validation error messages. Among other things, this means that placeholder text should now use handlebars syntax, `{{label}}` instead of `[label]` - - In the message context (for placeholders), `[type]` is now `{{dataType}}` and `[key]` is now `{{name}}`, though `key` still works for now. - - `SimpleSchema.messages` is removed. You can call `MessageBox.defaults` directly instead. - - `SimpleSchema.prototype.messages` is removed. You can call `simpleSchemaInstance.messageBox.messages()` instead, and you must pass in the messages in the format required by that package. - - `SimpleSchema._globalMessages` and `SimpleSchema._depsGlobalMessages` internal properties are removed. - - If you have custom regEx messages, you now need to do this by overriding the `regEx` messages function. -- SimpleSchema constructor no longer accepts an array to merge schemas. Instead, pass a single schema and then use `schema.extend(otherSchema)` to extend it. -- When validating, objects with a custom prototype were previously treated as blackbox objects. Now they are validated by default, so you must add `blackbox: true` to your schema if you want to keep the old behavior. The exceptions are Date objects and TypedArray objects, which are always treated as blackbox. -- You can now specify multiple combinations of type and certain other validation criteria for a single field. This is done using `SimpleSchema.oneOf`. Refer to the documentation for details. -- Cleaning an object no longer mutates it. However, you can pass `mutate: true` option to improve performance if you don't mind the object being mutated. -- You can now add custom whole-document validators, either globally or for one schema. See `SimpleSchema.addDocValidator` and `simpleSchemaInstance#addDocValidator`. -- If you pass an array of objects to `simpleSchemaInstance#validate`, all objects will be validated, and an error will be thrown for the first invalid object. +- SimpleSchema is now primarily an NPM package located here: https://github.com/aldeed/node-simple-schema The Meteor package will continue to be published and will make Meteor-specific adjustments as necessary, but you should attempt to migrate to using the NPM package directly as soon as you can. +- You should now `import { SimpleSchema } from 'meteor/aldeed:simple-schema'` (Meteor package) or `import SimpleSchema from 'simpl-schema'` (NPM package) in every file where you use `SimpleSchema`. +- Renamed: + - `SimpleSchemaValidationContext` -> `SimpleSchema.ValidationContext` + - `validationContext.resetValidation()` -> `validationContext.reset()` + - `validationContext.invalidKeys()` -> `validationContext.validationErrors()` + - `validationContext.addInvalidKeys()` -> `validationContext.addValidationErrors()` +- Removed: + - `validationContext.removeInvalidKeys()`: It was effectively the same as `validationContext.reset()`. + - `validationContext.getErrorObject()`: The `ValidationError` thrown by `simpleSchema.validate()` fills this need. + - `validationContext.validateOne()`: Instead you can pass a `keys` array as an option to `validationContext.validate()`. +- Other Breaking Changes: + - `decimal` is no longer a valid schema option. Instead, decimal/float is the default, and you can set the `type` to `SimpleSchema.Integer` to specify that you want only integers. + - Error message changes: + - SimpleSchema now uses `MessageBox` to manage validation error messages. Among other things, this means that placeholder text should now use handlebars syntax, `{{label}}` instead of `[label]` + - In the message context (for placeholders), `[type]` is now `{{dataType}}` and `[key]` is now `{{name}}`, though `key` still works for now. + - `SimpleSchema.messages` is removed. You can call `MessageBox.defaults` directly instead. + - `SimpleSchema.prototype.messages` is removed. You can call `simpleSchemaInstance.messageBox.messages()` instead, and you must pass in the messages in the format required by that package. + - `SimpleSchema._globalMessages` and `SimpleSchema._depsGlobalMessages` internal properties are removed. + - If you have custom regEx messages, you now need to do this by overriding the `regEx` messages function. + - SimpleSchema constructor no longer accepts an array to merge schemas. Instead, pass a single schema and then use `schema.extend(otherSchema)` to extend it. + - When validating, objects with a custom prototype were previously treated as blackbox objects. Now they are validated by default, so you must add `blackbox: true` to your schema if you want to keep the old behavior. The exceptions are Date objects and TypedArray objects, which are always treated as blackbox. + - The internal storage of your schema object has changed, so calling `simpleSchemaInstance.schema()` will now return an object that looks different. One of the differences is that subschemas are not merged into it. To get an object with subschemas merged, you can call `simpleSchemaInstance.mergedSchema()`. However, there are still differences due to how groups/`oneOf` is handled internally. + - Implicit keys are no longer added for you. You must define every key. + - A `SimpleSchema` can no longer be used with the `check` package `check` function. Instead, use `simpleSchema.validate()`, which throws a more helpful ValidationError and satisfies `audit-argument-checks`. + - If you have custom validation that returns the error strings "expectedString", "expectedNumber", "expectedBoolean", "expectedArray", "expectedObject", or "expectedConstructor", you should now return `{ type: SimpleSchema.ErrorTypes.EXPECTED_TYPE, dataType: 'String' }` instead, where `dataType` is "Boolean", "String", "Object", "Array", "Integer", or "Number". + - Cleaning an object no longer mutates it. However, you can pass `mutate: true` option to improve performance if you don't mind the object being mutated. + - Reactivity of labels and error messages in client code is no longer automatic. When creating your `SimpleSchema` instance, pass `{ tracker: Tracker }` in the options to enable Tracker reactivity. +- New Features + - If you prefer keys to be optional by default, you can pass `requiredByDefault: false` as a SimpleSchema constructor option and then use `required: true` for each key that should be required. + - You can now use shorthand for keys when your schema is extra super duper simple. See https://github.com/aldeed/node-simple-schema#shorthand-definitions + - The error objects returned by `validationErrors()` and attached to thrown `ValidationError` objects now have additional properties that help describe the particular error. + - In custom validation functions, you can now do `this.addValidationErrors(errors)`, where errors is an array of error objects. This allows you to add errors for keys other than the one you are validating. + - The `SimpleSchema.ErrorTypes` object now contains constants for all of the built-in error type strings. + - You can now specify multiple combinations of type and certain other validation criteria for a single field. This is done using `SimpleSchema.oneOf`. Refer to https://github.com/aldeed/node-simple-schema#multiple-definitions-for-one-key + - You can now add custom whole-document validators, either globally or for one schema. See `SimpleSchema.addDocValidator` and `simpleSchemaInstance#addDocValidator`. + - If you pass an array of objects to `simpleSchemaInstance#validate`, all objects will be validated, and an error will be thrown for the first invalid object. ### 1.4.0 diff --git a/package.js b/package.js index d856e3d..cb9c296 100644 --- a/package.js +++ b/package.js @@ -6,7 +6,7 @@ Package.describe({ }); Npm.depends({ - 'simpl-schema': '0.0.1' + 'simpl-schema': '0.0.3' }); Package.onUse(function(api) { @@ -19,6 +19,9 @@ Package.onUse(function(api) { ]); api.mainModule('main.js'); + + // Need this for backwards compatibility for now + api.export('SimpleSchema'); }); // Package.onTest(function(api) {