gina 0.1.1-alpha.17 → 0.1.1-alpha.171
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/AUTHORS +2 -1
- package/LICENSE +1 -1
- package/README-4Contributors.md +30 -0
- package/README.md +202 -32
- package/bin/cli +165 -68
- package/bin/cli-debug +49 -18
- package/bin/cmd +40 -18
- package/bin/gina +48 -37
- package/{framework/v0.1.1-alpha.17/core/template/command/gina.bat.tpl → bin/gina.bat} +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/AUTHORS +0 -0
- package/framework/{v0.1.1-alpha.17/lib/inherits → v0.1.1-alpha.171}/LICENSE +1 -1
- package/framework/v0.1.1-alpha.171/VERSION +1 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/asset/html/nolayout.html +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/asset/html/static.html +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/asset/img/android-chrome-192x192.png +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/asset/img/android-chrome-512x512.png +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/asset/img/apple-touch-icon.png +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/asset/img/favicon-16x16.png +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/asset/img/favicon-32x32.png +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/asset/img/favicon.ico +0 -0
- package/framework/{v0.1.1-alpha.17/core/asset/js/plugin/readme.md → v0.1.1-alpha.171/core/asset/plugin/README.md} +31 -9
- package/framework/v0.1.1-alpha.171/core/asset/plugin/dist/vendor/gina/css/gina.min.css +1 -0
- package/framework/v0.1.1-alpha.171/core/asset/plugin/dist/vendor/gina/css/gina.min.css.map +1 -0
- package/framework/v0.1.1-alpha.171/core/asset/plugin/dist/vendor/gina/html/toolbar.html +251 -0
- package/framework/{v0.1.1-alpha.17/core/asset/js/plugin/dist → v0.1.1-alpha.171/core/asset/plugin/dist/vendor/gina/js}/gina.js +3786 -3007
- package/framework/v0.1.1-alpha.171/core/asset/plugin/dist/vendor/gina/js/gina.min.js +756 -0
- package/framework/v0.1.1-alpha.171/core/asset/plugin/dist/vendor/gina/js/gina.min.js.map +8 -0
- package/framework/v0.1.1-alpha.171/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +5 -0
- package/framework/v0.1.1-alpha.171/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.map +8 -0
- package/framework/{v0.1.1-alpha.17/core/asset/js → v0.1.1-alpha.171/core/asset}/plugin/uuid.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/config.js +95 -39
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/connectors/couchbase/index.js +332 -223
- package/framework/v0.1.1-alpha.171/core/connectors/couchbase/lib/connector.js +22 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/connectors/couchbase/lib/connector.v2.js +51 -51
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/connectors/couchbase/lib/connector.v3.js +51 -51
- package/framework/v0.1.1-alpha.171/core/connectors/couchbase/lib/connector.v4.js +384 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/connectors/couchbase/lib/n1ql.js +3 -2
- package/framework/v0.1.1-alpha.171/core/connectors/couchbase/lib/session-store.js +22 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/connectors/couchbase/lib/session-store.v3.js +12 -12
- package/framework/v0.1.1-alpha.171/core/connectors/couchbase/lib/session-store.v4.js +361 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/controller/controller.framework.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/controller/controller.js +787 -743
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/controller/index.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/.travis.yml +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/LICENSE +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/deps/encoding/encoding.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/lib/main.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/lib/types/multipart.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/lib/types/urlencoded.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/lib/utils.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/busboy/package.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/dev/index.js +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/dev/lib/class.js +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/dev/lib/factory.js +2 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/dev/lib/tools.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/gna.js +13 -9
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/locales/README.md +5 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/locales/currency.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/locales/dist/language/en.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/locales/dist/language/fr.json +0 -0
- package/framework/v0.1.1-alpha.171/core/locales/dist/region/en.json +5727 -0
- package/framework/v0.1.1-alpha.171/core/locales/dist/region/fr.json +11452 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/locales/index.js +2 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/locales/src/make.js +39 -41
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/locales/src/resources/currency.csv +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/locales/src/resources/region.csv +0 -0
- package/framework/v0.1.1-alpha.171/core/locales/src/resources/region.mapping.json +43 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/mime.types +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/model/entity.js +87 -67
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/model/index.js +16 -16
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/model/template/entityFactory.js +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/model/template/index.js +15 -14
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/index.js +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/file/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/file/build.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/file/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/intl/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/intl/build.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/intl/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/intl/src/main.js +5 -5
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/storage/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/storage/build.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/storage/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/storage/src/main.js +4 -4
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/validator/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/validator/build.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/validator/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/validator/src/form-validator.js +397 -296
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/plugins/lib/validator/src/main.js +1279 -1256
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/router.js +95 -79
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/server.express.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/server.isaac.js +118 -109
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/server.js +230 -57
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/status.codes +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle/config/app.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle/config/routing.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle/config/settings.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle/config/settings.server.json +4 -4
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle/config/templates.json +4 -4
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle/controllers/controller.content.js +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
- package/framework/v0.1.1-alpha.171/core/template/boilerplate/bundle/controllers/setup.js +111 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle/index.js +13 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle_public/css/default.css +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle_public/readme.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
- package/framework/v0.1.1-alpha.171/core/template/boilerplate/bundle_templates/html/content/homepage.html +8 -0
- package/framework/v0.1.1-alpha.171/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +11 -0
- package/framework/v0.1.1-alpha.171/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +8 -0
- package/framework/{v0.1.1-alpha.17/core/template/boilerplate/bundle_templates/html/layout → v0.1.1-alpha.171/core/template/boilerplate/bundle_templates/html/layouts}/main.html +10 -3
- package/framework/v0.1.1-alpha.171/core/template/command/gina.bat.tpl +8 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/command/gina.tpl +4 -4
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/conf/env.json +11 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/conf/manifest.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/conf/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/conf/settings.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/conf/statics.json +3 -3
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/conf/templates.json +2 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/error/client/json/401.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/error/client/json/403.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/error/client/json/404.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/error/server/html/50x.html +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/error/server/json/500.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/error/server/json/503.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/core/template/extensions/logger/config.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/console.js +3 -3
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/context.js +146 -6
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/dateFormat.js +9 -7
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/index.js +13 -8
- package/framework/v0.1.1-alpha.171/helpers/json/LICENSE +9 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/json/README.md +0 -0
- package/framework/{v0.1.1-alpha.17/helpers/plugins → v0.1.1-alpha.171/helpers/json}/package.json +2 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/json/src/main.js +25 -25
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/path.js +163 -96
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/plugins/README.md +0 -0
- package/framework/{v0.1.1-alpha.17/helpers/json → v0.1.1-alpha.171/helpers/plugins}/package.json +2 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/plugins/src/api-error.js +23 -23
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/plugins/src/main.js +3 -3
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/prototypes.js +46 -38
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/task.js +21 -14
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/helpers/text.js +2 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/archiver/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/archiver/build.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/archiver/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/archiver/src/dep/jszip.min.js +3 -3
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/archiver/src/main.js +168 -168
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/aliases.json +4 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/add.js +43 -17
- package/framework/v0.1.1-alpha.171/lib/cmd/bundle/arguments.json +6 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/copy.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/cp.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/help.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/help.txt +2 -2
- package/framework/v0.1.1-alpha.171/lib/cmd/bundle/list.js +176 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/remove.js +22 -22
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/rename.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/restart.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/rm.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/start.js +264 -46
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/status.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/bundle/stop.js +93 -74
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/add.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/get.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/help.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/help.txt +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/link-dev.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/list.js +20 -4
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/remove.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/rm.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/set.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/env/unset.js +0 -0
- package/framework/{v0.1.1-alpha.17/lib/cmd/scope → v0.1.1-alpha.171/lib/cmd/env}/use.js +21 -1
- package/framework/v0.1.1-alpha.171/lib/cmd/framework/build.js +85 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/dot.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/get.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/help.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/help.txt +0 -0
- package/framework/v0.1.1-alpha.171/lib/cmd/framework/init.js +798 -0
- package/framework/v0.1.1-alpha.171/lib/cmd/framework/link-node-modules.js +86 -0
- package/framework/v0.1.1-alpha.171/lib/cmd/framework/link.js +110 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/msg.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/open.js +15 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/restart.js +58 -26
- package/framework/v0.1.1-alpha.171/lib/cmd/framework/set.js +264 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/start.js +43 -20
- package/framework/v0.1.1-alpha.171/lib/cmd/framework/status.js +138 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/stop.js +44 -28
- package/framework/v0.1.1-alpha.171/lib/cmd/framework/tail.js +299 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/update.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/framework/version.js +12 -3
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/gina-dev.1.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/gina-framework.1.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/gina.1.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/helper.js +74 -5
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/index.js +23 -23
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/msg.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/port/help.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/port/help.txt +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/port/inc/scan.js +32 -17
- package/framework/v0.1.1-alpha.171/lib/cmd/port/list.js +459 -0
- package/framework/v0.1.1-alpha.171/lib/cmd/port/reset.js +426 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/port/set.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/add.js +146 -122
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/arguments.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/build.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/help.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/help.txt +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/import.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/list.js +16 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/move.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/remove.js +17 -17
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/rename.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/restart.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/rm.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/start.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/status.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/project/stop.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/protocol/help.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/protocol/help.txt +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/protocol/list.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/protocol/set.js +239 -201
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/scope/help.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/scope/help.txt +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/scope/link-local.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/scope/list.js +24 -8
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/scope/remove.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/scope/rm.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/scope/set.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/scope/unset.js +0 -0
- package/framework/{v0.1.1-alpha.17/lib/cmd/env → v0.1.1-alpha.171/lib/cmd/scope}/use.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cmd/view/add.js +34 -9
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/collection/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/collection/build.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/collection/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/collection/src/main.js +241 -241
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/config.js +31 -30
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cron/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cron/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/cron/src/main.js +10 -9
- package/framework/v0.1.1-alpha.171/lib/domain/LICENSE +9 -0
- package/framework/v0.1.1-alpha.171/lib/domain/README.md +46 -0
- package/framework/v0.1.1-alpha.171/lib/domain/dist/public_suffix_list.dat +14186 -0
- package/framework/{v0.1.1-alpha.17/lib/routing/README.md → v0.1.1-alpha.171/lib/domain/exemples/backend.js} +0 -0
- package/framework/{v0.1.1-alpha.17/lib/routing/build.json → v0.1.1-alpha.171/lib/domain/exemples/frontend.html} +0 -0
- package/framework/v0.1.1-alpha.171/lib/domain/package.json +20 -0
- package/framework/v0.1.1-alpha.171/lib/domain/src/main.js +442 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/generator/index.js +4 -4
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/index.js +3 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171/lib/inherits}/LICENSE +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/inherits/README.md +2 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/inherits/example/inheriting_eventemitter.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/inherits/example/protected_inheritance.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/inherits/example/simple_inheritance.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/inherits/package.json +3 -4
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/inherits/src/main.js +3 -3
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/package.json +2 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/src/containers/default/index.js +13 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/src/containers/file/index.js +105 -14
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/src/containers/mq/index.js +7 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/src/containers/mq/listener.js +16 -14
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/src/containers/mq/speaker.js +32 -3
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/src/helper.js +21 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/logger/src/main.js +27 -7
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/math/index.js +9 -9
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/merge/README.md +2 -2
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/merge/example/merge.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/merge/example/merge_2_literal objects.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/merge/example/merge_and_preserve_first.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/merge/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/merge/src/main.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/model.js +10 -10
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/proc.js +87 -49
- package/framework/{v0.1.1-alpha.17/lib/swig-filters → v0.1.1-alpha.171/lib/routing}/README.md +0 -0
- package/framework/{v0.1.1-alpha.17/lib/url/README.md → v0.1.1-alpha.171/lib/routing/build.json} +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/routing/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/routing/src/main.js +270 -264
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/session-store.js +6 -6
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/shell.js +3 -3
- package/framework/v0.1.1-alpha.171/lib/swig-filters/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/swig-filters/package.json +1 -1
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/swig-filters/src/main.js +55 -52
- package/framework/v0.1.1-alpha.171/lib/url/README.md +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/url/index.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/url/mocks.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/url/routing.json +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/url/test.js +0 -0
- package/framework/{v0.1.1-alpha.17 → v0.1.1-alpha.171}/lib/validator.js +2 -2
- package/framework/v0.1.1-alpha.171/package.json +14 -0
- package/package.json +33 -24
- package/resources/home/main.json +44 -1
- package/resources/home/settings.json +7 -0
- package/resources/home/user/extensions/logger/default/config.json +1 -1
- package/resources/package.json.template +29 -18
- package/script/post_install.js +411 -123
- package/script/post_publish.js +186 -0
- package/script/pre_install.js +425 -77
- package/script/prepare_version.js +275 -98
- package/services/.gna/67fdf1b224a2ed5597e63d4b64283834468e05e3.txt +0 -0
- package/services/.gna/arch +1 -0
- package/services/.gna/locals.json +14 -0
- package/services/.gna/platform +1 -0
- package/services/configure +6 -0
- package/services/env.json +10 -0
- package/services/manifest.json +18 -0
- package/services/package.json +11 -0
- package/services/src/proxy/config/app.json +6 -0
- package/services/src/proxy/config/routing.json +11 -0
- package/services/src/proxy/config/settings.json +9 -0
- package/services/src/proxy/config/settings.server.json +31 -0
- package/services/src/proxy/config/statics.json +3 -0
- package/services/src/proxy/controllers/controller.content.js +58 -0
- package/services/src/proxy/controllers/controller.js +30 -0
- package/{framework/v0.1.1-alpha.17/core/template/boilerplate/bundle → services/src/proxy}/controllers/setup.js +14 -14
- package/services/src/proxy/index.js +31 -0
- package/services/src/proxy/lib/domain/README.md +48 -0
- package/services/src/proxy/lib/domain/src/config/public_suffix_list.dat +14186 -0
- package/utils/helper.js +236 -185
- package/utils/prototypes.js +9 -9
- package/utils/prototypes.json_clone.js +36 -35
- package/doc/framework/cli/doc.json +0 -9
- package/doc/framework/index.md +0 -60
- package/framework/v0.1.1-alpha.17/VERSION +0 -1
- package/framework/v0.1.1-alpha.17/core/asset/js/plugin/dist/gina.js.map +0 -56
- package/framework/v0.1.1-alpha.17/core/asset/js/plugin/dist/gina.min.css +0 -1
- package/framework/v0.1.1-alpha.17/core/asset/js/plugin/dist/gina.min.css.map +0 -1
- package/framework/v0.1.1-alpha.17/core/asset/js/plugin/dist/gina.min.js +0 -736
- package/framework/v0.1.1-alpha.17/core/asset/js/plugin/dist/gina.min.js.map +0 -56
- package/framework/v0.1.1-alpha.17/core/asset/js/plugin/dist/gina.onload.min.js +0 -5
- package/framework/v0.1.1-alpha.17/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
- package/framework/v0.1.1-alpha.17/core/connectors/couchbase/lib/connector.js +0 -20
- package/framework/v0.1.1-alpha.17/core/connectors/couchbase/lib/session-store.js +0 -21
- package/framework/v0.1.1-alpha.17/core/locales/dist/region/en.json +0 -9492
- package/framework/v0.1.1-alpha.17/core/locales/dist/region/fr.json +0 -9492
- package/framework/v0.1.1-alpha.17/core/locales/src/resources/region.mapping.json +0 -28
- package/framework/v0.1.1-alpha.17/core/template/boilerplate/bundle_templates/html/homepage.html +0 -4
- package/framework/v0.1.1-alpha.17/lib/cmd/bundle/arguments.json +0 -4
- package/framework/v0.1.1-alpha.17/lib/cmd/bundle/list.js +0 -129
- package/framework/v0.1.1-alpha.17/lib/cmd/framework/init.js +0 -514
- package/framework/v0.1.1-alpha.17/lib/cmd/framework/set.js +0 -161
- package/framework/v0.1.1-alpha.17/lib/cmd/framework/status.js +0 -72
- package/framework/v0.1.1-alpha.17/lib/cmd/framework/tail.js +0 -183
- package/framework/v0.1.1-alpha.17/lib/cmd/port/list.js +0 -176
- package/framework/v0.1.1-alpha.17/package.json +0 -14
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* FormValidatorUtil
|
|
3
3
|
*
|
|
4
4
|
* Dependencies:
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
5
|
+
* - lib/helpers
|
|
6
|
+
* - lib/helpers/dateFormat
|
|
7
|
+
* - lib/merge
|
|
8
|
+
* - lib/routing (for API calls)
|
|
9
9
|
*
|
|
10
10
|
* @param {object} data
|
|
11
11
|
* @param {object} [ $fields ] - isGFFCtx only
|
|
@@ -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
|
-
|
|
22
|
-
var merge = (isGFFCtx) ? require('
|
|
21
|
+
|
|
22
|
+
var merge = (isGFFCtx) ? require('lib/merge') : require('../../../../../lib/merge');
|
|
23
23
|
var helpers = (isGFFCtx) ? {} : require('../../../../../helpers');
|
|
24
24
|
var dateFormat = (isGFFCtx) ? require('helpers/dateFormat') : helpers.dateFormat;
|
|
25
|
-
var routing = (isGFFCtx) ? require('
|
|
26
|
-
|
|
25
|
+
var routing = (isGFFCtx) ? require('lib/routing') : require('../../../../../lib/routing');
|
|
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,19 +604,21 @@ 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
|
|
516
615
|
throw new Error('external url/domain not handled at this moment, please contact us if you need support for it.')
|
|
517
616
|
}
|
|
518
617
|
var route = JSON.clone(routing.getRoute(options.url, options.data));
|
|
618
|
+
// var route = routing.getRoute(options.url, options.data);
|
|
619
|
+
|
|
519
620
|
var env = config.env;
|
|
520
|
-
var conf = config[bundle][env];
|
|
621
|
+
var conf = config[bundle][env];
|
|
521
622
|
if (!opt) { // setup opt by default if no proxy conf found
|
|
522
623
|
if (config.bundle == bundle) {
|
|
523
624
|
var credentials = getConfig( currentBundle, 'settings' ).server.credentials;
|
|
@@ -527,13 +628,13 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
527
628
|
options.protocol = conf.server.protocol;
|
|
528
629
|
options.rejectUnauthorized = false;
|
|
529
630
|
}
|
|
530
|
-
opt = {
|
|
631
|
+
opt = {
|
|
531
632
|
"ca" : options.ca,
|
|
532
|
-
"hostname" : options.hostname,
|
|
533
|
-
"port" : options.port,
|
|
633
|
+
"hostname" : options.hostname,
|
|
634
|
+
"port" : options.port,
|
|
534
635
|
"path" : options.path
|
|
535
636
|
};
|
|
536
|
-
|
|
637
|
+
|
|
537
638
|
if ( typeof(options.protocol) != 'undefined' ) {
|
|
538
639
|
opt.protocol = options.protocol
|
|
539
640
|
}
|
|
@@ -541,14 +642,14 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
541
642
|
opt.rejectUnauthorized = options.rejectUnauthorized
|
|
542
643
|
}
|
|
543
644
|
}
|
|
544
|
-
|
|
645
|
+
|
|
545
646
|
/**
|
|
546
647
|
* BO routing configuration
|
|
547
648
|
* Attention: this portion of code is from `router.js`
|
|
548
649
|
* Any modification on this part must be reflected on `router.js`
|
|
549
650
|
*/
|
|
550
651
|
// default param setting
|
|
551
|
-
|
|
652
|
+
var params = {
|
|
552
653
|
method : route.method,
|
|
553
654
|
requirements : route.requirements,
|
|
554
655
|
namespace : route.namespace || undefined,
|
|
@@ -560,7 +661,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
560
661
|
isXMLRequest : request.isXMLRequest,
|
|
561
662
|
isWithCredentials : request.isWithCredentials
|
|
562
663
|
};
|
|
563
|
-
|
|
664
|
+
|
|
564
665
|
var templateName = params.rule.replace('\@'+ bundle, '') || '_common';
|
|
565
666
|
var routeHasViews = ( typeof(conf.content.templates) != 'undefined' ) ? true : false;
|
|
566
667
|
var controllerOptions = {
|
|
@@ -574,8 +675,6 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
574
675
|
//bundle : bundle,//module
|
|
575
676
|
// bundlePath : conf.bundlesPath + '/' + bundle,
|
|
576
677
|
// rootPath : self.executionPath,
|
|
577
|
-
// We don't want to keep original conf untouched
|
|
578
|
-
conf : JSON.clone(conf),
|
|
579
678
|
//instance: self.serverInstance,
|
|
580
679
|
//template: (routeHasViews) ? conf.content.templates[templateName] : undefined,
|
|
581
680
|
//isUsingTemplate: local.isUsingTemplate,
|
|
@@ -583,12 +682,14 @@ 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
|
+
var _conf = JSON.clone(conf);
|
|
691
|
+
// controllerOptions.conf = JSON.clone(conf);
|
|
692
|
+
controllerOptions.conf = _conf;
|
|
592
693
|
controllerOptions.conf.content.routing[controllerOptions.rule].param = params.param;
|
|
593
694
|
// inheriting from _common
|
|
594
695
|
if (
|
|
@@ -596,7 +697,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
596
697
|
&& typeof(controllerOptions.template.ginaLoader) == 'undefined'
|
|
597
698
|
) {
|
|
598
699
|
controllerOptions.template.ginaLoader = controllerOptions.conf.content.templates._common.ginaLoader;
|
|
599
|
-
}
|
|
700
|
+
}
|
|
600
701
|
controllerOptions.conf.content.routing[controllerOptions.rule].param = params.param;
|
|
601
702
|
delete controllerOptions.middleware;
|
|
602
703
|
delete controllerOptions.param;
|
|
@@ -605,17 +706,17 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
605
706
|
/**
|
|
606
707
|
* EO routing configuration
|
|
607
708
|
*/
|
|
608
|
-
|
|
709
|
+
|
|
609
710
|
var Controller = require(_(GINA_FRAMEWORK_DIR +'/core/controller/controller.js'), true);
|
|
610
711
|
var controller = new Controller(controllerOptions);
|
|
611
|
-
controller.name = route.param.control;
|
|
712
|
+
controller.name = route.param.control;
|
|
612
713
|
//controller.serverInstance = serverInstance;
|
|
613
714
|
controller.setOptions(request, response, next, controllerOptions);
|
|
614
|
-
|
|
615
|
-
|
|
715
|
+
|
|
716
|
+
|
|
616
717
|
var data = ( typeof(options.data) == 'object' && options.data.count() > 0 )
|
|
617
718
|
? options.data
|
|
618
|
-
: {};
|
|
719
|
+
: {};
|
|
619
720
|
// inherited data from current query asking for validation
|
|
620
721
|
var urlParams = '';
|
|
621
722
|
if ( /^get|delete|put$/i.test(options.method) ) {
|
|
@@ -633,11 +734,11 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
633
734
|
opt.method = options.method;
|
|
634
735
|
//opt.path = route.url + urlParams;
|
|
635
736
|
opt.path = route.url;
|
|
636
|
-
|
|
737
|
+
|
|
637
738
|
var util = require('util');
|
|
638
739
|
var promisify = util.promisify;
|
|
639
740
|
var result = { isValid: false }, err = false;
|
|
640
|
-
|
|
741
|
+
|
|
641
742
|
await promisify(controller.query)(opt, data)
|
|
642
743
|
.then(function onResult(_result) {
|
|
643
744
|
result = _result;
|
|
@@ -649,10 +750,10 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
649
750
|
//throw err;
|
|
650
751
|
console.error(err);
|
|
651
752
|
result.error = err;
|
|
652
|
-
}
|
|
753
|
+
}
|
|
653
754
|
return result;
|
|
654
755
|
};
|
|
655
|
-
|
|
756
|
+
|
|
656
757
|
/**
|
|
657
758
|
* query
|
|
658
759
|
*/
|
|
@@ -667,16 +768,16 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
667
768
|
/**
|
|
668
769
|
* addField
|
|
669
770
|
* Add field to the validation context
|
|
670
|
-
* @param {string} el
|
|
671
|
-
* @param {string|boolean|number|object} [value]
|
|
771
|
+
* @param {string} el
|
|
772
|
+
* @param {string|boolean|number|object} [value]
|
|
672
773
|
*/
|
|
673
|
-
var addField = function(el, value) {
|
|
774
|
+
var addField = function(el, value) {
|
|
674
775
|
var val = null, label = null;
|
|
675
|
-
|
|
776
|
+
|
|
676
777
|
if ( typeof(self[el]) == 'undefined' && typeof(value) != 'undefined' ) {
|
|
677
778
|
self[el] = val = value;
|
|
678
779
|
}
|
|
679
|
-
|
|
780
|
+
|
|
680
781
|
if ( typeof(self[el]) == 'object' ) {
|
|
681
782
|
try {
|
|
682
783
|
val = JSON.parse( JSON.stringify( self[el] ))
|
|
@@ -726,17 +827,17 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
726
827
|
var alias = ( typeof(window) != 'undefined' && typeof(window._currentValidatorAlias) != 'undefined' ) ? window._currentValidatorAlias : 'is';
|
|
727
828
|
if ( typeof(window) != 'undefined' && window._currentValidatorAlias)
|
|
728
829
|
delete window._currentValidatorAlias;
|
|
729
|
-
|
|
730
|
-
var errors = self[this['name']]['errors'] || {};
|
|
830
|
+
|
|
831
|
+
var errors = self[this['name']]['errors'] || {};
|
|
731
832
|
local.data[this.name] = self[this.name].value;
|
|
732
|
-
|
|
733
|
-
if (
|
|
833
|
+
|
|
834
|
+
if (
|
|
734
835
|
typeof(errors['isRequired']) == 'undefined'
|
|
735
836
|
&& this.value == ''
|
|
736
|
-
&& !/^false$/i.test(this.value)
|
|
737
|
-
&& this.value != 0
|
|
837
|
+
&& !/^false$/i.test(this.value)
|
|
838
|
+
&& this.value != 0
|
|
738
839
|
||
|
|
739
|
-
!errors['isRequired']
|
|
840
|
+
!errors['isRequired']
|
|
740
841
|
&& this.value == ''
|
|
741
842
|
&& !/^false$/i.test(this.value)
|
|
742
843
|
&& this.value != 0
|
|
@@ -745,14 +846,14 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
745
846
|
} else if (!errors['isRequired'] && typeof(this.value) == 'string' && this.value == '') {
|
|
746
847
|
isValid = true;
|
|
747
848
|
}
|
|
748
|
-
|
|
849
|
+
|
|
749
850
|
if ( !isValid && /^(true|false)$/i.test(condition) ) { // because it can be evaluated on backend validation
|
|
750
851
|
isValid = condition;
|
|
751
852
|
} else if (!isValid) {
|
|
752
853
|
var re = null, flags = null;
|
|
753
854
|
// Fixed on 2021-03-13: $variable now replaced with real value beafore validation
|
|
754
855
|
if ( /[\!\=>\>\<a-z 0-9]+/i.test(condition) ) {
|
|
755
|
-
var variables = condition.match(/\${0}[-_,.\[\]a-z0-9]+/ig); // without space(s)
|
|
856
|
+
var variables = condition.match(/\${0}[-_,.\[\]a-z0-9]+/ig); // without space(s)
|
|
756
857
|
if (variables && variables.length > 0) {
|
|
757
858
|
var compiledCondition = condition;
|
|
758
859
|
for (var i = 0, len = variables.length; i < len; ++i) {
|
|
@@ -768,7 +869,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
768
869
|
}
|
|
769
870
|
}
|
|
770
871
|
}
|
|
771
|
-
|
|
872
|
+
|
|
772
873
|
try {
|
|
773
874
|
// security checks
|
|
774
875
|
compiledCondition = compiledCondition.replace(/(\(|\)|return)/g, '');
|
|
@@ -777,7 +878,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
777
878
|
} else {
|
|
778
879
|
isValid = eval(compiledCondition)
|
|
779
880
|
}
|
|
780
|
-
|
|
881
|
+
|
|
781
882
|
} catch (err) {
|
|
782
883
|
throw new Error(err.stack||err.message)
|
|
783
884
|
}
|
|
@@ -801,7 +902,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
801
902
|
} else {
|
|
802
903
|
isValid = eval(condition);
|
|
803
904
|
}
|
|
804
|
-
|
|
905
|
+
|
|
805
906
|
//valid = new RegExp(condition.replace(/\//g, '')).test(this.value)
|
|
806
907
|
} catch (err) {
|
|
807
908
|
throw new Error(err.stack||err.message)
|
|
@@ -814,7 +915,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
814
915
|
if ( typeof(errorStack) != 'undefined' )
|
|
815
916
|
errors['stack'] = errorStack;
|
|
816
917
|
}
|
|
817
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
918
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
818
919
|
else if ( isValid && typeof(errors[alias]) != 'undefined' ) {
|
|
819
920
|
delete errors[alias];
|
|
820
921
|
//delete errors['stack'];
|
|
@@ -824,16 +925,16 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
824
925
|
if ( errors.count() > 0 )
|
|
825
926
|
this['errors'] = errors;
|
|
826
927
|
|
|
827
|
-
|
|
928
|
+
|
|
828
929
|
return self[this.name]
|
|
829
930
|
}
|
|
830
|
-
|
|
931
|
+
|
|
831
932
|
self[el]['set'] = function(value) {
|
|
832
933
|
this.value = local['data'][this.name] = value;
|
|
833
|
-
// html
|
|
934
|
+
// html
|
|
834
935
|
this.target.setAttribute('value', value);
|
|
835
936
|
// Todo : select and radio case to apply change
|
|
836
|
-
|
|
937
|
+
|
|
837
938
|
return self[this.name]
|
|
838
939
|
}
|
|
839
940
|
|
|
@@ -842,15 +943,15 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
842
943
|
|
|
843
944
|
this.value = local['data'][this.name] = (this.value) ? this.value.toLowerCase() : this.value;
|
|
844
945
|
// Apply on current field upper -> lower
|
|
845
|
-
if (
|
|
946
|
+
if (
|
|
846
947
|
isGFFCtx
|
|
847
948
|
&& this.target
|
|
848
|
-
&& this.target.value != ''
|
|
849
|
-
&& /[A-Z]+/.test(this.target.value)
|
|
949
|
+
&& this.target.value != ''
|
|
950
|
+
&& /[A-Z]+/.test(this.target.value)
|
|
850
951
|
) {
|
|
851
952
|
this.target.value = this.value;
|
|
852
953
|
}
|
|
853
|
-
|
|
954
|
+
|
|
854
955
|
|
|
855
956
|
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
957
|
var isValid = rgx.test(this['value']) ? true : false;
|
|
@@ -863,7 +964,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
863
964
|
if (!isValid) {
|
|
864
965
|
errors['isEmail'] = replace(this['error'] || local.errorLabels['isEmail'], this)
|
|
865
966
|
}
|
|
866
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
967
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
867
968
|
else if ( isValid && typeof(errors['isEmail']) != 'undefined' ) {
|
|
868
969
|
delete errors['isEmail'];
|
|
869
970
|
//delete errors['stack'];
|
|
@@ -882,11 +983,11 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
882
983
|
|
|
883
984
|
this.value = local['data'][this.name] = (this.value) ? this.value.toLowerCase() : this.value;
|
|
884
985
|
// Apply on current field upper -> lower
|
|
885
|
-
if (
|
|
986
|
+
if (
|
|
886
987
|
isGFFCtx
|
|
887
988
|
&& this.target
|
|
888
|
-
&& this.target.value != ''
|
|
889
|
-
&& /[A-Z]+/.test(this.target.value)
|
|
989
|
+
&& this.target.value != ''
|
|
990
|
+
&& /[A-Z]+/.test(this.target.value)
|
|
890
991
|
) {
|
|
891
992
|
this.target.value = this.value;
|
|
892
993
|
}
|
|
@@ -902,7 +1003,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
902
1003
|
if (!isValid) {
|
|
903
1004
|
errors['isJsonWebToken'] = replace(this['error'] || local.errorLabels['isJsonWebToken'], this)
|
|
904
1005
|
}
|
|
905
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1006
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
906
1007
|
else if ( isValid && typeof(errors['isJsonWebToken']) != 'undefined' ) {
|
|
907
1008
|
delete errors['isJsonWebToken'];
|
|
908
1009
|
//delete errors['stack'];
|
|
@@ -915,7 +1016,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
915
1016
|
|
|
916
1017
|
return self[this['name']]
|
|
917
1018
|
}
|
|
918
|
-
|
|
1019
|
+
|
|
919
1020
|
/**
|
|
920
1021
|
* Check if boolean and convert to `true/false` booloean if value is a string or a number
|
|
921
1022
|
* Will include `false` value if isRequired
|
|
@@ -943,13 +1044,13 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
943
1044
|
val = this.value = local.data[this.name] = false;
|
|
944
1045
|
break;
|
|
945
1046
|
}
|
|
946
|
-
|
|
1047
|
+
|
|
947
1048
|
var isValid = (val !== null) ? true : false;
|
|
948
1049
|
|
|
949
1050
|
if (!isValid) {
|
|
950
1051
|
errors['isBoolean'] = replace(this.error || local.errorLabels['isBoolean'], this)
|
|
951
1052
|
}
|
|
952
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1053
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
953
1054
|
else if ( isValid && typeof(errors['isBoolean']) != 'undefined' ) {
|
|
954
1055
|
delete errors['isBoolean'];
|
|
955
1056
|
//delete errors['stack'];
|
|
@@ -981,7 +1082,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
981
1082
|
, isMaxLength = true
|
|
982
1083
|
, errors = self[this['name']]['errors'] || {}
|
|
983
1084
|
;
|
|
984
|
-
|
|
1085
|
+
|
|
985
1086
|
// test if val is a number
|
|
986
1087
|
try {
|
|
987
1088
|
// if val is a string replaces comas by points
|
|
@@ -1030,7 +1131,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1030
1131
|
|
|
1031
1132
|
isValid = false;
|
|
1032
1133
|
}
|
|
1033
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1134
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1034
1135
|
if ( isValid && typeof(errors['isNumberLength']) != 'undefined') {
|
|
1035
1136
|
delete errors['isNumberLength'];
|
|
1036
1137
|
}
|
|
@@ -1136,7 +1237,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1136
1237
|
// document.getElementById(this.target.id).value = this.value;
|
|
1137
1238
|
// //triggerEvent(gina, this.target, 'change', self[this['name']]);
|
|
1138
1239
|
// }
|
|
1139
|
-
|
|
1240
|
+
|
|
1140
1241
|
} else {
|
|
1141
1242
|
this.value = this.value.replace(/\,/g,'');
|
|
1142
1243
|
}
|
|
@@ -1249,7 +1350,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1249
1350
|
if ( typeof(isApplicable) == 'boolean' && !isApplicable ) {
|
|
1250
1351
|
|
|
1251
1352
|
this.valid = true;
|
|
1252
|
-
|
|
1353
|
+
|
|
1253
1354
|
// is in excluded ?
|
|
1254
1355
|
var excludedIndex = local.excluded.indexOf(this.name);
|
|
1255
1356
|
if ( excludedIndex > -1 ) {
|
|
@@ -1260,12 +1361,12 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1260
1361
|
}
|
|
1261
1362
|
|
|
1262
1363
|
// 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'
|
|
1364
|
+
if (
|
|
1365
|
+
isGFFCtx
|
|
1366
|
+
&& this.target
|
|
1367
|
+
&& this.target.tagName == 'INPUT'
|
|
1368
|
+
&& typeof(this.target.type) != 'undefined'
|
|
1369
|
+
&& this.target.type == 'radio'
|
|
1269
1370
|
) {
|
|
1270
1371
|
var radios = document.getElementsByName(this.name);
|
|
1271
1372
|
for (var i = 0, len = radios.length; i < len; ++i) {
|
|
@@ -1290,7 +1391,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1290
1391
|
if (!isValid) {
|
|
1291
1392
|
errors['isRequired'] = replace(this.error || local.errorLabels['isRequired'], this)
|
|
1292
1393
|
}
|
|
1293
|
-
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1394
|
+
// if error tagged by a previous vlaidation, remove it when isValid == true
|
|
1294
1395
|
else if ( isValid ) {
|
|
1295
1396
|
if (typeof(errors['isRequired']) != 'undefined' )
|
|
1296
1397
|
delete errors['isRequired'];
|
|
@@ -1315,7 +1416,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1315
1416
|
* {
|
|
1316
1417
|
* "password": {
|
|
1317
1418
|
* "isRequired": true,
|
|
1318
|
-
*
|
|
1419
|
+
*
|
|
1319
1420
|
* "isString": true // Means that we just want a string and we don't care of its length
|
|
1320
1421
|
* // OR
|
|
1321
1422
|
* "isString": 7 // Means at least 7 chars length
|
|
@@ -1393,9 +1494,9 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1393
1494
|
*
|
|
1394
1495
|
* @param {string|boolean} [mask] - by default "yyyy-mm-dd"
|
|
1395
1496
|
*
|
|
1396
|
-
* @returns {date} date - extended by gina::
|
|
1497
|
+
* @returns {date} date - extended by gina::lib::helpers::dateFormat; an adaptation of Steven Levithan's code
|
|
1397
1498
|
* */
|
|
1398
|
-
self[el]['isDate'] = function(mask) {
|
|
1499
|
+
self[el]['isDate'] = function(mask) {
|
|
1399
1500
|
var val = this.value
|
|
1400
1501
|
, isValid = false
|
|
1401
1502
|
, errors = self[this['name']]['errors'] || {}
|
|
@@ -1403,37 +1504,37 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1403
1504
|
, date = null
|
|
1404
1505
|
;
|
|
1405
1506
|
// Default validation on livecheck & invalid init value
|
|
1406
|
-
if (!val || val == '' || /NaN|Invalid Date/i.test(val) ) {
|
|
1507
|
+
if (!val || val == '' || /NaN|Invalid Date/i.test(val) ) {
|
|
1407
1508
|
if ( /NaN|Invalid Date/i.test(val) ) {
|
|
1408
1509
|
console.warn('[FormValidator::isDate] Provided value for field `'+ this.name +'` is not allowed: `'+ val +'`');
|
|
1409
1510
|
errors['isDate'] = replace(this.error || local.errorLabels['isDate'], this);
|
|
1410
|
-
|
|
1511
|
+
|
|
1411
1512
|
}
|
|
1412
1513
|
this.valid = isValid;
|
|
1413
1514
|
if ( errors.count() > 0 )
|
|
1414
|
-
this['errors'] = errors;
|
|
1415
|
-
|
|
1515
|
+
this['errors'] = errors;
|
|
1516
|
+
|
|
1416
1517
|
return self[this.name];
|
|
1417
1518
|
}
|
|
1418
|
-
|
|
1419
|
-
if (
|
|
1519
|
+
|
|
1520
|
+
if (
|
|
1420
1521
|
typeof(mask) == 'undefined'
|
|
1421
1522
|
||
|
|
1422
1523
|
typeof(mask) != 'undefined' && /true/i.test(mask)
|
|
1423
1524
|
) {
|
|
1424
1525
|
mask = "yyyy-mm-dd"; // by default
|
|
1425
1526
|
}
|
|
1426
|
-
|
|
1527
|
+
|
|
1427
1528
|
if (val instanceof Date) {
|
|
1428
1529
|
date = val.format(mask);
|
|
1429
1530
|
} else {
|
|
1430
|
-
|
|
1531
|
+
|
|
1431
1532
|
try {
|
|
1432
1533
|
m = mask.match(/[^\/\- ]+/g);
|
|
1433
1534
|
} catch (err) {
|
|
1434
1535
|
throw new Error('[FormValidator::isDate] Provided mask not allowed: `'+ mask +'`');
|
|
1435
1536
|
}
|
|
1436
|
-
|
|
1537
|
+
|
|
1437
1538
|
try {
|
|
1438
1539
|
val = val.match(/[^\/\- ]+/g);
|
|
1439
1540
|
var dic = {}, d, len;
|
|
@@ -1447,10 +1548,10 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1447
1548
|
} catch (err) {
|
|
1448
1549
|
throw new Error('[FormValidator::isDate] Provided value not allowed: `'+ val +'`' + err);
|
|
1449
1550
|
}
|
|
1450
|
-
|
|
1551
|
+
|
|
1451
1552
|
|
|
1452
1553
|
date = this.value = local.data[this.name] = new Date(formatedDate);
|
|
1453
|
-
|
|
1554
|
+
|
|
1454
1555
|
if ( /Invalid Date/i.test(date) || date instanceof Date === false ) {
|
|
1455
1556
|
if ( !errors['isRequired'] && this.value == '' ) {
|
|
1456
1557
|
isValid = true
|
|
@@ -1474,7 +1575,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1474
1575
|
|
|
1475
1576
|
/**
|
|
1476
1577
|
* Formating date using DateFormatHelper
|
|
1477
|
-
* Check out documentation in the helper source: `
|
|
1578
|
+
* Check out documentation in the helper source: `lib/helpers/dateFormat.js`
|
|
1478
1579
|
* e.g.:
|
|
1479
1580
|
* d.start
|
|
1480
1581
|
* .isDate('dd/mm/yyyy')
|
|
@@ -1512,7 +1613,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1512
1613
|
}
|
|
1513
1614
|
return self[this.name]
|
|
1514
1615
|
}
|
|
1515
|
-
|
|
1616
|
+
|
|
1516
1617
|
/**
|
|
1517
1618
|
* Trim when string starts or ends with white space(s)
|
|
1518
1619
|
*
|
|
@@ -1536,11 +1637,11 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1536
1637
|
self[el]['exclude'] = function(isApplicable) {
|
|
1537
1638
|
|
|
1538
1639
|
if ( typeof(isApplicable) == 'boolean' && !isApplicable ) {
|
|
1539
|
-
|
|
1640
|
+
|
|
1540
1641
|
if ( /^true|false$/i.test(this.value)) {
|
|
1541
1642
|
this.value = (/^true$/i.test(this.value)) ? true : false;
|
|
1542
1643
|
local.data[this.name] = this.value;
|
|
1543
|
-
}
|
|
1644
|
+
}
|
|
1544
1645
|
|
|
1545
1646
|
return self[this.name]
|
|
1546
1647
|
}
|
|
@@ -1550,8 +1651,8 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1550
1651
|
local.excluded.push(this.name);
|
|
1551
1652
|
this.isExcluded = true;
|
|
1552
1653
|
}
|
|
1553
|
-
|
|
1554
|
-
|
|
1654
|
+
|
|
1655
|
+
|
|
1555
1656
|
// remove existing errors
|
|
1556
1657
|
return self[this.name];
|
|
1557
1658
|
}
|
|
@@ -1561,8 +1662,8 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1561
1662
|
* a request to the remote host if previous rules failed
|
|
1562
1663
|
*/
|
|
1563
1664
|
self[el]['query'] = query;
|
|
1564
|
-
|
|
1565
|
-
|
|
1665
|
+
|
|
1666
|
+
|
|
1566
1667
|
self[el]['getValidationContext'] = function() {
|
|
1567
1668
|
return {
|
|
1568
1669
|
'isGFFCtx' : isGFFCtx,
|
|
@@ -1572,10 +1673,10 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1572
1673
|
}
|
|
1573
1674
|
}
|
|
1574
1675
|
// Merging user validators
|
|
1575
|
-
// To debug, open inspector and look into `Extra Scripts`
|
|
1676
|
+
// To debug, open inspector and look into `Extra Scripts`
|
|
1576
1677
|
if ( hasUserValidators() ) {
|
|
1577
1678
|
var userValidator = null, filename = null;
|
|
1578
|
-
try {
|
|
1679
|
+
try {
|
|
1579
1680
|
for (let v in gina.forms.validators) {
|
|
1580
1681
|
filename = '/validators/'+ v + '/main.js';
|
|
1581
1682
|
// setting default local error
|
|
@@ -1586,12 +1687,12 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1586
1687
|
userValidator = bufferToString(gina.forms.validators[v].data); // ok
|
|
1587
1688
|
var passedContext = 'var validationContext = this.getValidationContext(),isGFFCtx = validationContext.isGFFCtx,self = validationContext.self,local = validationContext.local,replace = validationContext.replace;';
|
|
1588
1689
|
userValidator = userValidator.replace(/(\)\s+\{|\)\{){1}/, '$&\n\t'+ passedContext);
|
|
1589
|
-
|
|
1690
|
+
|
|
1590
1691
|
//userValidator += '\n//#sourceURL='+ v +'.js';
|
|
1591
1692
|
} else {
|
|
1592
1693
|
userValidator = gina.forms.validators[v].toString();
|
|
1593
1694
|
}
|
|
1594
|
-
|
|
1695
|
+
|
|
1595
1696
|
self[el][v] = eval('(' + userValidator + ')\n//# sourceURL='+ v +'.js');
|
|
1596
1697
|
//self[el][v] = Function('errorMessage', 'errorStack', userValidator);
|
|
1597
1698
|
}
|
|
@@ -1599,22 +1700,22 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1599
1700
|
throw new Error('[UserFormValidator] Could not evaluate: `'+ filename +'`\n'+userValidatorError.stack);
|
|
1600
1701
|
}
|
|
1601
1702
|
}
|
|
1602
|
-
} // EO addField(el, value)
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
for (let el in self) {
|
|
1703
|
+
} // EO addField(el, value)
|
|
1704
|
+
|
|
1705
|
+
|
|
1706
|
+
for (let el in self) {
|
|
1606
1707
|
// Adding fields & validators to context
|
|
1607
1708
|
addField(el, self[el]);
|
|
1608
1709
|
}
|
|
1609
|
-
|
|
1710
|
+
|
|
1610
1711
|
self['addField'] = function(el, value) {
|
|
1611
1712
|
if ( typeof(self[el]) != 'undefined' ) {
|
|
1612
1713
|
return
|
|
1613
1714
|
}
|
|
1614
1715
|
addField(el, value);
|
|
1615
1716
|
};
|
|
1616
|
-
|
|
1617
|
-
|
|
1717
|
+
|
|
1718
|
+
|
|
1618
1719
|
// self['getExcludedFields'] = function() {
|
|
1619
1720
|
// return local.excluded;
|
|
1620
1721
|
// };
|
|
@@ -1644,33 +1745,33 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1644
1745
|
// }
|
|
1645
1746
|
for (var r in self[field]) {
|
|
1646
1747
|
// no error for the current field rule
|
|
1647
|
-
if (
|
|
1748
|
+
if (
|
|
1648
1749
|
typeof(errors[field]) != 'object'
|
|
1649
1750
|
||
|
|
1650
1751
|
typeof(errors[field][r]) == 'undefined'
|
|
1651
1752
|
) {
|
|
1652
1753
|
continue;
|
|
1653
1754
|
}
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
if (
|
|
1657
|
-
typeof(self[field].valid) != 'undefined'
|
|
1658
|
-
&& /^true$/i.test(self[field].valid)
|
|
1755
|
+
|
|
1756
|
+
|
|
1757
|
+
if (
|
|
1758
|
+
typeof(self[field].valid) != 'undefined'
|
|
1759
|
+
&& /^true$/i.test(self[field].valid)
|
|
1659
1760
|
) {
|
|
1660
1761
|
delete errors[field][r];
|
|
1661
1762
|
continue;
|
|
1662
1763
|
}
|
|
1663
|
-
|
|
1664
|
-
|
|
1764
|
+
|
|
1765
|
+
|
|
1665
1766
|
if ( typeof( self[field]['errors']) == 'undefined' ) {
|
|
1666
1767
|
self[field]['errors'] = {}
|
|
1667
1768
|
}
|
|
1668
|
-
|
|
1669
|
-
self[field]['errors'][r] = errors[field][r];
|
|
1769
|
+
|
|
1770
|
+
self[field]['errors'][r] = errors[field][r];
|
|
1670
1771
|
}
|
|
1671
|
-
|
|
1772
|
+
|
|
1672
1773
|
// if field does not have errors, remove errors[field]
|
|
1673
|
-
if (
|
|
1774
|
+
if (
|
|
1674
1775
|
typeof(self[field]['errors']) == 'undefined'
|
|
1675
1776
|
&& typeof(errors[field]) != 'undefined'
|
|
1676
1777
|
||
|
|
@@ -1687,34 +1788,34 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1687
1788
|
/**
|
|
1688
1789
|
* getErrors
|
|
1689
1790
|
* NB.: This portion is shared between the front & the back
|
|
1690
|
-
*
|
|
1791
|
+
*
|
|
1691
1792
|
* @param {string} [fieldName]
|
|
1692
|
-
*
|
|
1793
|
+
*
|
|
1693
1794
|
* @returns errors
|
|
1694
1795
|
*/
|
|
1695
1796
|
self['getErrors'] = function(fieldName) {
|
|
1696
1797
|
var errors = {};
|
|
1697
|
-
|
|
1798
|
+
|
|
1698
1799
|
if ( typeof(fieldName) != 'undefined' ) {
|
|
1699
1800
|
if ( typeof(self[fieldName]) != 'undefined' && self[fieldName] && typeof(self[fieldName]['errors']) != 'undefined' && self[fieldName]['errors'].count() > 0 ) {
|
|
1700
1801
|
errors[fieldName] = self[fieldName]['errors'];
|
|
1701
|
-
}
|
|
1802
|
+
}
|
|
1702
1803
|
return errors
|
|
1703
1804
|
}
|
|
1704
|
-
|
|
1805
|
+
|
|
1705
1806
|
for (var field in self) {
|
|
1706
|
-
if (
|
|
1807
|
+
if (
|
|
1707
1808
|
typeof(self[field]) != 'object'
|
|
1708
1809
|
) {
|
|
1709
1810
|
continue;
|
|
1710
1811
|
}
|
|
1711
|
-
|
|
1812
|
+
|
|
1712
1813
|
if ( typeof(self[field]['errors']) != 'undefined' ) {
|
|
1713
1814
|
if ( self[field]['errors'].count() > 0)
|
|
1714
1815
|
errors[field] = self[field]['errors'];
|
|
1715
1816
|
}
|
|
1716
1817
|
}
|
|
1717
|
-
|
|
1818
|
+
|
|
1718
1819
|
return errors
|
|
1719
1820
|
}
|
|
1720
1821
|
|
|
@@ -1731,7 +1832,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet) {
|
|
|
1731
1832
|
// local.data = JSON.parse(JSON.stringify(local.data).replace(/\"(true|false)\"/gi, '$1'))
|
|
1732
1833
|
return local.data
|
|
1733
1834
|
}
|
|
1734
|
-
|
|
1835
|
+
|
|
1735
1836
|
/**@js_externs replace*/
|
|
1736
1837
|
var replace = function(target, fieldObj) {
|
|
1737
1838
|
var keys = target.match(/%[a-z]+/gi);
|