gina 0.1.1-alpha.160 → 0.1.1-alpha.162
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/AUTHORS +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/LICENSE +0 -0
- package/framework/v0.1.1-alpha.162/VERSION +1 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/html/nolayout.html +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/html/static.html +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/img/android-chrome-192x192.png +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/img/android-chrome-512x512.png +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/img/apple-touch-icon.png +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/img/favicon-16x16.png +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/img/favicon-32x32.png +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/img/favicon.ico +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/gina.js +383 -284
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/gina.min.css +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/gina.min.css.map +0 -0
- package/framework/v0.1.1-alpha.162/core/asset/plugin/dist/gina.min.js +741 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/gina.min.js.map +5 -5
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/gina.onload.min.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/gina.onload.min.js.map +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/toolbar/css/toolbar-min.css +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/toolbar/css/toolbar.css +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/toolbar/css/toolbar.css.map +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/toolbar/js/jquery-3.1.0.min.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/toolbar/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/dist/toolbar/toolbar.html +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/readme.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/asset/plugin/uuid.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/config.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/lib/connector.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/lib/connector.v2.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/lib/connector.v3.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/lib/connector.v4.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/lib/n1ql.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/lib/session-store.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/lib/session-store.v3.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/connectors/couchbase/lib/session-store.v4.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/controller/controller.framework.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/controller/controller.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/controller/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/.travis.yml +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/LICENSE +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/deps/encoding/encoding.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/lib/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/lib/types/multipart.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/lib/types/urlencoded.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/lib/utils.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/busboy/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/dev/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/dev/lib/class.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/dev/lib/factory.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/dev/lib/tools.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/gna.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/currency.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/dist/language/en.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/dist/language/fr.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/dist/region/en.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/dist/region/fr.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/src/make.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/src/resources/currency.csv +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/src/resources/region.csv +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/locales/src/resources/region.mapping.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/mime.types +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/model/entity.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/model/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/model/template/entityFactory.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/model/template/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/file/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/file/build.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/file/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/intl/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/intl/build.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/intl/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/intl/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/storage/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/storage/build.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/storage/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/storage/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/validator/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/validator/build.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/validator/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/validator/src/form-validator.js +383 -284
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/plugins/lib/validator/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/router.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/server.express.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/server.isaac.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/server.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/status.codes +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle/config/app.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle/config/routing.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle/config/settings.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle/config/settings.server.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle/config/templates.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle/controllers/controller.content.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle/controllers/setup.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_public/css/default.css +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_public/readme.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_templates/html/content/homepage.html +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/boilerplate/bundle_templates/html/layouts/main.html +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/command/gina.bat.tpl +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/command/gina.tpl +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/conf/env.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/conf/manifest.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/conf/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/conf/settings.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/conf/statics.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/conf/templates.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/error/client/json/401.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/error/client/json/403.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/error/client/json/404.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/error/server/html/50x.html +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/error/server/json/500.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/error/server/json/503.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/core/template/extensions/logger/config.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/console.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/context.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/dateFormat.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/json/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/json/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/json/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/path.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/plugins/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/plugins/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/plugins/src/api-error.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/plugins/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/prototypes.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/task.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/helpers/text.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/archiver/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/archiver/build.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/archiver/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/archiver/src/dep/jszip.min.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/archiver/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/aliases.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/add.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/arguments.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/copy.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/cp.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/help.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/help.txt +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/list.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/remove.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/rename.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/restart.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/rm.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/start.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/status.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/bundle/stop.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/add.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/get.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/help.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/help.txt +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/link-dev.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/list.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/remove.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/rm.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/set.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/unset.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/env/use.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/build.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/dot.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/get.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/help.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/help.txt +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/init.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/link-node-modules.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/link.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/msg.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/open.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/restart.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/set.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/start.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/status.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/stop.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/tail.js +1 -1
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/update.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/framework/version.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/gina-dev.1.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/gina-framework.1.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/gina.1.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/helper.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/msg.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/port/help.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/port/help.txt +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/port/inc/scan.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/port/list.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/port/reset.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/port/set.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/add.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/arguments.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/build.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/help.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/help.txt +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/import.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/list.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/move.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/remove.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/rename.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/restart.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/rm.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/start.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/status.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/project/stop.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/protocol/help.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/protocol/help.txt +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/protocol/list.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/protocol/set.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/scope/help.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/scope/help.txt +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/scope/link-local.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/scope/list.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/scope/remove.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/scope/rm.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/scope/set.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/scope/unset.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/scope/use.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cmd/view/add.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/collection/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/collection/build.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/collection/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/collection/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/config.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cron/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cron/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/cron/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/generator/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/inherits/LICENSE +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/inherits/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/inherits/example/inheriting_eventemitter.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/inherits/example/protected_inheritance.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/inherits/example/simple_inheritance.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/inherits/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/inherits/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/src/containers/default/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/src/containers/file/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/src/containers/mq/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/src/containers/mq/listener.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/src/containers/mq/speaker.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/src/helper.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/logger/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/math/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/merge/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/merge/example/merge.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/merge/example/merge_2_literal objects.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/merge/example/merge_and_preserve_first.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/merge/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/merge/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/model.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/proc.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/routing/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/routing/build.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/routing/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/routing/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/session-store.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/shell.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/swig-filters/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/swig-filters/package.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/swig-filters/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/url/README.md +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/url/index.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/url/mocks.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/url/routing.json +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/url/test.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/lib/validator.js +0 -0
- package/framework/{v0.1.1-alpha.160 → v0.1.1-alpha.162}/package.json +0 -0
- package/package.json +2 -2
- package/script/post_publish.js +2 -1
- package/script/prepare_version.js +54 -3
- package/framework/v0.1.1-alpha.160/VERSION +0 -1
- package/framework/v0.1.1-alpha.160/core/asset/plugin/dist/gina.js.map +0 -56
- package/framework/v0.1.1-alpha.160/core/asset/plugin/dist/gina.min.js +0 -739
|
@@ -18,14 +18,14 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
18
18
|
|
|
19
19
|
// if (isGFFCtx && !$fields )
|
|
20
20
|
// throw new Error('No `Validator` instance found.\nTry:\nvar FormValidator = require("gina/validator"):\nvar formValidator = new FormValidator(...);')
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
var merge = (isGFFCtx) ? require('utils/merge') : require('../../../../../lib/merge');
|
|
23
23
|
var helpers = (isGFFCtx) ? {} : require('../../../../../helpers');
|
|
24
24
|
var dateFormat = (isGFFCtx) ? require('helpers/dateFormat') : helpers.dateFormat;
|
|
25
25
|
var routing = (isGFFCtx) ? require('utils/routing') : require('../../../../../lib/routing');
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
var hasUserValidators = function() {
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
var _hasUserValidators = false, formsContext = null;
|
|
30
30
|
// backend validation check
|
|
31
31
|
if (!isGFFCtx) {
|
|
@@ -38,7 +38,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
38
38
|
_hasUserValidators = true
|
|
39
39
|
}
|
|
40
40
|
return _hasUserValidators;
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
/**@js_externs local*/
|
|
43
43
|
var local = {
|
|
44
44
|
'errors': {},
|
|
@@ -87,12 +87,12 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
87
87
|
self = merge( JSON.clone(data), self );
|
|
88
88
|
local.data = merge( JSON.clone(data), local.data);
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
var getElementByName = function($form, name) { // frontend only
|
|
92
92
|
var $foundElement = null;
|
|
93
93
|
for (let f in fieldsSet) {
|
|
94
94
|
if (fieldsSet[f].name !== name) continue;
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
$foundElement = new DOMParser()
|
|
97
97
|
.parseFromString($form.innerHTML , 'text/html')
|
|
98
98
|
.getElementById( fieldsSet[f].id );
|
|
@@ -100,16 +100,16 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
100
100
|
}
|
|
101
101
|
if ($foundElement)
|
|
102
102
|
return $foundElement;
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
throw new Error('Field `'+ name +'` not found in fieldsSet');
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
/**
|
|
108
108
|
* bufferToString - Convert Buffer to String
|
|
109
109
|
* Will apply `Utf8Array` to `String`
|
|
110
|
-
* @param {array} arrayBuffer
|
|
110
|
+
* @param {array} arrayBuffer
|
|
111
111
|
*/
|
|
112
|
-
var bufferToString = function(arrayBuffer) {
|
|
112
|
+
var bufferToString = function(arrayBuffer) {
|
|
113
113
|
var out = null
|
|
114
114
|
, i = null
|
|
115
115
|
, len = null
|
|
@@ -122,7 +122,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
122
122
|
i = 0;
|
|
123
123
|
while(i < len) {
|
|
124
124
|
c = arrayBuffer[i++];
|
|
125
|
-
switch (c >> 4) {
|
|
125
|
+
switch (c >> 4) {
|
|
126
126
|
case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7:
|
|
127
127
|
// 0xxxxxxx
|
|
128
128
|
out += String.fromCharCode(c);
|
|
@@ -145,22 +145,40 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
145
145
|
|
|
146
146
|
return out;
|
|
147
147
|
};
|
|
148
|
-
|
|
148
|
+
|
|
149
|
+
var compileError = function(error, data) {
|
|
150
|
+
var varArr = error.match(/\{\{([^{{}}]+)\}\}/g );
|
|
151
|
+
for (let v=0, vLen=varArr.length; v<vLen; v++) {
|
|
152
|
+
let localValue = varArr[v]
|
|
153
|
+
.replace(/\[/g, '["')
|
|
154
|
+
.replace(/\]/g, '"]')
|
|
155
|
+
.replace(/\{|\}/g, '')
|
|
156
|
+
.trim();
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
localValue = eval('data.'+ localValue).replace(/^\"|\"$/g, '');
|
|
160
|
+
error = error.replace( new RegExp( varArr[v].replace(/\{|\[|\]|\}/g, '\\$&') , 'g'), localValue);
|
|
161
|
+
} catch(e) {}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return error
|
|
165
|
+
};
|
|
166
|
+
|
|
149
167
|
// TODO - One method for the front, and one for the server
|
|
150
168
|
var queryFromFrontend = function(options, errorMessage) {
|
|
151
|
-
var errors = self[this['name']]['errors'] || {};
|
|
169
|
+
var errors = self[this['name']]['errors'] || {};
|
|
152
170
|
var id = this.target.id || this.target.getAttribute('id');
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
// stop if
|
|
156
|
-
// - previous error detected
|
|
157
|
-
if ( !self.isValid() ) {
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
// stop if
|
|
174
|
+
// - previous error detected
|
|
175
|
+
if ( !self.isValid() ) {
|
|
158
176
|
console.debug('stopping on errors ...');
|
|
159
177
|
triggerEvent(gina, this.target, 'asyncCompleted.' + id, self[this['name']]);
|
|
160
178
|
//return self[this.name];
|
|
161
179
|
return;
|
|
162
180
|
}
|
|
163
|
-
|
|
181
|
+
|
|
164
182
|
var testedValue = this.target.dataset.ginaFormValidatorTestedValue;
|
|
165
183
|
console.debug('[ '+ this['name'] +' ]', 'TESTED VALUE -> ' + this.value +' vs '+ testedValue);
|
|
166
184
|
var _evt = 'asyncCompleted.' + id;
|
|
@@ -170,53 +188,54 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
170
188
|
&& typeof(gina.validator.$forms[currentFormId]) != 'undefined'
|
|
171
189
|
&& typeof(gina.validator.$forms[currentFormId].cachedErrors) != 'undefined'
|
|
172
190
|
)
|
|
173
|
-
? gina.validator.$forms[currentFormId].cachedErrors
|
|
191
|
+
? gina.validator.$forms[currentFormId].cachedErrors
|
|
174
192
|
: null;
|
|
175
193
|
if ( !testedValue || typeof(testedValue) == 'undefined' || testedValue !== this.value ) {
|
|
176
194
|
this.target.dataset.ginaFormValidatorTestedValue = this.value;
|
|
177
195
|
// remove cachedErrors
|
|
178
|
-
if (
|
|
179
|
-
cachedErrors
|
|
196
|
+
if (
|
|
197
|
+
cachedErrors
|
|
180
198
|
&& typeof(cachedErrors[this.name]) != 'undefined'
|
|
181
199
|
&& typeof(cachedErrors[this.name].query) != 'undefined'
|
|
182
200
|
) {
|
|
183
201
|
delete cachedErrors[this.name].query;
|
|
184
|
-
if (
|
|
202
|
+
if (
|
|
185
203
|
typeof(gina.validator.$forms[currentFormId]) != 'undefined'
|
|
186
204
|
&&
|
|
187
205
|
typeof(gina.validator.$forms[currentFormId].errors) != 'undefined'
|
|
188
206
|
) {
|
|
189
207
|
delete gina.validator.$forms[currentFormId].errors.query;
|
|
190
208
|
}
|
|
191
|
-
|
|
209
|
+
|
|
192
210
|
}
|
|
193
211
|
} else if (testedValue === this.value) {
|
|
194
212
|
// not resending to backend, but in case of cached errors, re display same error message
|
|
195
|
-
var hasCachedErrors = false;
|
|
196
|
-
if (
|
|
197
|
-
cachedErrors
|
|
213
|
+
var hasCachedErrors = false;
|
|
214
|
+
if (
|
|
215
|
+
cachedErrors
|
|
198
216
|
&& typeof(cachedErrors[this.name]) != 'undefined'
|
|
199
|
-
&& typeof(cachedErrors[this.name].query) != 'undefined'
|
|
200
|
-
&& typeof(cachedErrors[this.name].query[this.value]) != 'undefined'
|
|
217
|
+
&& typeof(cachedErrors[this.name].query) != 'undefined'
|
|
218
|
+
&& typeof(cachedErrors[this.name].query[this.value]) != 'undefined'
|
|
201
219
|
) {
|
|
202
220
|
this.error = errorMessage = cachedErrors[this.name].query[this.value].slice(0);
|
|
203
221
|
hasCachedErrors = true;
|
|
204
222
|
}
|
|
205
223
|
errors['query'] = replace( this.error || errorMessage || local.errorLabels['query'], this);
|
|
206
|
-
|
|
224
|
+
console.debug('[2] potential cached error detected !! ', hasCachedErrors, cachedErrors, ' vs ', errors['query']);
|
|
225
|
+
|
|
207
226
|
if (hasCachedErrors) {
|
|
208
227
|
this['errors'] = errors;
|
|
209
228
|
this.valid = false;
|
|
210
229
|
}
|
|
211
|
-
// Do not remove this test
|
|
230
|
+
// Do not remove this test
|
|
212
231
|
if ( typeof( gina.events[_evt]) != 'undefined' ) {
|
|
213
232
|
triggerEvent(gina, this.target, _evt, self[this['name']]);
|
|
214
|
-
}
|
|
215
|
-
|
|
233
|
+
}
|
|
234
|
+
|
|
216
235
|
return self[this.name];
|
|
217
236
|
}
|
|
218
237
|
//console.debug('Did not return !!!');
|
|
219
|
-
|
|
238
|
+
|
|
220
239
|
var xhr = null, _this = this;
|
|
221
240
|
// setting up AJAX
|
|
222
241
|
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
|
|
@@ -231,17 +250,17 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
231
250
|
catch (e) {}
|
|
232
251
|
}
|
|
233
252
|
}
|
|
234
|
-
|
|
253
|
+
|
|
235
254
|
// forcing to sync mode
|
|
236
|
-
var queryOptions = { isSynchrone: false, headers: {} };
|
|
255
|
+
var queryOptions = { isSynchrone: false, headers: {} };
|
|
237
256
|
var queryData = options.data || null, strData = null;
|
|
238
257
|
var isInlineValidation = (/^true$/i.test(this.target.form.dataset.ginaFormLiveCheckEnabled)) ? true : false; // TRUE if liveCheckEnabled
|
|
239
|
-
|
|
258
|
+
|
|
240
259
|
// replace placeholders by field values
|
|
241
260
|
strData = JSON.stringify(queryData);
|
|
242
261
|
if ( /\$/.test(strData) ) {
|
|
243
262
|
var variables = strData.match(/\$[-_\[\]a-z 0-9]+/g) || [];
|
|
244
|
-
var value = null, key = null;
|
|
263
|
+
var value = null, key = null;
|
|
245
264
|
for (let i = 0, len = variables.length; i < len; i++) {
|
|
246
265
|
key = variables[i].replace(/\$/g, '');
|
|
247
266
|
re = new RegExp("\\"+ variables[i].replace(/\[|\]/g, '\\$&'), "g");
|
|
@@ -250,26 +269,26 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
250
269
|
// Retrieving live value instead of using fieldsSet.value
|
|
251
270
|
value = getElementByName(this.target.form, key).value;
|
|
252
271
|
}
|
|
253
|
-
|
|
272
|
+
|
|
254
273
|
strData = strData.replace( re, value );
|
|
255
274
|
}
|
|
256
275
|
}
|
|
257
276
|
// cleanup before sending
|
|
258
|
-
queryData = strData.replace(/\\"/g, '');
|
|
277
|
+
queryData = strData.replace(/\\"/g, '');
|
|
259
278
|
// TODO - support regexp for validIf
|
|
260
279
|
var validIf = ( typeof(options.validIf) == 'undefined' ) ? true : options.validIf;
|
|
261
|
-
|
|
280
|
+
|
|
262
281
|
queryOptions = merge(queryOptions, options, xhrOptions);
|
|
263
282
|
delete queryOptions.data;
|
|
264
283
|
delete queryOptions.validIf;
|
|
265
|
-
|
|
284
|
+
|
|
266
285
|
var enctype = queryOptions.headers['Content-Type'];
|
|
267
286
|
var result = null
|
|
268
287
|
, $target = this.target
|
|
269
288
|
//, id = $target.getAttribute('id')
|
|
270
289
|
;
|
|
271
290
|
id = $target.getAttribute('id')
|
|
272
|
-
|
|
291
|
+
|
|
273
292
|
// checking url
|
|
274
293
|
if (!/^http/.test(queryOptions.url) && /\@/.test(queryOptions.url) ) {
|
|
275
294
|
try {
|
|
@@ -279,7 +298,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
279
298
|
throw routingError;
|
|
280
299
|
}
|
|
281
300
|
}
|
|
282
|
-
|
|
301
|
+
|
|
283
302
|
if ( queryOptions.withCredentials ) {
|
|
284
303
|
if ('withCredentials' in xhr) {
|
|
285
304
|
// XHR for Chrome/Firefox/Opera/Safari.
|
|
@@ -295,7 +314,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
295
314
|
// xhr.open(queryOptions.method, queryOptions.url, queryOptions.isSynchrone);
|
|
296
315
|
// } else {
|
|
297
316
|
xhr.open(queryOptions.method, queryOptions.url);
|
|
298
|
-
// }
|
|
317
|
+
// }
|
|
299
318
|
} else {
|
|
300
319
|
// CORS not supported.
|
|
301
320
|
xhr = null;
|
|
@@ -303,10 +322,10 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
303
322
|
//triggerEvent(gina, $target, 'error.' + id, result);
|
|
304
323
|
throw new Error(result);
|
|
305
324
|
}
|
|
306
|
-
|
|
325
|
+
|
|
307
326
|
if ( typeof(queryOptions.responseType) != 'undefined' ) {
|
|
308
327
|
/**
|
|
309
|
-
* Note: We expect to remove support for synchronous use of XMLHTTPRequest() during page unloads in Chrome in version 88,
|
|
328
|
+
* Note: We expect to remove support for synchronous use of XMLHTTPRequest() during page unloads in Chrome in version 88,
|
|
310
329
|
* scheduled to ship in January 2021.
|
|
311
330
|
* The XMLHttpRequest2 spec was recently changed to prohibit sending a synchronous request when XMLHttpRequest.responseType
|
|
312
331
|
*/
|
|
@@ -323,132 +342,212 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
323
342
|
xhr.open(queryOptions.method, queryOptions.url)
|
|
324
343
|
}
|
|
325
344
|
}
|
|
326
|
-
|
|
345
|
+
|
|
327
346
|
// setting up headers - all but Content-Type ; it will be set right before .send() is called
|
|
328
347
|
for (var hearder in queryOptions.headers) {
|
|
329
348
|
if (hearder == 'Content-Type' && typeof (enctype) != 'undefined' && enctype != null && enctype != '')
|
|
330
349
|
continue;
|
|
331
350
|
|
|
332
351
|
xhr.setRequestHeader(hearder, queryOptions.headers[hearder]);
|
|
333
|
-
}
|
|
352
|
+
}
|
|
334
353
|
if (typeof (enctype) != 'undefined' && enctype != null && enctype != '') {
|
|
335
354
|
xhr.setRequestHeader('Content-Type', enctype);
|
|
336
355
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
356
|
+
|
|
357
|
+
var onResult = function(result) {
|
|
358
|
+
|
|
359
|
+
_this.value = local['data'][_this.name] = (_this.value) ? _this.value.toLowerCase() : _this.value;
|
|
360
|
+
|
|
361
|
+
var isValid = result.isValid || false;
|
|
362
|
+
if (validIf != isValid) {
|
|
363
|
+
isValid = false;
|
|
364
|
+
} else {
|
|
365
|
+
isValid = true;
|
|
366
|
+
}
|
|
367
|
+
self[_this['name']].valid = isValid;
|
|
368
|
+
var errors = self[_this['name']]['errors'] || {};
|
|
369
|
+
|
|
370
|
+
var errorFields = ( typeof(result.error) != 'undefined' && typeof(result.fields) != 'undefined' ) ? result.fields : {};
|
|
371
|
+
|
|
372
|
+
if (errorFields.count() > 0 && !isValid || !isValid) {
|
|
373
|
+
|
|
374
|
+
if (!isValid) {
|
|
375
|
+
var systemError = null;
|
|
376
|
+
if ( typeof(errorFields[_this.name]) != 'undefined') {
|
|
377
|
+
|
|
378
|
+
// compiling against rules[field].query.data
|
|
379
|
+
local.errorLabels['query'] = compileError(errorFields[_this.name], options.data);
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
} else if ( typeof(result.error) != 'undefined' && /^5/.test(result.status) ) {
|
|
383
|
+
// system error
|
|
384
|
+
systemError = result.error;
|
|
351
385
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
386
|
+
// Fixed on 2023-01-10
|
|
387
|
+
// We want `local.errorLabels['query']` before the generic|user defined `rule` error
|
|
388
|
+
errors['query'] = replace(systemError || _this['error'] || local.errorLabels['query'] || options['error'], _this);
|
|
389
|
+
console.debug('[1] query error detected !! ', result);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if ( !errors['query'] && _this.value == '' ) {
|
|
393
|
+
isValid = true;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// if error tagged by a previous validation, remove it when isValid == true
|
|
398
|
+
if ( isValid && typeof(errors['query']) != 'undefined' ) {
|
|
399
|
+
delete errors['query'];
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// To handle multiple errors from backend
|
|
403
|
+
// for (var f in errorFields.length) {
|
|
404
|
+
// if ( !errors['query'] && _this.value == '' ) {
|
|
405
|
+
// isValid = true;
|
|
406
|
+
// }
|
|
407
|
+
|
|
408
|
+
// if (!isValid) {
|
|
409
|
+
// errors['query'] = replace(_this['error'] || local.errorLabels['query'], _this)
|
|
410
|
+
// }
|
|
411
|
+
// // if error tagged by a previous validation, remove it when isValid == true
|
|
412
|
+
// else if ( isValid && typeof(errors['query']) != 'undefined' ) {
|
|
413
|
+
// delete errors['query'];
|
|
414
|
+
// }
|
|
415
|
+
// }
|
|
416
|
+
|
|
417
|
+
_this.valid = isValid;
|
|
418
|
+
var cachedErrors = gina.validator.$forms[_this.target.form.getAttribute('id')].cachedErrors || {};
|
|
419
|
+
if ( errors.count() > 0 ) {
|
|
420
|
+
|
|
421
|
+
_this['errors'] = errors;
|
|
422
|
+
if ( typeof(self[_this['name']].errors) == 'undefined' ) {
|
|
423
|
+
self[_this['name']].errors = {};
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
self[_this['name']].errors = merge(self[_this['name']].errors, errors);
|
|
427
|
+
|
|
428
|
+
if ( typeof(errors.query) != 'undefined' && errors.query ) {
|
|
429
|
+
|
|
430
|
+
if ( typeof(cachedErrors[_this.name]) == 'undefined' ) {
|
|
431
|
+
cachedErrors[_this.name] = {}
|
|
375
432
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
if ( isValid && typeof(errors['query']) != 'undefined' ) {
|
|
379
|
-
delete errors['query'];
|
|
433
|
+
if ( typeof(cachedErrors[_this.name].query) == 'undefined' ) {
|
|
434
|
+
cachedErrors[_this.name].query = {}
|
|
380
435
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
436
|
+
|
|
437
|
+
cachedErrors[_this.name].query[_this.value] = errors.query.slice(0);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
var errClass = _this.target.getAttribute('data-gina-form-errors');
|
|
441
|
+
if ( !/query/.test(errClass) ) {
|
|
442
|
+
if ( !errClass || errClass =='' ) {
|
|
443
|
+
errClass = 'query'
|
|
444
|
+
} else {
|
|
445
|
+
errClass +=' query'
|
|
446
|
+
}
|
|
447
|
+
_this.target.setAttribute('data-gina-form-errors', errClass);
|
|
448
|
+
}
|
|
449
|
+
} else if (
|
|
450
|
+
typeof(cachedErrors[_this.name]) != 'undefined'
|
|
451
|
+
&& typeof(cachedErrors[_this.name].query) != 'undefined'
|
|
452
|
+
&& typeof(cachedErrors[_this.name].query[_this.value]) != 'undefined'
|
|
453
|
+
) {
|
|
454
|
+
delete cachedErrors[_this.name].query[_this.value];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
var id = _this.target.id || _this.target.getAttribute('id');
|
|
458
|
+
console.debug('prematurely completed event `'+ 'asyncCompleted.' + id +'`');
|
|
459
|
+
return triggerEvent(gina, _this.target, 'asyncCompleted.' + id, self[_this['name']]);
|
|
460
|
+
} // EO onResult
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
if (xhr) {
|
|
464
|
+
|
|
465
|
+
xhr.onerror = function(event, err) {
|
|
466
|
+
|
|
467
|
+
var error = 'Transaction error: might be due to the server CORS settings.\nPlease, check the console for more details.';
|
|
468
|
+
var result = {
|
|
469
|
+
'status': xhr.status, //500,
|
|
470
|
+
'error' : error
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
console.debug('query error [2] detected !! ', err, error);
|
|
474
|
+
isOnException = true;
|
|
475
|
+
result = this.responseText;
|
|
476
|
+
var contentType = this.getResponseHeader("Content-Type");
|
|
477
|
+
if ( /\/json/.test( contentType ) ) {
|
|
478
|
+
result = JSON.parse(this.responseText);
|
|
479
|
+
|
|
480
|
+
if ( typeof(result.status) == 'undefined' )
|
|
481
|
+
result.status = this.status;
|
|
482
|
+
|
|
483
|
+
//triggerEvent(gina, $target, 'success.' + id, result);
|
|
484
|
+
return onResult(result)
|
|
485
|
+
} else {
|
|
486
|
+
result = { 'status': xhr.status, 'message': '' };
|
|
487
|
+
if ( /^(\{|\[)/.test( xhr.responseText ) ) {
|
|
488
|
+
try {
|
|
489
|
+
result = merge( result, JSON.parse(xhr.responseText) );
|
|
490
|
+
} catch (err) {
|
|
491
|
+
result = merge(result, err);
|
|
426
492
|
}
|
|
427
|
-
_this.target.setAttribute('data-gina-form-errors', errClass);
|
|
428
493
|
}
|
|
429
|
-
|
|
430
|
-
typeof(cachedErrors[_this.name]) != 'undefined'
|
|
431
|
-
&& typeof(cachedErrors[_this.name].query) != 'undefined'
|
|
432
|
-
&& typeof(cachedErrors[_this.name].query[_this.value]) != 'undefined'
|
|
433
|
-
) {
|
|
434
|
-
delete cachedErrors[_this.name].query[_this.value];
|
|
494
|
+
return onResult(result);
|
|
435
495
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
496
|
+
|
|
497
|
+
}// Eo xhr.onerror
|
|
498
|
+
|
|
499
|
+
// catching ready state cb
|
|
500
|
+
// var isOnException = false;
|
|
501
|
+
// xhr.onreadystatechange = function (event) {
|
|
502
|
+
// if (xhr.readyState == 4) {
|
|
503
|
+
|
|
504
|
+
// console.warn(xhr.status, xhr.responseText);
|
|
505
|
+
|
|
506
|
+
// if (xhr.status === 200) {
|
|
507
|
+
// console.log("-> Success [3]" + xhr.responseText);
|
|
508
|
+
// try {
|
|
509
|
+
// result = this.responseText;
|
|
510
|
+
// var contentType = this.getResponseHeader("Content-Type");
|
|
511
|
+
// if ( /\/json/.test( contentType ) ) {
|
|
512
|
+
// result = JSON.parse(this.responseText);
|
|
513
|
+
|
|
514
|
+
// if ( typeof(result.status) == 'undefined' )
|
|
515
|
+
// result.status = this.status;
|
|
516
|
+
|
|
517
|
+
// //triggerEvent(gina, $target, 'success.' + id, result);
|
|
518
|
+
// return onResult(result)
|
|
519
|
+
// } else {
|
|
520
|
+
// result = { 'status': xhr.status, 'message': '' };
|
|
521
|
+
// if ( /^(\{|\[)/.test( xhr.responseText ) ) {
|
|
522
|
+
// try {
|
|
523
|
+
// result = merge( result, JSON.parse(xhr.responseText) );
|
|
524
|
+
// } catch (err) {
|
|
525
|
+
// result = merge(result, err);
|
|
526
|
+
// }
|
|
527
|
+
// }
|
|
528
|
+
// return onResult(result);
|
|
529
|
+
// }
|
|
530
|
+
// } catch (err) {
|
|
531
|
+
// throw err;
|
|
532
|
+
// }
|
|
533
|
+
// } else {
|
|
534
|
+
// isOnException = true;
|
|
535
|
+
// console.log("-> Error [3]", xhr.statusText, 'isOnException: '+ isOnException);
|
|
536
|
+
// }
|
|
537
|
+
// }
|
|
538
|
+
// } // EO xhr.onreadystatechange = function (event) {
|
|
539
|
+
|
|
540
|
+
xhr.onload = function () {
|
|
442
541
|
try {
|
|
443
542
|
result = this.responseText;
|
|
444
543
|
var contentType = this.getResponseHeader("Content-Type");
|
|
445
544
|
if ( /\/json/.test( contentType ) ) {
|
|
446
545
|
result = JSON.parse(this.responseText);
|
|
447
|
-
|
|
546
|
+
|
|
448
547
|
if ( typeof(result.status) == 'undefined' )
|
|
449
548
|
result.status = this.status;
|
|
450
|
-
|
|
451
|
-
//triggerEvent(gina, $target, 'success.' + id, result);
|
|
549
|
+
|
|
550
|
+
//triggerEvent(gina, $target, 'success.' + id, result);
|
|
452
551
|
return onResult(result)
|
|
453
552
|
} else {
|
|
454
553
|
result = { 'status': xhr.status, 'message': '' };
|
|
@@ -463,32 +562,32 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
463
562
|
}
|
|
464
563
|
} catch (err) {
|
|
465
564
|
throw err;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
|
|
565
|
+
}
|
|
566
|
+
}// xhr.onload = function () {
|
|
567
|
+
|
|
469
568
|
if (data) {
|
|
470
569
|
xhr.send( queryData ); // stringyfied
|
|
471
570
|
} else {
|
|
472
571
|
xhr.send();
|
|
473
|
-
}
|
|
572
|
+
}
|
|
474
573
|
}
|
|
475
574
|
}
|
|
476
|
-
|
|
575
|
+
|
|
477
576
|
/**
|
|
478
577
|
* queryFromBackend
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
* @param {object} options
|
|
482
|
-
* @param {object} request
|
|
483
|
-
* @param {object} response
|
|
578
|
+
*
|
|
579
|
+
*
|
|
580
|
+
* @param {object} options
|
|
581
|
+
* @param {object} request
|
|
582
|
+
* @param {object} response
|
|
484
583
|
* @param {callback} next
|
|
485
|
-
*
|
|
486
|
-
*
|
|
584
|
+
*
|
|
585
|
+
*
|
|
487
586
|
*/
|
|
488
587
|
var queryFromBackend = async function(options, request, response, next) {
|
|
489
588
|
var Config = require(_(GINA_FRAMEWORK_DIR +'/core/config.js', true));
|
|
490
589
|
var config = new Config().getInstance();
|
|
491
|
-
|
|
590
|
+
|
|
492
591
|
var opt = null
|
|
493
592
|
//appConf.proxy.<bundle>;
|
|
494
593
|
, rule = null
|
|
@@ -497,7 +596,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
497
596
|
;
|
|
498
597
|
// trying to retrieve proxy conf
|
|
499
598
|
if ( /\@/.test(options.url) ) {
|
|
500
|
-
var attr = options.url.split(/@/);
|
|
599
|
+
var attr = options.url.split(/@/);
|
|
501
600
|
rule = attr[0];
|
|
502
601
|
bundle = attr[1];
|
|
503
602
|
var proxyConf = getConfig( currentBundle, 'app' ).proxy;
|
|
@@ -505,11 +604,11 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
505
604
|
if (config.bundle !== bundle) { // ignore if same bundle
|
|
506
605
|
// getting proxy conf when available
|
|
507
606
|
opt = getConfig( currentBundle, 'app' ).proxy[bundle];
|
|
508
|
-
}
|
|
607
|
+
}
|
|
509
608
|
} catch (proxyError) {
|
|
510
609
|
throw new Error('Could not retrieve `proxy` configuration for bundle `'+ bundle +'`. Please check your `/config/app.json`.\n'+proxyError.stack);
|
|
511
610
|
}
|
|
512
|
-
|
|
611
|
+
|
|
513
612
|
attr = null;
|
|
514
613
|
} else {
|
|
515
614
|
// TODO - handle else; when it is an external domain/url
|
|
@@ -517,7 +616,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
517
616
|
}
|
|
518
617
|
var route = JSON.clone(routing.getRoute(options.url, options.data));
|
|
519
618
|
var env = config.env;
|
|
520
|
-
var conf = config[bundle][env];
|
|
619
|
+
var conf = config[bundle][env];
|
|
521
620
|
if (!opt) { // setup opt by default if no proxy conf found
|
|
522
621
|
if (config.bundle == bundle) {
|
|
523
622
|
var credentials = getConfig( currentBundle, 'settings' ).server.credentials;
|
|
@@ -527,13 +626,13 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
527
626
|
options.protocol = conf.server.protocol;
|
|
528
627
|
options.rejectUnauthorized = false;
|
|
529
628
|
}
|
|
530
|
-
opt = {
|
|
629
|
+
opt = {
|
|
531
630
|
"ca" : options.ca,
|
|
532
|
-
"hostname" : options.hostname,
|
|
533
|
-
"port" : options.port,
|
|
631
|
+
"hostname" : options.hostname,
|
|
632
|
+
"port" : options.port,
|
|
534
633
|
"path" : options.path
|
|
535
634
|
};
|
|
536
|
-
|
|
635
|
+
|
|
537
636
|
if ( typeof(options.protocol) != 'undefined' ) {
|
|
538
637
|
opt.protocol = options.protocol
|
|
539
638
|
}
|
|
@@ -541,7 +640,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
541
640
|
opt.rejectUnauthorized = options.rejectUnauthorized
|
|
542
641
|
}
|
|
543
642
|
}
|
|
544
|
-
|
|
643
|
+
|
|
545
644
|
/**
|
|
546
645
|
* BO routing configuration
|
|
547
646
|
* Attention: this portion of code is from `router.js`
|
|
@@ -560,7 +659,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
560
659
|
isXMLRequest : request.isXMLRequest,
|
|
561
660
|
isWithCredentials : request.isWithCredentials
|
|
562
661
|
};
|
|
563
|
-
|
|
662
|
+
|
|
564
663
|
var templateName = params.rule.replace('\@'+ bundle, '') || '_common';
|
|
565
664
|
var routeHasViews = ( typeof(conf.content.templates) != 'undefined' ) ? true : false;
|
|
566
665
|
var controllerOptions = {
|
|
@@ -583,9 +682,9 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
583
682
|
//path: params.param.path || null, // user custom path : namespace should be ignored | left blank
|
|
584
683
|
//assets: {}
|
|
585
684
|
};
|
|
586
|
-
|
|
587
|
-
controllerOptions = merge(controllerOptions, params);
|
|
588
|
-
|
|
685
|
+
|
|
686
|
+
controllerOptions = merge(controllerOptions, params);
|
|
687
|
+
|
|
589
688
|
// BO - Template outside of namespace fix added on 2021-08-19
|
|
590
689
|
// We want to keep original conf untouched
|
|
591
690
|
controllerOptions.conf = JSON.clone(conf);
|
|
@@ -596,7 +695,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
596
695
|
&& typeof(controllerOptions.template.ginaLoader) == 'undefined'
|
|
597
696
|
) {
|
|
598
697
|
controllerOptions.template.ginaLoader = controllerOptions.conf.content.templates._common.ginaLoader;
|
|
599
|
-
}
|
|
698
|
+
}
|
|
600
699
|
controllerOptions.conf.content.routing[controllerOptions.rule].param = params.param;
|
|
601
700
|
delete controllerOptions.middleware;
|
|
602
701
|
delete controllerOptions.param;
|
|
@@ -605,17 +704,17 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
605
704
|
/**
|
|
606
705
|
* EO routing configuration
|
|
607
706
|
*/
|
|
608
|
-
|
|
707
|
+
|
|
609
708
|
var Controller = require(_(GINA_FRAMEWORK_DIR +'/core/controller/controller.js'), true);
|
|
610
709
|
var controller = new Controller(controllerOptions);
|
|
611
|
-
controller.name = route.param.control;
|
|
710
|
+
controller.name = route.param.control;
|
|
612
711
|
//controller.serverInstance = serverInstance;
|
|
613
712
|
controller.setOptions(request, response, next, controllerOptions);
|
|
614
|
-
|
|
615
|
-
|
|
713
|
+
|
|
714
|
+
|
|
616
715
|
var data = ( typeof(options.data) == 'object' && options.data.count() > 0 )
|
|
617
716
|
? options.data
|
|
618
|
-
: {};
|
|
717
|
+
: {};
|
|
619
718
|
// inherited data from current query asking for validation
|
|
620
719
|
var urlParams = '';
|
|
621
720
|
if ( /^get|delete|put$/i.test(options.method) ) {
|
|
@@ -633,11 +732,11 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
633
732
|
opt.method = options.method;
|
|
634
733
|
//opt.path = route.url + urlParams;
|
|
635
734
|
opt.path = route.url;
|
|
636
|
-
|
|
735
|
+
|
|
637
736
|
var util = require('util');
|
|
638
737
|
var promisify = util.promisify;
|
|
639
738
|
var result = { isValid: false }, err = false;
|
|
640
|
-
|
|
739
|
+
|
|
641
740
|
await promisify(controller.query)(opt, data)
|
|
642
741
|
.then(function onResult(_result) {
|
|
643
742
|
result = _result;
|
|
@@ -649,10 +748,10 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
649
748
|
//throw err;
|
|
650
749
|
console.error(err);
|
|
651
750
|
result.error = err;
|
|
652
|
-
}
|
|
751
|
+
}
|
|
653
752
|
return result;
|
|
654
753
|
};
|
|
655
|
-
|
|
754
|
+
|
|
656
755
|
/**
|
|
657
756
|
* query
|
|
658
757
|
*/
|
|
@@ -667,16 +766,16 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
667
766
|
/**
|
|
668
767
|
* addField
|
|
669
768
|
* Add field to the validation context
|
|
670
|
-
* @param {string} el
|
|
671
|
-
* @param {string|boolean|number|object} [value]
|
|
769
|
+
* @param {string} el
|
|
770
|
+
* @param {string|boolean|number|object} [value]
|
|
672
771
|
*/
|
|
673
|
-
var addField = function(el, value) {
|
|
772
|
+
var addField = function(el, value) {
|
|
674
773
|
var val = null, label = null;
|
|
675
|
-
|
|
774
|
+
|
|
676
775
|
if ( typeof(self[el]) == 'undefined' && typeof(value) != 'undefined' ) {
|
|
677
776
|
self[el] = val = value;
|
|
678
777
|
}
|
|
679
|
-
|
|
778
|
+
|
|
680
779
|
if ( typeof(self[el]) == 'object' ) {
|
|
681
780
|
try {
|
|
682
781
|
val = JSON.parse( JSON.stringify( self[el] ))
|
|
@@ -726,17 +825,17 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
726
825
|
var alias = ( typeof(window) != 'undefined' && typeof(window._currentValidatorAlias) != 'undefined' ) ? window._currentValidatorAlias : 'is';
|
|
727
826
|
if ( typeof(window) != 'undefined' && window._currentValidatorAlias)
|
|
728
827
|
delete window._currentValidatorAlias;
|
|
729
|
-
|
|
730
|
-
var errors = self[this['name']]['errors'] || {};
|
|
828
|
+
|
|
829
|
+
var errors = self[this['name']]['errors'] || {};
|
|
731
830
|
local.data[this.name] = self[this.name].value;
|
|
732
|
-
|
|
733
|
-
if (
|
|
831
|
+
|
|
832
|
+
if (
|
|
734
833
|
typeof(errors['isRequired']) == 'undefined'
|
|
735
834
|
&& this.value == ''
|
|
736
|
-
&& !/^false$/i.test(this.value)
|
|
737
|
-
&& this.value != 0
|
|
835
|
+
&& !/^false$/i.test(this.value)
|
|
836
|
+
&& this.value != 0
|
|
738
837
|
||
|
|
739
|
-
!errors['isRequired']
|
|
838
|
+
!errors['isRequired']
|
|
740
839
|
&& this.value == ''
|
|
741
840
|
&& !/^false$/i.test(this.value)
|
|
742
841
|
&& this.value != 0
|
|
@@ -745,14 +844,14 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
745
844
|
} else if (!errors['isRequired'] && typeof(this.value) == 'string' && this.value == '') {
|
|
746
845
|
isValid = true;
|
|
747
846
|
}
|
|
748
|
-
|
|
847
|
+
|
|
749
848
|
if ( !isValid && /^(true|false)$/i.test(condition) ) { // because it can be evaluated on backend validation
|
|
750
849
|
isValid = condition;
|
|
751
850
|
} else if (!isValid) {
|
|
752
851
|
var re = null, flags = null;
|
|
753
852
|
// Fixed on 2021-03-13: $variable now replaced with real value beafore validation
|
|
754
853
|
if ( /[\!\=>\>\<a-z 0-9]+/i.test(condition) ) {
|
|
755
|
-
var variables = condition.match(/\${0}[-_,.\[\]a-z0-9]+/ig); // without space(s)
|
|
854
|
+
var variables = condition.match(/\${0}[-_,.\[\]a-z0-9]+/ig); // without space(s)
|
|
756
855
|
if (variables && variables.length > 0) {
|
|
757
856
|
var compiledCondition = condition;
|
|
758
857
|
for (var i = 0, len = variables.length; i < len; ++i) {
|
|
@@ -768,7 +867,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
768
867
|
}
|
|
769
868
|
}
|
|
770
869
|
}
|
|
771
|
-
|
|
870
|
+
|
|
772
871
|
try {
|
|
773
872
|
// security checks
|
|
774
873
|
compiledCondition = compiledCondition.replace(/(\(|\)|return)/g, '');
|
|
@@ -777,7 +876,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
777
876
|
} else {
|
|
778
877
|
isValid = eval(compiledCondition)
|
|
779
878
|
}
|
|
780
|
-
|
|
879
|
+
|
|
781
880
|
} catch (err) {
|
|
782
881
|
throw new Error(err.stack||err.message)
|
|
783
882
|
}
|
|
@@ -801,7 +900,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
801
900
|
} else {
|
|
802
901
|
isValid = eval(condition);
|
|
803
902
|
}
|
|
804
|
-
|
|
903
|
+
|
|
805
904
|
//valid = new RegExp(condition.replace(/\//g, '')).test(this.value)
|
|
806
905
|
} catch (err) {
|
|
807
906
|
throw new Error(err.stack||err.message)
|
|
@@ -814,7 +913,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
814
913
|
if ( typeof(errorStack) != 'undefined' )
|
|
815
914
|
errors['stack'] = errorStack;
|
|
816
915
|
}
|
|
817
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
916
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
818
917
|
else if ( isValid && typeof(errors[alias]) != 'undefined' ) {
|
|
819
918
|
delete errors[alias];
|
|
820
919
|
//delete errors['stack'];
|
|
@@ -824,16 +923,16 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
824
923
|
if ( errors.count() > 0 )
|
|
825
924
|
this['errors'] = errors;
|
|
826
925
|
|
|
827
|
-
|
|
926
|
+
|
|
828
927
|
return self[this.name]
|
|
829
928
|
}
|
|
830
|
-
|
|
929
|
+
|
|
831
930
|
self[el]['set'] = function(value) {
|
|
832
931
|
this.value = local['data'][this.name] = value;
|
|
833
|
-
// html
|
|
932
|
+
// html
|
|
834
933
|
this.target.setAttribute('value', value);
|
|
835
934
|
// Todo : select and radio case to apply change
|
|
836
|
-
|
|
935
|
+
|
|
837
936
|
return self[this.name]
|
|
838
937
|
}
|
|
839
938
|
|
|
@@ -842,15 +941,15 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
842
941
|
|
|
843
942
|
this.value = local['data'][this.name] = (this.value) ? this.value.toLowerCase() : this.value;
|
|
844
943
|
// Apply on current field upper -> lower
|
|
845
|
-
if (
|
|
944
|
+
if (
|
|
846
945
|
isGFFCtx
|
|
847
946
|
&& this.target
|
|
848
|
-
&& this.target.value != ''
|
|
849
|
-
&& /[A-Z]+/.test(this.target.value)
|
|
947
|
+
&& this.target.value != ''
|
|
948
|
+
&& /[A-Z]+/.test(this.target.value)
|
|
850
949
|
) {
|
|
851
950
|
this.target.value = this.value;
|
|
852
951
|
}
|
|
853
|
-
|
|
952
|
+
|
|
854
953
|
|
|
855
954
|
var rgx = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
856
955
|
var isValid = rgx.test(this['value']) ? true : false;
|
|
@@ -863,7 +962,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
863
962
|
if (!isValid) {
|
|
864
963
|
errors['isEmail'] = replace(this['error'] || local.errorLabels['isEmail'], this)
|
|
865
964
|
}
|
|
866
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
965
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
867
966
|
else if ( isValid && typeof(errors['isEmail']) != 'undefined' ) {
|
|
868
967
|
delete errors['isEmail'];
|
|
869
968
|
//delete errors['stack'];
|
|
@@ -882,11 +981,11 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
882
981
|
|
|
883
982
|
this.value = local['data'][this.name] = (this.value) ? this.value.toLowerCase() : this.value;
|
|
884
983
|
// Apply on current field upper -> lower
|
|
885
|
-
if (
|
|
984
|
+
if (
|
|
886
985
|
isGFFCtx
|
|
887
986
|
&& this.target
|
|
888
|
-
&& this.target.value != ''
|
|
889
|
-
&& /[A-Z]+/.test(this.target.value)
|
|
987
|
+
&& this.target.value != ''
|
|
988
|
+
&& /[A-Z]+/.test(this.target.value)
|
|
890
989
|
) {
|
|
891
990
|
this.target.value = this.value;
|
|
892
991
|
}
|
|
@@ -902,7 +1001,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
902
1001
|
if (!isValid) {
|
|
903
1002
|
errors['isJsonWebToken'] = replace(this['error'] || local.errorLabels['isJsonWebToken'], this)
|
|
904
1003
|
}
|
|
905
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1004
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
906
1005
|
else if ( isValid && typeof(errors['isJsonWebToken']) != 'undefined' ) {
|
|
907
1006
|
delete errors['isJsonWebToken'];
|
|
908
1007
|
//delete errors['stack'];
|
|
@@ -915,7 +1014,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
915
1014
|
|
|
916
1015
|
return self[this['name']]
|
|
917
1016
|
}
|
|
918
|
-
|
|
1017
|
+
|
|
919
1018
|
/**
|
|
920
1019
|
* Check if boolean and convert to `true/false` booloean if value is a string or a number
|
|
921
1020
|
* Will include `false` value if isRequired
|
|
@@ -943,13 +1042,13 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
943
1042
|
val = this.value = local.data[this.name] = false;
|
|
944
1043
|
break;
|
|
945
1044
|
}
|
|
946
|
-
|
|
1045
|
+
|
|
947
1046
|
var isValid = (val !== null) ? true : false;
|
|
948
1047
|
|
|
949
1048
|
if (!isValid) {
|
|
950
1049
|
errors['isBoolean'] = replace(this.error || local.errorLabels['isBoolean'], this)
|
|
951
1050
|
}
|
|
952
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1051
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
953
1052
|
else if ( isValid && typeof(errors['isBoolean']) != 'undefined' ) {
|
|
954
1053
|
delete errors['isBoolean'];
|
|
955
1054
|
//delete errors['stack'];
|
|
@@ -981,7 +1080,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
981
1080
|
, isMaxLength = true
|
|
982
1081
|
, errors = self[this['name']]['errors'] || {}
|
|
983
1082
|
;
|
|
984
|
-
|
|
1083
|
+
|
|
985
1084
|
// test if val is a number
|
|
986
1085
|
try {
|
|
987
1086
|
// if val is a string replaces comas by points
|
|
@@ -1030,7 +1129,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1030
1129
|
|
|
1031
1130
|
isValid = false;
|
|
1032
1131
|
}
|
|
1033
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1132
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1034
1133
|
if ( isValid && typeof(errors['isNumberLength']) != 'undefined') {
|
|
1035
1134
|
delete errors['isNumberLength'];
|
|
1036
1135
|
}
|
|
@@ -1136,7 +1235,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1136
1235
|
// document.getElementById(this.target.id).value = this.value;
|
|
1137
1236
|
// //triggerEvent(gina, this.target, 'change', self[this['name']]);
|
|
1138
1237
|
// }
|
|
1139
|
-
|
|
1238
|
+
|
|
1140
1239
|
} else {
|
|
1141
1240
|
this.value = this.value.replace(/\,/g,'');
|
|
1142
1241
|
}
|
|
@@ -1249,7 +1348,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1249
1348
|
if ( typeof(isApplicable) == 'boolean' && !isApplicable ) {
|
|
1250
1349
|
|
|
1251
1350
|
this.valid = true;
|
|
1252
|
-
|
|
1351
|
+
|
|
1253
1352
|
// is in excluded ?
|
|
1254
1353
|
var excludedIndex = local.excluded.indexOf(this.name);
|
|
1255
1354
|
if ( excludedIndex > -1 ) {
|
|
@@ -1260,12 +1359,12 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1260
1359
|
}
|
|
1261
1360
|
|
|
1262
1361
|
// radio group case
|
|
1263
|
-
if (
|
|
1264
|
-
isGFFCtx
|
|
1265
|
-
&& this.target
|
|
1266
|
-
&& this.target.tagName == 'INPUT'
|
|
1267
|
-
&& typeof(this.target.type) != 'undefined'
|
|
1268
|
-
&& this.target.type == 'radio'
|
|
1362
|
+
if (
|
|
1363
|
+
isGFFCtx
|
|
1364
|
+
&& this.target
|
|
1365
|
+
&& this.target.tagName == 'INPUT'
|
|
1366
|
+
&& typeof(this.target.type) != 'undefined'
|
|
1367
|
+
&& this.target.type == 'radio'
|
|
1269
1368
|
) {
|
|
1270
1369
|
var radios = document.getElementsByName(this.name);
|
|
1271
1370
|
for (var i = 0, len = radios.length; i < len; ++i) {
|
|
@@ -1290,7 +1389,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1290
1389
|
if (!isValid) {
|
|
1291
1390
|
errors['isRequired'] = replace(this.error || local.errorLabels['isRequired'], this)
|
|
1292
1391
|
}
|
|
1293
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1392
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1294
1393
|
else if ( isValid ) {
|
|
1295
1394
|
if (typeof(errors['isRequired']) != 'undefined' )
|
|
1296
1395
|
delete errors['isRequired'];
|
|
@@ -1315,7 +1414,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1315
1414
|
* {
|
|
1316
1415
|
* "password": {
|
|
1317
1416
|
* "isRequired": true,
|
|
1318
|
-
*
|
|
1417
|
+
*
|
|
1319
1418
|
* "isString": true // Means that we just want a string and we don't care of its length
|
|
1320
1419
|
* // OR
|
|
1321
1420
|
* "isString": 7 // Means at least 7 chars length
|
|
@@ -1395,7 +1494,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1395
1494
|
*
|
|
1396
1495
|
* @returns {date} date - extended by gina::utils::dateFormat; an adaptation of Steven Levithan's code
|
|
1397
1496
|
* */
|
|
1398
|
-
self[el]['isDate'] = function(mask) {
|
|
1497
|
+
self[el]['isDate'] = function(mask) {
|
|
1399
1498
|
var val = this.value
|
|
1400
1499
|
, isValid = false
|
|
1401
1500
|
, errors = self[this['name']]['errors'] || {}
|
|
@@ -1403,37 +1502,37 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1403
1502
|
, date = null
|
|
1404
1503
|
;
|
|
1405
1504
|
// Default validation on livecheck & invalid init value
|
|
1406
|
-
if (!val || val == '' || /NaN|Invalid Date/i.test(val) ) {
|
|
1505
|
+
if (!val || val == '' || /NaN|Invalid Date/i.test(val) ) {
|
|
1407
1506
|
if ( /NaN|Invalid Date/i.test(val) ) {
|
|
1408
1507
|
console.warn('[FormValidator::isDate] Provided value for field `'+ this.name +'` is not allowed: `'+ val +'`');
|
|
1409
1508
|
errors['isDate'] = replace(this.error || local.errorLabels['isDate'], this);
|
|
1410
|
-
|
|
1509
|
+
|
|
1411
1510
|
}
|
|
1412
1511
|
this.valid = isValid;
|
|
1413
1512
|
if ( errors.count() > 0 )
|
|
1414
|
-
this['errors'] = errors;
|
|
1415
|
-
|
|
1513
|
+
this['errors'] = errors;
|
|
1514
|
+
|
|
1416
1515
|
return self[this.name];
|
|
1417
1516
|
}
|
|
1418
|
-
|
|
1419
|
-
if (
|
|
1517
|
+
|
|
1518
|
+
if (
|
|
1420
1519
|
typeof(mask) == 'undefined'
|
|
1421
1520
|
||
|
|
1422
1521
|
typeof(mask) != 'undefined' && /true/i.test(mask)
|
|
1423
1522
|
) {
|
|
1424
1523
|
mask = "yyyy-mm-dd"; // by default
|
|
1425
1524
|
}
|
|
1426
|
-
|
|
1525
|
+
|
|
1427
1526
|
if (val instanceof Date) {
|
|
1428
1527
|
date = val.format(mask);
|
|
1429
1528
|
} else {
|
|
1430
|
-
|
|
1529
|
+
|
|
1431
1530
|
try {
|
|
1432
1531
|
m = mask.match(/[^\/\- ]+/g);
|
|
1433
1532
|
} catch (err) {
|
|
1434
1533
|
throw new Error('[FormValidator::isDate] Provided mask not allowed: `'+ mask +'`');
|
|
1435
1534
|
}
|
|
1436
|
-
|
|
1535
|
+
|
|
1437
1536
|
try {
|
|
1438
1537
|
val = val.match(/[^\/\- ]+/g);
|
|
1439
1538
|
var dic = {}, d, len;
|
|
@@ -1447,10 +1546,10 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1447
1546
|
} catch (err) {
|
|
1448
1547
|
throw new Error('[FormValidator::isDate] Provided value not allowed: `'+ val +'`' + err);
|
|
1449
1548
|
}
|
|
1450
|
-
|
|
1549
|
+
|
|
1451
1550
|
|
|
1452
1551
|
date = this.value = local.data[this.name] = new Date(formatedDate);
|
|
1453
|
-
|
|
1552
|
+
|
|
1454
1553
|
if ( /Invalid Date/i.test(date) || date instanceof Date === false ) {
|
|
1455
1554
|
if ( !errors['isRequired'] && this.value == '' ) {
|
|
1456
1555
|
isValid = true
|
|
@@ -1512,7 +1611,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1512
1611
|
}
|
|
1513
1612
|
return self[this.name]
|
|
1514
1613
|
}
|
|
1515
|
-
|
|
1614
|
+
|
|
1516
1615
|
/**
|
|
1517
1616
|
* Trim when string starts or ends with white space(s)
|
|
1518
1617
|
*
|
|
@@ -1536,11 +1635,11 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1536
1635
|
self[el]['exclude'] = function(isApplicable) {
|
|
1537
1636
|
|
|
1538
1637
|
if ( typeof(isApplicable) == 'boolean' && !isApplicable ) {
|
|
1539
|
-
|
|
1638
|
+
|
|
1540
1639
|
if ( /^true|false$/i.test(this.value)) {
|
|
1541
1640
|
this.value = (/^true$/i.test(this.value)) ? true : false;
|
|
1542
1641
|
local.data[this.name] = this.value;
|
|
1543
|
-
}
|
|
1642
|
+
}
|
|
1544
1643
|
|
|
1545
1644
|
return self[this.name]
|
|
1546
1645
|
}
|
|
@@ -1550,8 +1649,8 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1550
1649
|
local.excluded.push(this.name);
|
|
1551
1650
|
this.isExcluded = true;
|
|
1552
1651
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1652
|
+
|
|
1653
|
+
|
|
1555
1654
|
// remove existing errors
|
|
1556
1655
|
return self[this.name];
|
|
1557
1656
|
}
|
|
@@ -1561,8 +1660,8 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1561
1660
|
* a request to the remote host if previous rules failed
|
|
1562
1661
|
*/
|
|
1563
1662
|
self[el]['query'] = query;
|
|
1564
|
-
|
|
1565
|
-
|
|
1663
|
+
|
|
1664
|
+
|
|
1566
1665
|
self[el]['getValidationContext'] = function() {
|
|
1567
1666
|
return {
|
|
1568
1667
|
'isGFFCtx' : isGFFCtx,
|
|
@@ -1572,10 +1671,10 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1572
1671
|
}
|
|
1573
1672
|
}
|
|
1574
1673
|
// Merging user validators
|
|
1575
|
-
// To debug, open inspector and look into `Extra Scripts`
|
|
1674
|
+
// To debug, open inspector and look into `Extra Scripts`
|
|
1576
1675
|
if ( hasUserValidators() ) {
|
|
1577
1676
|
var userValidator = null, filename = null;
|
|
1578
|
-
try {
|
|
1677
|
+
try {
|
|
1579
1678
|
for (let v in gina.forms.validators) {
|
|
1580
1679
|
filename = '/validators/'+ v + '/main.js';
|
|
1581
1680
|
// setting default local error
|
|
@@ -1586,12 +1685,12 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1586
1685
|
userValidator = bufferToString(gina.forms.validators[v].data); // ok
|
|
1587
1686
|
var passedContext = 'var validationContext = this.getValidationContext(),isGFFCtx = validationContext.isGFFCtx,self = validationContext.self,local = validationContext.local,replace = validationContext.replace;';
|
|
1588
1687
|
userValidator = userValidator.replace(/(\)\s+\{|\)\{){1}/, '$&\n\t'+ passedContext);
|
|
1589
|
-
|
|
1688
|
+
|
|
1590
1689
|
//userValidator += '\n//#sourceURL='+ v +'.js';
|
|
1591
1690
|
} else {
|
|
1592
1691
|
userValidator = gina.forms.validators[v].toString();
|
|
1593
1692
|
}
|
|
1594
|
-
|
|
1693
|
+
|
|
1595
1694
|
self[el][v] = eval('(' + userValidator + ')\n//# sourceURL='+ v +'.js');
|
|
1596
1695
|
//self[el][v] = Function('errorMessage', 'errorStack', userValidator);
|
|
1597
1696
|
}
|
|
@@ -1599,22 +1698,22 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1599
1698
|
throw new Error('[UserFormValidator] Could not evaluate: `'+ filename +'`\n'+userValidatorError.stack);
|
|
1600
1699
|
}
|
|
1601
1700
|
}
|
|
1602
|
-
} // EO addField(el, value)
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
for (let el in self) {
|
|
1701
|
+
} // EO addField(el, value)
|
|
1702
|
+
|
|
1703
|
+
|
|
1704
|
+
for (let el in self) {
|
|
1606
1705
|
// Adding fields & validators to context
|
|
1607
1706
|
addField(el, self[el]);
|
|
1608
1707
|
}
|
|
1609
|
-
|
|
1708
|
+
|
|
1610
1709
|
self['addField'] = function(el, value) {
|
|
1611
1710
|
if ( typeof(self[el]) != 'undefined' ) {
|
|
1612
1711
|
return
|
|
1613
1712
|
}
|
|
1614
1713
|
addField(el, value);
|
|
1615
1714
|
};
|
|
1616
|
-
|
|
1617
|
-
|
|
1715
|
+
|
|
1716
|
+
|
|
1618
1717
|
// self['getExcludedFields'] = function() {
|
|
1619
1718
|
// return local.excluded;
|
|
1620
1719
|
// };
|
|
@@ -1644,33 +1743,33 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1644
1743
|
// }
|
|
1645
1744
|
for (var r in self[field]) {
|
|
1646
1745
|
// no error for the current field rule
|
|
1647
|
-
if (
|
|
1746
|
+
if (
|
|
1648
1747
|
typeof(errors[field]) != 'object'
|
|
1649
1748
|
||
|
|
1650
1749
|
typeof(errors[field][r]) == 'undefined'
|
|
1651
1750
|
) {
|
|
1652
1751
|
continue;
|
|
1653
1752
|
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
if (
|
|
1657
|
-
typeof(self[field].valid) != 'undefined'
|
|
1658
|
-
&& /^true$/i.test(self[field].valid)
|
|
1753
|
+
|
|
1754
|
+
|
|
1755
|
+
if (
|
|
1756
|
+
typeof(self[field].valid) != 'undefined'
|
|
1757
|
+
&& /^true$/i.test(self[field].valid)
|
|
1659
1758
|
) {
|
|
1660
1759
|
delete errors[field][r];
|
|
1661
1760
|
continue;
|
|
1662
1761
|
}
|
|
1663
|
-
|
|
1664
|
-
|
|
1762
|
+
|
|
1763
|
+
|
|
1665
1764
|
if ( typeof( self[field]['errors']) == 'undefined' ) {
|
|
1666
1765
|
self[field]['errors'] = {}
|
|
1667
1766
|
}
|
|
1668
|
-
|
|
1669
|
-
self[field]['errors'][r] = errors[field][r];
|
|
1767
|
+
|
|
1768
|
+
self[field]['errors'][r] = errors[field][r];
|
|
1670
1769
|
}
|
|
1671
|
-
|
|
1770
|
+
|
|
1672
1771
|
// if field does not have errors, remove errors[field]
|
|
1673
|
-
if (
|
|
1772
|
+
if (
|
|
1674
1773
|
typeof(self[field]['errors']) == 'undefined'
|
|
1675
1774
|
&& typeof(errors[field]) != 'undefined'
|
|
1676
1775
|
||
|
|
@@ -1687,34 +1786,34 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1687
1786
|
/**
|
|
1688
1787
|
* getErrors
|
|
1689
1788
|
* NB.: This portion is shared between the front & the back
|
|
1690
|
-
*
|
|
1789
|
+
*
|
|
1691
1790
|
* @param {string} [fieldName]
|
|
1692
|
-
*
|
|
1791
|
+
*
|
|
1693
1792
|
* @returns errors
|
|
1694
1793
|
*/
|
|
1695
1794
|
self['getErrors'] = function(fieldName) {
|
|
1696
1795
|
var errors = {};
|
|
1697
|
-
|
|
1796
|
+
|
|
1698
1797
|
if ( typeof(fieldName) != 'undefined' ) {
|
|
1699
1798
|
if ( typeof(self[fieldName]) != 'undefined' && self[fieldName] && typeof(self[fieldName]['errors']) != 'undefined' && self[fieldName]['errors'].count() > 0 ) {
|
|
1700
1799
|
errors[fieldName] = self[fieldName]['errors'];
|
|
1701
|
-
}
|
|
1800
|
+
}
|
|
1702
1801
|
return errors
|
|
1703
1802
|
}
|
|
1704
|
-
|
|
1803
|
+
|
|
1705
1804
|
for (var field in self) {
|
|
1706
|
-
if (
|
|
1805
|
+
if (
|
|
1707
1806
|
typeof(self[field]) != 'object'
|
|
1708
1807
|
) {
|
|
1709
1808
|
continue;
|
|
1710
1809
|
}
|
|
1711
|
-
|
|
1810
|
+
|
|
1712
1811
|
if ( typeof(self[field]['errors']) != 'undefined' ) {
|
|
1713
1812
|
if ( self[field]['errors'].count() > 0)
|
|
1714
1813
|
errors[field] = self[field]['errors'];
|
|
1715
1814
|
}
|
|
1716
1815
|
}
|
|
1717
|
-
|
|
1816
|
+
|
|
1718
1817
|
return errors
|
|
1719
1818
|
}
|
|
1720
1819
|
|
|
@@ -1731,7 +1830,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1731
1830
|
// local.data = JSON.parse(JSON.stringify(local.data).replace(/\"(true|false)\"/gi, '$1'))
|
|
1732
1831
|
return local.data
|
|
1733
1832
|
}
|
|
1734
|
-
|
|
1833
|
+
|
|
1735
1834
|
/**@js_externs replace*/
|
|
1736
1835
|
var replace = function(target, fieldObj) {
|
|
1737
1836
|
var keys = target.match(/%[a-z]+/gi);
|