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