gina 0.0.9-p91b → 0.1.1-alpha.2

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.
Files changed (466) hide show
  1. package/INSTALL.md +46 -0
  2. package/{core/asset/html/static.html → Icon/r} +0 -0
  3. package/LICENSE +1 -1
  4. package/README-4Contributors.md +96 -0
  5. package/README.md +296 -104
  6. package/bin/cli +287 -0
  7. package/bin/cli-debug +60 -0
  8. package/bin/cmd +184 -0
  9. package/bin/gina +180 -0
  10. package/config/logger.json +17 -0
  11. package/doc/framework/cli/doc.json +9 -0
  12. package/doc/framework/index.md +60 -0
  13. package/framework/v0.1.1-alpha.2/AUTHORS +7 -0
  14. package/{core/utils/lib/inherits → framework/v0.1.1-alpha.2}/LICENSE +1 -1
  15. package/framework/v0.1.1-alpha.2/VERSION +1 -0
  16. package/{core/locales/dist/language/en.json → framework/v0.1.1-alpha.2/core/asset/html/nolayout.html} +0 -0
  17. package/{core/locales/dist/language/fr.json → framework/v0.1.1-alpha.2/core/asset/html/static.html} +0 -0
  18. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/android-chrome-192x192.png +0 -0
  19. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/android-chrome-512x512.png +0 -0
  20. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/apple-touch-icon.png +0 -0
  21. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/favicon-16x16.png +0 -0
  22. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/favicon-32x32.png +0 -0
  23. package/{core → framework/v0.1.1-alpha.2/core}/asset/img/favicon.ico +0 -0
  24. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.js +20904 -0
  25. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.js.map +56 -0
  26. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.css +1 -0
  27. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.css.map +1 -0
  28. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.js +736 -0
  29. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.min.js.map +56 -0
  30. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.onload.min.js +5 -0
  31. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/dist/gina.onload.min.js.map +8 -0
  32. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/readme.md +192 -0
  33. package/framework/v0.1.1-alpha.2/core/asset/js/plugin/uuid.json +23 -0
  34. package/framework/v0.1.1-alpha.2/core/config.js +2308 -0
  35. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/index.js +757 -0
  36. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/connector.js +20 -0
  37. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/connector.v2.js +429 -0
  38. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/connector.v3.js +432 -0
  39. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/n1ql.js +14 -0
  40. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/session-store.js +21 -0
  41. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/session-store.v2.js +258 -0
  42. package/framework/v0.1.1-alpha.2/core/connectors/couchbase/lib/session-store.v3.js +341 -0
  43. package/{core → framework/v0.1.1-alpha.2/core}/controller/controller.framework.js +3 -2
  44. package/framework/v0.1.1-alpha.2/core/controller/controller.js +3990 -0
  45. package/{core → framework/v0.1.1-alpha.2/core}/controller/index.js +5 -5
  46. package/framework/v0.1.1-alpha.2/core/deps/busboy/.travis.yml +17 -0
  47. package/framework/v0.1.1-alpha.2/core/deps/busboy/LICENSE +19 -0
  48. package/framework/v0.1.1-alpha.2/core/deps/busboy/README.md +225 -0
  49. package/framework/v0.1.1-alpha.2/core/deps/busboy/deps/encoding/encoding-indexes.js +73 -0
  50. package/framework/v0.1.1-alpha.2/core/deps/busboy/deps/encoding/encoding.js +2391 -0
  51. package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/main.js +89 -0
  52. package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/types/multipart.js +328 -0
  53. package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/types/urlencoded.js +214 -0
  54. package/framework/v0.1.1-alpha.2/core/deps/busboy/lib/utils.js +191 -0
  55. package/framework/v0.1.1-alpha.2/core/deps/busboy/package.json +69 -0
  56. package/framework/v0.1.1-alpha.2/core/deps/swig-client/swig-2.0.0.min.js +5 -0
  57. package/{core → framework/v0.1.1-alpha.2/core}/dev/index.js +5 -5
  58. package/{core → framework/v0.1.1-alpha.2/core}/dev/lib/class.js +1 -1
  59. package/{core → framework/v0.1.1-alpha.2/core}/dev/lib/factory.js +1 -1
  60. package/{core → framework/v0.1.1-alpha.2/core}/dev/lib/tools.js +0 -0
  61. package/framework/v0.1.1-alpha.2/core/gna.js +1070 -0
  62. package/{core → framework/v0.1.1-alpha.2/core}/locales/README.md +41 -2
  63. package/{core → framework/v0.1.1-alpha.2/core}/locales/currency.json +0 -0
  64. package/{core/plugins/README.md → framework/v0.1.1-alpha.2/core/locales/dist/language/en.json} +0 -0
  65. package/{core/plugins/lib/intl/README.md → framework/v0.1.1-alpha.2/core/locales/dist/language/fr.json} +0 -0
  66. package/{core → framework/v0.1.1-alpha.2/core}/locales/dist/region/en.json +0 -0
  67. package/framework/v0.1.1-alpha.2/core/locales/dist/region/fr.json +9492 -0
  68. package/{core → framework/v0.1.1-alpha.2/core}/locales/index.js +5 -4
  69. package/{core → framework/v0.1.1-alpha.2/core}/locales/src/make.js +15 -12
  70. package/{core → framework/v0.1.1-alpha.2/core}/locales/src/resources/currency.csv +0 -0
  71. package/{core → framework/v0.1.1-alpha.2/core}/locales/src/resources/region.csv +0 -0
  72. package/{core → framework/v0.1.1-alpha.2/core}/locales/src/resources/region.mapping.json +0 -0
  73. package/{core → framework/v0.1.1-alpha.2/core}/mime.types +0 -0
  74. package/{core → framework/v0.1.1-alpha.2/core}/model/entity.js +156 -196
  75. package/{core → framework/v0.1.1-alpha.2/core}/model/index.js +67 -48
  76. package/{core → framework/v0.1.1-alpha.2/core}/model/template/entityFactory.js +2 -2
  77. package/{core → framework/v0.1.1-alpha.2/core}/model/template/index.js +8 -10
  78. package/{core/plugins/lib/storage → framework/v0.1.1-alpha.2/core/plugins}/README.md +0 -0
  79. package/{core → framework/v0.1.1-alpha.2/core}/plugins/index.js +3 -3
  80. package/{core/plugins/lib/validator → framework/v0.1.1-alpha.2/core/plugins/lib/file}/README.md +0 -0
  81. package/{core/plugins/lib/intl → framework/v0.1.1-alpha.2/core/plugins/lib/file}/build.json +0 -0
  82. package/framework/v0.1.1-alpha.2/core/plugins/lib/file/package.json +25 -0
  83. package/{core/utils/lib/collection → framework/v0.1.1-alpha.2/core/plugins/lib/intl}/README.md +0 -0
  84. package/{core/plugins/lib/storage → framework/v0.1.1-alpha.2/core/plugins/lib/intl}/build.json +0 -0
  85. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/intl/package.json +3 -3
  86. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/intl/src/main.js +17 -1
  87. package/{core/utils/lib/routing → framework/v0.1.1-alpha.2/core/plugins/lib/storage}/README.md +0 -0
  88. package/{core/plugins/lib/validator → framework/v0.1.1-alpha.2/core/plugins/lib/storage}/build.json +0 -0
  89. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/storage/package.json +2 -2
  90. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/storage/src/main.js +91 -85
  91. package/{core/utils/lib/url → framework/v0.1.1-alpha.2/core/plugins/lib/validator}/README.md +0 -0
  92. package/{core/utils/lib/collection → framework/v0.1.1-alpha.2/core/plugins/lib/validator}/build.json +0 -0
  93. package/{core → framework/v0.1.1-alpha.2/core}/plugins/lib/validator/package.json +3 -3
  94. package/framework/v0.1.1-alpha.2/core/plugins/lib/validator/src/form-validator.js +1762 -0
  95. package/framework/v0.1.1-alpha.2/core/plugins/lib/validator/src/main.js +6917 -0
  96. package/framework/v0.1.1-alpha.2/core/router.js +664 -0
  97. package/framework/v0.1.1-alpha.2/core/server.express.js +213 -0
  98. package/framework/v0.1.1-alpha.2/core/server.isaac.js +386 -0
  99. package/framework/v0.1.1-alpha.2/core/server.js +3010 -0
  100. package/{core → framework/v0.1.1-alpha.2/core}/status.codes +8 -0
  101. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/app.json +6 -0
  102. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/routing.json +11 -0
  103. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/settings.json +9 -0
  104. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/settings.server.json +30 -0
  105. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/config/templates.json +42 -0
  106. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/controllers/controller.content.js +39 -0
  107. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/controllers/controller.js +30 -0
  108. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle/controllers/setup.js +111 -0
  109. package/{core/template/samples → framework/v0.1.1-alpha.2/core/template/boilerplate}/bundle/index.js +0 -0
  110. package/{core/template/samples/bundle → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_namespace}/controllers/controller.js +9 -7
  111. package/{core/template/views → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public}/css/default.css +0 -0
  112. package/{core/template/views → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public}/css/vendor/readme.md +0 -0
  113. package/{core/template/views → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public}/favicon.ico +0 -0
  114. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public/js/vendor/readme.md +1 -0
  115. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_public/readme.md +1 -0
  116. package/framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_templates/handlers/main.js +24 -0
  117. package/{core/template/views/html/default.html → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_templates/html/homepage.html} +0 -0
  118. package/{core/template/views/html/layout.html → framework/v0.1.1-alpha.2/core/template/boilerplate/bundle_templates/html/layout/main.html} +2 -2
  119. package/{core → framework/v0.1.1-alpha.2/core}/template/command/gina.bat.tpl +0 -0
  120. package/{core → framework/v0.1.1-alpha.2/core}/template/command/gina.tpl +1 -1
  121. package/framework/v0.1.1-alpha.2/core/template/conf/env.json +76 -0
  122. package/{core/template/conf/project.json → framework/v0.1.1-alpha.2/core/template/conf/manifest.json} +1 -0
  123. package/{core → framework/v0.1.1-alpha.2/core}/template/conf/package.json +2 -2
  124. package/framework/v0.1.1-alpha.2/core/template/conf/settings.json +92 -0
  125. package/framework/v0.1.1-alpha.2/core/template/conf/statics.json +10 -0
  126. package/framework/v0.1.1-alpha.2/core/template/conf/templates.json +37 -0
  127. package/{core → framework/v0.1.1-alpha.2/core}/template/error/client/json/401.json +0 -0
  128. package/{core → framework/v0.1.1-alpha.2/core}/template/error/client/json/403.json +0 -0
  129. package/{core → framework/v0.1.1-alpha.2/core}/template/error/client/json/404.json +0 -0
  130. package/{core → framework/v0.1.1-alpha.2/core}/template/error/server/html/50x.html +0 -0
  131. package/{core → framework/v0.1.1-alpha.2/core}/template/error/server/json/500.json +0 -0
  132. package/{core → framework/v0.1.1-alpha.2/core}/template/error/server/json/503.json +0 -0
  133. package/{core/utils/lib/routing/build.json → framework/v0.1.1-alpha.2/core/template/extensions/logger/config.json} +0 -0
  134. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/console.js +3 -3
  135. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/context.js +240 -49
  136. package/framework/v0.1.1-alpha.2/helpers/dateFormat.js +528 -0
  137. package/framework/v0.1.1-alpha.2/helpers/index.js +79 -0
  138. package/framework/v0.1.1-alpha.2/helpers/json/README.md +0 -0
  139. package/framework/v0.1.1-alpha.2/helpers/json/package.json +20 -0
  140. package/framework/v0.1.1-alpha.2/helpers/json/src/main.js +97 -0
  141. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/path.js +342 -140
  142. package/framework/v0.1.1-alpha.2/helpers/plugins/README.md +4 -0
  143. package/framework/v0.1.1-alpha.2/helpers/plugins/package.json +20 -0
  144. package/framework/v0.1.1-alpha.2/helpers/plugins/src/api-error.js +160 -0
  145. package/framework/v0.1.1-alpha.2/helpers/plugins/src/main.js +32 -0
  146. package/framework/v0.1.1-alpha.2/helpers/prototypes.js +218 -0
  147. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/task.js +49 -29
  148. package/{core/utils → framework/v0.1.1-alpha.2}/helpers/text.js +7 -7
  149. package/framework/v0.1.1-alpha.2/lib/archiver/README.md +0 -0
  150. package/framework/v0.1.1-alpha.2/lib/archiver/build.json +0 -0
  151. package/framework/v0.1.1-alpha.2/lib/archiver/package.json +20 -0
  152. package/framework/v0.1.1-alpha.2/lib/archiver/src/dep/jszip.min.js +15 -0
  153. package/framework/v0.1.1-alpha.2/lib/archiver/src/main.js +499 -0
  154. package/framework/v0.1.1-alpha.2/lib/cmd/aliases.json +13 -0
  155. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/add.js +507 -0
  156. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/arguments.json +4 -0
  157. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/copy.js +15 -0
  158. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/cp.js +2 -0
  159. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/help.js +28 -0
  160. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/help.txt +67 -0
  161. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/list.js +129 -0
  162. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/remove.js +229 -0
  163. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/rename.js +4 -0
  164. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/restart.js +235 -0
  165. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/rm.js +2 -0
  166. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/start.js +394 -0
  167. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/status.js +3 -0
  168. package/framework/v0.1.1-alpha.2/lib/cmd/bundle/stop.js +232 -0
  169. package/framework/v0.1.1-alpha.2/lib/cmd/env/add.js +436 -0
  170. package/framework/v0.1.1-alpha.2/lib/cmd/env/get.js +62 -0
  171. package/framework/v0.1.1-alpha.2/lib/cmd/env/help.js +28 -0
  172. package/framework/v0.1.1-alpha.2/lib/cmd/env/help.txt +33 -0
  173. package/framework/v0.1.1-alpha.2/lib/cmd/env/link-dev.js +80 -0
  174. package/framework/v0.1.1-alpha.2/lib/cmd/env/list.js +111 -0
  175. package/framework/v0.1.1-alpha.2/lib/cmd/env/remove.js +150 -0
  176. package/framework/v0.1.1-alpha.2/lib/cmd/env/rm.js +2 -0
  177. package/framework/v0.1.1-alpha.2/lib/cmd/env/set.js +57 -0
  178. package/framework/v0.1.1-alpha.2/lib/cmd/env/unset.js +44 -0
  179. package/framework/v0.1.1-alpha.2/lib/cmd/env/use.js +79 -0
  180. package/framework/v0.1.1-alpha.2/lib/cmd/framework/dot.js +70 -0
  181. package/framework/v0.1.1-alpha.2/lib/cmd/framework/get.js +0 -0
  182. package/framework/v0.1.1-alpha.2/lib/cmd/framework/help.js +39 -0
  183. package/framework/v0.1.1-alpha.2/lib/cmd/framework/help.txt +31 -0
  184. package/framework/v0.1.1-alpha.2/lib/cmd/framework/init.js +514 -0
  185. package/{core/utils/lib/cmd → framework/v0.1.1-alpha.2/lib/cmd/framework}/msg.json +3 -3
  186. package/framework/v0.1.1-alpha.2/lib/cmd/framework/open.js +50 -0
  187. package/framework/v0.1.1-alpha.2/lib/cmd/framework/restart.js +124 -0
  188. package/framework/v0.1.1-alpha.2/lib/cmd/framework/set.js +161 -0
  189. package/framework/v0.1.1-alpha.2/lib/cmd/framework/start.js +96 -0
  190. package/framework/v0.1.1-alpha.2/lib/cmd/framework/status.js +72 -0
  191. package/framework/v0.1.1-alpha.2/lib/cmd/framework/stop.js +159 -0
  192. package/framework/v0.1.1-alpha.2/lib/cmd/framework/tail.js +183 -0
  193. package/framework/v0.1.1-alpha.2/lib/cmd/framework/update.js +0 -0
  194. package/framework/v0.1.1-alpha.2/lib/cmd/framework/version.js +44 -0
  195. package/framework/v0.1.1-alpha.2/lib/cmd/gina-dev.1.md +66 -0
  196. package/framework/v0.1.1-alpha.2/lib/cmd/gina-framework.1.md +100 -0
  197. package/framework/v0.1.1-alpha.2/lib/cmd/gina.1.md +79 -0
  198. package/framework/v0.1.1-alpha.2/lib/cmd/helper.js +1147 -0
  199. package/framework/v0.1.1-alpha.2/lib/cmd/index.js +170 -0
  200. package/framework/v0.1.1-alpha.2/lib/cmd/msg.json +20 -0
  201. package/framework/v0.1.1-alpha.2/lib/cmd/port/help.js +28 -0
  202. package/framework/v0.1.1-alpha.2/lib/cmd/port/help.txt +31 -0
  203. package/framework/v0.1.1-alpha.2/lib/cmd/port/inc/scan.js +108 -0
  204. package/framework/v0.1.1-alpha.2/lib/cmd/port/list.js +176 -0
  205. package/framework/v0.1.1-alpha.2/lib/cmd/port/set.js +0 -0
  206. package/framework/v0.1.1-alpha.2/lib/cmd/project/add.js +528 -0
  207. package/framework/v0.1.1-alpha.2/lib/cmd/project/arguments.json +9 -0
  208. package/framework/v0.1.1-alpha.2/lib/cmd/project/build.js +115 -0
  209. package/framework/v0.1.1-alpha.2/lib/cmd/project/help.js +28 -0
  210. package/framework/v0.1.1-alpha.2/lib/cmd/project/help.txt +76 -0
  211. package/framework/v0.1.1-alpha.2/lib/cmd/project/import.js +2 -0
  212. package/framework/v0.1.1-alpha.2/lib/cmd/project/list.js +55 -0
  213. package/framework/v0.1.1-alpha.2/lib/cmd/project/move.js +0 -0
  214. package/framework/v0.1.1-alpha.2/lib/cmd/project/remove.js +144 -0
  215. package/framework/v0.1.1-alpha.2/lib/cmd/project/rename.js +162 -0
  216. package/framework/v0.1.1-alpha.2/lib/cmd/project/restart.js +0 -0
  217. package/framework/v0.1.1-alpha.2/lib/cmd/project/rm.js +2 -0
  218. package/framework/v0.1.1-alpha.2/lib/cmd/project/start.js +0 -0
  219. package/framework/v0.1.1-alpha.2/lib/cmd/project/status.js +3 -0
  220. package/framework/v0.1.1-alpha.2/lib/cmd/project/stop.js +0 -0
  221. package/framework/v0.1.1-alpha.2/lib/cmd/protocol/help.js +27 -0
  222. package/framework/v0.1.1-alpha.2/lib/cmd/protocol/help.txt +57 -0
  223. package/framework/v0.1.1-alpha.2/lib/cmd/protocol/list.js +239 -0
  224. package/framework/v0.1.1-alpha.2/lib/cmd/protocol/set.js +631 -0
  225. package/framework/v0.1.1-alpha.2/lib/cmd/scope/help.js +28 -0
  226. package/framework/v0.1.1-alpha.2/lib/cmd/scope/help.txt +33 -0
  227. package/framework/v0.1.1-alpha.2/lib/cmd/scope/link-local.js +80 -0
  228. package/framework/v0.1.1-alpha.2/lib/cmd/scope/list.js +116 -0
  229. package/framework/v0.1.1-alpha.2/lib/cmd/scope/remove.js +150 -0
  230. package/framework/v0.1.1-alpha.2/lib/cmd/scope/rm.js +2 -0
  231. package/framework/v0.1.1-alpha.2/lib/cmd/scope/set.js +57 -0
  232. package/framework/v0.1.1-alpha.2/lib/cmd/scope/unset.js +44 -0
  233. package/framework/v0.1.1-alpha.2/lib/cmd/scope/use.js +79 -0
  234. package/framework/v0.1.1-alpha.2/lib/cmd/view/add.js +311 -0
  235. package/framework/v0.1.1-alpha.2/lib/collection/README.md +5 -0
  236. package/framework/v0.1.1-alpha.2/lib/collection/build.json +0 -0
  237. package/{core/utils → framework/v0.1.1-alpha.2}/lib/collection/package.json +2 -2
  238. package/framework/v0.1.1-alpha.2/lib/collection/src/main.js +1459 -0
  239. package/{core/utils → framework/v0.1.1-alpha.2}/lib/config.js +49 -34
  240. package/framework/v0.1.1-alpha.2/lib/cron/README.md +7 -0
  241. package/framework/v0.1.1-alpha.2/lib/cron/package.json +20 -0
  242. package/framework/v0.1.1-alpha.2/lib/cron/src/main.js +176 -0
  243. package/{core/utils → framework/v0.1.1-alpha.2}/lib/generator/index.js +8 -4
  244. package/framework/v0.1.1-alpha.2/lib/index.js +116 -0
  245. package/framework/v0.1.1-alpha.2/lib/inherits/LICENSE +19 -0
  246. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/README.md +0 -0
  247. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/inheriting_eventemitter.js +0 -0
  248. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/protected_inheritance.js +0 -0
  249. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/simple_inheritance.js +0 -0
  250. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
  251. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/package.json +2 -2
  252. package/{core/utils → framework/v0.1.1-alpha.2}/lib/inherits/src/main.js +18 -19
  253. package/framework/v0.1.1-alpha.2/lib/logger/README.md +7 -0
  254. package/framework/v0.1.1-alpha.2/lib/logger/package.json +20 -0
  255. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/default/index.js +55 -0
  256. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/file/index.js +251 -0
  257. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/file/lib/logrotator/README.md +100 -0
  258. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/file/lib/logrotator/index.js +274 -0
  259. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/mq/index.js +52 -0
  260. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/mq/listener.js +302 -0
  261. package/framework/v0.1.1-alpha.2/lib/logger/src/containers/mq/speaker.js +118 -0
  262. package/framework/v0.1.1-alpha.2/lib/logger/src/helper.js +131 -0
  263. package/framework/v0.1.1-alpha.2/lib/logger/src/main.js +734 -0
  264. package/{core/utils → framework/v0.1.1-alpha.2}/lib/math/index.js +58 -35
  265. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/README.md +5 -0
  266. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/example/merge.js +1 -1
  267. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/example/merge_2_literal objects.js +0 -0
  268. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/example/merge_and_preserve_first.js +2 -0
  269. package/{core/utils → framework/v0.1.1-alpha.2}/lib/merge/package.json +2 -2
  270. package/framework/v0.1.1-alpha.2/lib/merge/src/main.js +531 -0
  271. package/{core/utils → framework/v0.1.1-alpha.2}/lib/model.js +42 -19
  272. package/framework/v0.1.1-alpha.2/lib/proc.js +518 -0
  273. package/framework/v0.1.1-alpha.2/lib/routing/README.md +0 -0
  274. package/framework/v0.1.1-alpha.2/lib/routing/build.json +0 -0
  275. package/{core/utils → framework/v0.1.1-alpha.2}/lib/routing/package.json +2 -2
  276. package/framework/v0.1.1-alpha.2/lib/routing/src/main.js +1492 -0
  277. package/framework/v0.1.1-alpha.2/lib/session-store.js +33 -0
  278. package/{core/utils → framework/v0.1.1-alpha.2}/lib/shell.js +43 -30
  279. package/framework/v0.1.1-alpha.2/lib/swig-filters/README.md +0 -0
  280. package/framework/v0.1.1-alpha.2/lib/swig-filters/package.json +20 -0
  281. package/framework/v0.1.1-alpha.2/lib/swig-filters/src/main.js +322 -0
  282. package/framework/v0.1.1-alpha.2/lib/url/README.md +0 -0
  283. package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/index.js +2 -1
  284. package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/mocks.json +0 -0
  285. package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/routing.json +9 -9
  286. package/{core/utils → framework/v0.1.1-alpha.2}/lib/url/test.js +0 -0
  287. package/{core/utils → framework/v0.1.1-alpha.2}/lib/validator.js +7 -7
  288. package/framework/v0.1.1-alpha.2/package.json +14 -0
  289. package/package.json +35 -33
  290. package/resources/etc/init.d/debian/gina +117 -0
  291. package/resources/home/framework/env.json +34 -0
  292. package/resources/home/framework/locals.json +14 -0
  293. package/resources/home/framework/project.json +48 -0
  294. package/resources/home/framework/projects.json +6 -0
  295. package/resources/home/main.json +47 -0
  296. package/resources/home/settings.json +22 -0
  297. package/resources/home/user/extensions/logger/default/config.json +77 -0
  298. package/resources/home/user/extensions/logger/file/config.json +11 -0
  299. package/resources/img/android-chrome-192x192.png +0 -0
  300. package/resources/img/android-chrome-512x512.png +0 -0
  301. package/resources/img/apple-touch-icon.png +0 -0
  302. package/resources/img/favicon-16x16.png +0 -0
  303. package/resources/img/favicon-32x32.png +0 -0
  304. package/resources/img/favicon.ico +0 -0
  305. package/resources/package.json.template +50 -0
  306. package/script/lib.js +24 -0
  307. package/script/post_install.js +449 -157
  308. package/script/pre_install.js +277 -36
  309. package/script/prepare_version.js +425 -0
  310. package/utils/helper.js +438 -0
  311. package/utils/prototypes.js +239 -0
  312. package/utils/prototypes.json_clone.js +175 -0
  313. package/.npmignore +0 -6
  314. package/MIDDLEWARE +0 -1
  315. package/SUCCESS +0 -1
  316. package/VERSION +0 -1
  317. package/core/asset/html/nolayout.html +0 -1
  318. package/core/asset/js/plugin/build.dev.json +0 -28
  319. package/core/asset/js/plugin/build.json +0 -31
  320. package/core/asset/js/plugin/dist/gina.min.css +0 -1
  321. package/core/asset/js/plugin/dist/gina.min.css.map +0 -1
  322. package/core/asset/js/plugin/dist/gina.min.js +0 -13731
  323. package/core/asset/js/plugin/dist/gina.min.js.map +0 -42
  324. package/core/asset/js/plugin/dist/gina.onload.min.js +0 -3
  325. package/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
  326. package/core/asset/js/plugin/readme.md +0 -152
  327. package/core/asset/js/plugin/src/gina/main.js +0 -132
  328. package/core/asset/js/plugin/src/gina/popin/css/design.css +0 -23
  329. package/core/asset/js/plugin/src/gina/popin/css/main.css +0 -1112
  330. package/core/asset/js/plugin/src/gina/popin/css/popin.css +0 -3
  331. package/core/asset/js/plugin/src/gina/popin/css/popin.css.map +0 -1
  332. package/core/asset/js/plugin/src/gina/popin/doc/TOC.md +0 -29
  333. package/core/asset/js/plugin/src/gina/popin/doc/css.md +0 -162
  334. package/core/asset/js/plugin/src/gina/popin/doc/extend.md +0 -663
  335. package/core/asset/js/plugin/src/gina/popin/doc/faq.md +0 -46
  336. package/core/asset/js/plugin/src/gina/popin/doc/html.md +0 -227
  337. package/core/asset/js/plugin/src/gina/popin/doc/js.md +0 -37
  338. package/core/asset/js/plugin/src/gina/popin/doc/misc.md +0 -178
  339. package/core/asset/js/plugin/src/gina/popin/doc/usage.md +0 -130
  340. package/core/asset/js/plugin/src/gina/popin/main.js +0 -783
  341. package/core/asset/js/plugin/src/gina/popin/sass/config.sass +0 -37
  342. package/core/asset/js/plugin/src/gina/popin/sass/gina-design.sass +0 -622
  343. package/core/asset/js/plugin/src/gina/popin/sass/gina-popin.sass +0 -54
  344. package/core/asset/js/plugin/src/gina/popin/sass/helper.scss +0 -73
  345. package/core/asset/js/plugin/src/gina/toolbar/.npmignore +0 -19
  346. package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css +0 -433
  347. package/core/asset/js/plugin/src/gina/toolbar/css/toolbar.css.map +0 -1
  348. package/core/asset/js/plugin/src/gina/toolbar/index.html +0 -285
  349. package/core/asset/js/plugin/src/gina/toolbar/index.kit +0 -120
  350. package/core/asset/js/plugin/src/gina/toolbar/jquery-3.1.0.min.js +0 -4
  351. package/core/asset/js/plugin/src/gina/toolbar/main.js +0 -693
  352. package/core/asset/js/plugin/src/gina/toolbar/mock.gina.json +0 -1
  353. package/core/asset/js/plugin/src/gina/toolbar/mock.user.json +0 -1
  354. package/core/asset/js/plugin/src/gina/toolbar/readme.md +0 -7
  355. package/core/asset/js/plugin/src/gina/toolbar/sass/toolbar.sass +0 -563
  356. package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-color.svg +0 -1
  357. package/core/asset/js/plugin/src/gina/toolbar/svg-src/Info-grey.svg +0 -1
  358. package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-color.svg +0 -1
  359. package/core/asset/js/plugin/src/gina/toolbar/svg-src/error-grey.svg +0 -1
  360. package/core/asset/js/plugin/src/gina/toolbar/svg-src/info-optim.svg +0 -13
  361. package/core/asset/js/plugin/src/gina/toolbar/svg-src/logo-gina.svg +0 -1
  362. package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings-big.svg +0 -1
  363. package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.afdesign +0 -0
  364. package/core/asset/js/plugin/src/gina/toolbar/svg-src/settings.svg +0 -1
  365. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar-optim.svg +0 -1
  366. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-calendar.svg +0 -1
  367. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card-optim.svg +0 -1
  368. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-card.svg +0 -1
  369. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock-optim.svg +0 -1
  370. package/core/asset/js/plugin/src/gina/toolbar/svg-src/stripe-lock.svg +0 -1
  371. package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-color.svg +0 -1
  372. package/core/asset/js/plugin/src/gina/toolbar/svg-src/warning-grey.svg +0 -1
  373. package/core/asset/js/plugin/src/gina/toolbar/test.jpg +0 -0
  374. package/core/asset/js/plugin/src/gina/toolbar/toolbar.html +0 -104
  375. package/core/asset/js/plugin/src/gina/utils/dom.js +0 -24
  376. package/core/asset/js/plugin/src/gina/utils/events.js +0 -201
  377. package/core/asset/js/plugin/src/gina/utils/loader.js +0 -57
  378. package/core/asset/js/plugin/src/main.js +0 -235
  379. package/core/asset/js/plugin/src/vendor/jquery/1.11.1-css-event_alias.min.js +0 -5
  380. package/core/asset/js/plugin/src/vendor/jquery/1.12.4.min.js +0 -5
  381. package/core/asset/js/plugin/src/vendor/jquery/2.1.1-css-event_alias-sizzle.min.js +0 -4
  382. package/core/asset/js/plugin/src/vendor/jquery/README.md +0 -14
  383. package/core/asset/js/plugin/src/vendor/jquery/slim-3.1.1.min.js +0 -4
  384. package/core/config.js +0 -1225
  385. package/core/controller/controller.js +0 -1860
  386. package/core/gna.js +0 -908
  387. package/core/plugins/lib/validator/src/form-validator.js +0 -788
  388. package/core/plugins/lib/validator/src/main.js +0 -2056
  389. package/core/router.js +0 -717
  390. package/core/server.js +0 -1363
  391. package/core/template/conf/env.json +0 -70
  392. package/core/template/conf/settings.json +0 -48
  393. package/core/template/conf/statics.json +0 -6
  394. package/core/template/conf/views.json +0 -16
  395. package/core/template/samples/bundle/config/app.json +0 -4
  396. package/core/template/samples/bundle/config/routing.json +0 -9
  397. package/core/template/samples/bundle/controllers/setup.js +0 -33
  398. package/core/template/views/js/vendor/readme.md +0 -1
  399. package/core/template/views/readme.md +0 -1
  400. package/core/utils/helpers/dateFormat.js +0 -264
  401. package/core/utils/helpers/index.js +0 -202
  402. package/core/utils/index.js +0 -75
  403. package/core/utils/lib/cmd/app.js +0 -686
  404. package/core/utils/lib/cmd/basic.help.txt +0 -40
  405. package/core/utils/lib/cmd/basic.js +0 -141
  406. package/core/utils/lib/cmd/gina-add-bundle.js +0 -328
  407. package/core/utils/lib/cmd/gina-add-views.js +0 -99
  408. package/core/utils/lib/cmd/gina-build.js +0 -218
  409. package/core/utils/lib/cmd/gina-clean.js +0 -26
  410. package/core/utils/lib/cmd/gina-connect.js +0 -176
  411. package/core/utils/lib/cmd/gina-delete-bundle.js +0 -176
  412. package/core/utils/lib/cmd/gina-deploy.js +0 -452
  413. package/core/utils/lib/cmd/gina-init-project.js +0 -83
  414. package/core/utils/lib/cmd/gina-start-bundle.js +0 -3
  415. package/core/utils/lib/cmd/gina-start.js +0 -3
  416. package/core/utils/lib/cmd/index.js +0 -157
  417. package/core/utils/lib/cmd/project.js +0 -14
  418. package/core/utils/lib/collection/src/main.js +0 -650
  419. package/core/utils/lib/logger/containers/file.js +0 -11
  420. package/core/utils/lib/logger/index.js +0 -260
  421. package/core/utils/lib/merge/src/main.js +0 -344
  422. package/core/utils/lib/proc.js +0 -416
  423. package/core/utils/lib/routing/src/main.js +0 -165
  424. package/documentation/css/default.css +0 -3
  425. package/documentation/html/home.html +0 -6
  426. package/documentation/html/inc/_footer.html +0 -5
  427. package/documentation/html/layout.html +0 -21
  428. package/documentation/img/debug-conf1.png +0 -0
  429. package/documentation/img/debug-conf2.png +0 -0
  430. package/documentation/img/debug-conf3.png +0 -0
  431. package/documentation/img/debug-conf4.png +0 -0
  432. package/documentation/img/debug-conf5.png +0 -0
  433. package/documentation/img/debug-conf6.png +0 -0
  434. package/documentation/img/debug-conf7.png +0 -0
  435. package/documentation/img/debug-new1.png +0 -0
  436. package/documentation/img/debug-new2.png +0 -0
  437. package/documentation/img/debug-start.png +0 -0
  438. package/documentation/md/api/controller/main.md +0 -74
  439. package/migration_note.md +0 -7
  440. package/package-lock.json +0 -611
  441. package/script/pre_publish.js +0 -207
  442. package/tutorial/Commands/README.md +0 -56
  443. package/tutorial/Commands/add-bundle-result.png +0 -0
  444. package/tutorial/Commands/add-bundle.png +0 -0
  445. package/tutorial/Commands/delete-bundle.png +0 -0
  446. package/tutorial/Commands/help.png +0 -0
  447. package/tutorial/Commands/init-project.png +0 -0
  448. package/tutorial/Commands/start-bundle-result.png +0 -0
  449. package/tutorial/Commands/start-bundle-stop.png +0 -0
  450. package/tutorial/Commands/start-bundle.png +0 -0
  451. package/tutorial/Commands/version.png +0 -0
  452. package/tutorial/ETC/README.md +0 -74
  453. package/tutorial/ETC/add-bundle-result.png +0 -0
  454. package/tutorial/ETC/add-bundle.png +0 -0
  455. package/tutorial/ETC/init-project.png +0 -0
  456. package/tutorial/Install/README.md +0 -54
  457. package/tutorial/Install/git-get.png +0 -0
  458. package/tutorial/Install/git-install-end.png +0 -0
  459. package/tutorial/Install/git-install-result.png +0 -0
  460. package/tutorial/Install/git-install-start.png +0 -0
  461. package/tutorial/Install/install-end.png +0 -0
  462. package/tutorial/Install/install-result.png +0 -0
  463. package/tutorial/Install/install-start.png +0 -0
  464. package/tutorial/WebStorm/README.md +0 -30
  465. package/tutorial/WebStorm/closure-compiler.png +0 -0
  466. package/tutorial/WebStorm/sass.png +0 -0
@@ -1,788 +0,0 @@
1
- /**
2
- * FormValidatorUtil
3
- *
4
- * Dependencies:
5
- * - utils/merge
6
- * - utils/helpers
7
- * - utils/helpers/dateFormat
8
- *
9
- * @param {object} data
10
- * @param {object} [ $fields ] - isGFFCtx only
11
- * */
12
- function FormValidatorUtil(data, $fields) {
13
-
14
- var isGFFCtx = ( ( typeof(module) !== 'undefined' ) && module.exports ) ? false : true;
15
-
16
- if (isGFFCtx && !$fields )
17
- throw new Error('No `Validator` instance found.\nTry:\nvar FormValidator = require("gina/validator"):\nvar formValidator = new FormValidator(...);')
18
-
19
- var merge = (isGFFCtx) ? require('utils/merge') : require('../../../../utils/lib/merge');
20
- var helpers = (isGFFCtx) ? {} : require('../../../../utils/helpers');
21
- var dateFormat = (isGFFCtx) ? require('helpers/dateFormat') : helpers.dateFormat;
22
-
23
- var local = {
24
- 'errors': {},
25
- 'keys': {
26
- '%l': 'label', // %l => label: needs `data-gina-form-field-label` attribute (frontend only)
27
- '%n': 'name', // %n => field name
28
- '%s': 'size' // %s => length
29
- },
30
- 'errorLabels': {},
31
- 'data': {}, // output to send
32
- 'excluded': []
33
- };
34
-
35
- local.errorLabels = {
36
- 'is': 'Condition not satisfied',
37
- 'isEmail': 'A valid email is required',
38
- 'isRequired': 'Cannot be left empty',
39
- 'isBoolean': 'Must be a valid boolean',
40
- 'isNumber': 'Must be a number: allowed values are integers or floats',
41
- 'isNumberLength': 'Must contain %s characters',
42
- 'isNumberMinLength': 'Should be at least %s characters',
43
- 'isNumberMaxLength': 'Should not be more than %s characters',
44
- 'isInteger': 'Must be an integer',
45
- 'isIntegerLength': 'Must have %s characters',
46
- 'isIntegerMinLength': 'Should be at least %s characters',
47
- 'isIntegerMaxLength': 'Should not be more than %s characters',
48
- 'toInteger': 'Could not be converted to integer',
49
- 'isFloat': 'Must be a proper float',
50
- 'isFloatException': 'Float exception found: %n',
51
- 'toFloat': 'Could not be converted to float',
52
- 'toFloatNAN': 'Value must be a valid number',
53
- 'isDate': 'Must be a valid Date',
54
- 'isString': 'Must be a string',
55
- 'isStringLength': 'Must have %s characters',
56
- 'isStringMinLength': 'Should be at least %s characters',
57
- 'isStringMaxLength': 'Should not be more than %s characters'
58
- };
59
-
60
- if (!data) {
61
- throw new Error('missing data param')
62
- } else {
63
- // cloning
64
- var self = JSON.parse( JSON.stringify(data) );
65
- local.data = JSON.parse( JSON.stringify(data) )
66
- }
67
-
68
-
69
- var val = null, label = null;
70
- for (var el in self) {
71
-
72
- if ( typeof(self[el]) == 'object' ) {
73
- try {
74
- val = JSON.parse( JSON.stringify( self[el] ))
75
- } catch (err) {
76
- val = self[el]
77
- }
78
- } else {
79
- val = self[el]
80
- }
81
-
82
- label = '';
83
- if ( isGFFCtx && typeof($fields) != 'undefined' ) { // frontend only
84
- label = $fields[el].getAttribute('data-gina-form-field-label') || '';
85
- }
86
-
87
- // keys are stringyfied because of the compiler !!!
88
- self[el] = {
89
- 'target': (isGFFCtx) ? $fields[el] : null,
90
- 'name': el,
91
- 'value': val,
92
- 'valid': false,
93
- // is name by default, but you should use setLabe(name) to change it if you need to
94
- 'label': label,
95
- // check as field to exclude while sending datas to the model
96
- 'exclude': false
97
- };
98
-
99
- /**
100
- *
101
- * is(condition) -> validate if value matches `condition`
102
- *
103
- * When entered in a JSON rule, you must double the backslashes
104
- *
105
- * e.g.:
106
- * "/\\D+/" -> like [^0-9]
107
- * "/^[0-9]+$/" -> only numbers
108
- * "$field === $fieldOther" -> will be evaluated
109
- *
110
- * @param {object|string} condition - RegExp object, or condition to eval, or eval result
111
- * @param {string} [errorMessage] - error message
112
- * @param {string} [errorStack] - error stack
113
- *
114
- * */
115
- self[el]['is'] = function(condition, errorMessage, errorStack) {
116
- var valid = false;
117
- var errors = {};
118
-
119
- if ( /\$[-_\[\]a-z 0-9]+/i.test(condition) ) {
120
-
121
- var variables = condition.match(/\${0}[-_\[\]a-z0-9]+/ig); // without space(s)
122
- var compiledCondition = condition;
123
- var re = null
124
- for (var i = 0, len = variables.length; i < len; ++i) {
125
- if (variables[i]) {
126
- re = new RegExp("\\$"+ variables[i] +"(?!\\S+)", "g");
127
- if ( self[ variables[i] ].value == "" ) {
128
- compiledCondition = compiledCondition.replace(re, '"');
129
- } else if ( typeof(self[ variables[i] ].value) == 'string' ) {
130
- compiledCondition = compiledCondition.replace(re, '"'+ self[ variables[i] ].value +'"');
131
- } else {
132
- compiledCondition = compiledCondition.replace(re, self[ variables[i] ].value);
133
- }
134
- }
135
- }
136
-
137
- try {
138
- // security checks
139
- compiledCondition = compiledCondition.replace(/(\(|\)|return)/g, '');
140
- valid = eval(compiledCondition)
141
- } catch (err) {
142
- throw new Error(err.stack||err.message)
143
- }
144
- } else if ( condition instanceof RegExp ) {
145
-
146
- valid = condition.test(this.value) ? true : false;
147
-
148
- } else if( typeof(condition) == 'boolean') {
149
-
150
- valid = (condition) ? true : false;
151
-
152
- } else {
153
- try {
154
- // TODO - motif /gi to pass to the second argument
155
- valid = new RegExp(condition.replace(/\//g, '')).test(this.value)
156
- } catch (err) {
157
- throw new Error(err.stack||err.message)
158
- }
159
- }
160
-
161
- if (!valid) {
162
- errors['is'] = replace(this.error || errorMessage || local.errorLabels['is'], this);
163
- if ( typeof(errorStack) != 'undefined' )
164
- errors['stack'] = errorStack;
165
- }
166
-
167
- this.valid = valid;
168
- if ( errors.count() > 0 )
169
- this['errors'] = errors;
170
-
171
- return self[this.name]
172
- }
173
-
174
- self[el]['isEmail'] = function() {
175
-
176
-
177
- this.value = local['data'][this.name] = this.value.toLowerCase();
178
-
179
- 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,}))$/;
180
- var isValid = rgx.test(this['value']) ? true : false;
181
- var errors = self[this['name']]['errors'] || {};
182
-
183
- if ( !errors['isRequired'] && this.value == '' ) {
184
- isValid = true;
185
- }
186
-
187
- if (!isValid) {
188
- errors['isEmail'] = replace(this['error'] || local.errorLabels['isEmail'], this)
189
- }
190
-
191
- this.valid = isValid;
192
-
193
- if ( errors.count() > 0 )
194
- this['errors'] = errors;
195
-
196
- return self[this['name']]
197
- }
198
-
199
- /**
200
- * Check if boolean and convert to `true/false` booloean if value is a string or a number
201
- * Will include `false` value if isRequired
202
- * */
203
- self[el]['isBoolean'] = function() {
204
- var val = null
205
- , errors = self[this['name']]['errors'] || {}
206
- ;
207
-
208
- if ( errors['isRequired'] && this.value == false ) {
209
- isValid = true;
210
- delete errors['isRequired'];
211
- this['errors'] = errors;
212
- }
213
-
214
- switch(this.value) {
215
- case 'true':
216
- case true:
217
- case 1:
218
- val = this.value = local.data[this.name] = true;
219
- break;
220
- case 'false':
221
- case false:
222
- case 0:
223
- val = this.value = local.data[this.name] = false;
224
- break;
225
- }
226
- var valid = (val !== null) ? true : false;
227
-
228
- if (!valid) {
229
- errors['isBoolean'] = replace(this.error || local.errorLabels['isBoolean'], this)
230
- }
231
-
232
- this.valid = valid;
233
- if ( errors.count() > 0 )
234
- this['errors'] = errors;
235
-
236
- return self[this.name]
237
- }
238
-
239
- /**
240
- * Check if value is an a Number.
241
- * - valid if a number is found
242
- * - cast into a number if a string is found
243
- * - if string is blank, no transformation will be done: valid if not required
244
- *
245
- * @param {number} minLength
246
- * @param {number} maxLength
247
- *
248
- * @return {object} result
249
- * */
250
- self[el]['isNumber'] = function(minLength, maxLength) {
251
- var val = this.value
252
- , len = 0
253
- , isValid = false
254
- , isMinLength = true
255
- , isMaxLength = true
256
- , errors = {}
257
- ;
258
-
259
-
260
- // test if val is a number
261
- try {
262
- // if val is a string replaces comas by points
263
- if ( typeof(val) == 'string' && /,/g.test(val) ) {
264
- val = this.value = parseFloat( val.replace(/,/g, '.').replace(/\s+/g, '') );
265
- } else if ( typeof(val) == 'string' && val != '') {
266
- val = this.value = parseInt( val );
267
- }
268
-
269
- } catch (err) {
270
- errors['isNumber'] = replace(this.error || local.errorLabels['isNumber'], this);
271
- this.valid = false;
272
- if ( errors.count() > 0 )
273
- this['errors'] = errors;
274
- }
275
-
276
- if ( +val === +val ) {
277
- isValid = true;
278
- if ( !errors['isRequired'] && val != '' ) {
279
- len = val.toString().length;
280
- // if so also test max and min length if defined
281
- if (minLength && typeof(minLength) == 'number' && len < minLength) {
282
- isMinLength = false;
283
- this['size'] = minLength;
284
- }
285
- if (maxLength && typeof(maxLength) == 'number' && len > maxLength) {
286
- isMaxLength = false;
287
- this['size'] = maxLength;
288
- }
289
- }
290
- }
291
-
292
- // if val is invalid return error message
293
- if ( !isValid || !isMinLength || !isMaxLength ) {
294
-
295
- if ( !isValid )
296
- errors['isNumber'] = replace(this.error || local.errorLabels['isNumber'], this);
297
- if ( !isMinLength || !isMaxLength ) {
298
- if ( !isMinLength )
299
- errors['isNumberLength'] = replace(this.error || local.errorLabels['isNumberMinLength'], this);
300
- if ( !isMaxLength )
301
- errors['isNumberLength'] = replace(this.error || local.errorLabels['isNumberMaxLength'], this);
302
- if ( minLength === maxLength )
303
- errors['isNumberLength'] = replace(this.error || local.errorLabels['isNumberLength'], this);
304
- }
305
-
306
- isValid = false;
307
- }
308
-
309
- this.valid = isValid;
310
- val = this.value = local.data[this.name] = ( val != '' ) ? Number(val) : val;
311
- if ( errors.count() > 0 )
312
- this['errors'] = errors;
313
-
314
- return self[this.name]
315
- }
316
-
317
- self[el]['toInteger'] = function() {
318
- var val = this.value, errors = {};
319
-
320
- if (!val) {
321
- return self[this.name]
322
- } else {
323
- try {
324
- //val = this.value = local.data[this.name] = ~~(val.match(/[0-9]+/g).join(''));
325
- val = this.value = local.data[this.name] = Math.round(val);
326
- } catch (err) {
327
-
328
- errors['toInteger'] = replace(this.error || local.errorLabels['toInteger'], this);
329
- this.valid = false;
330
- if ( errors.count() > 0 )
331
- this['errors'] = errors;
332
- }
333
-
334
- }
335
-
336
- return self[this.name]
337
- }
338
-
339
- self[el]['isInteger'] = function(minLength, maxLength) {
340
- var val = this.value
341
- , isValid = false
342
- , isMinLength = true
343
- , isMaxLength = true
344
- , errors = {}
345
- ;
346
-
347
- // test if val is a number
348
- if ( +val === +val && val % 1 === 0 ) {
349
- isValid = true;
350
- if ( !errors['isRequired'] && val != '' ) {
351
- // if so also test max and min length if defined
352
- if (minLength && typeof(minLength) == 'number' && val.length < minLength) {
353
- isMinLength = false;
354
- this['size'] = minLength;
355
- }
356
- if (maxLength && typeof(maxLength) == 'number' && val.length > maxLength) {
357
- isMaxLength = false;
358
- this['size'] = maxLength;
359
- }
360
- }
361
- }
362
- // if val is invalid return error message
363
- if ( !isValid || !isMinLength || !isMaxLength ) {
364
-
365
- if ( !isValid )
366
- errors['isInteger'] = replace(this.error || local.errorLabels['isInteger'], this);
367
-
368
- if ( !isMinLength || !isMaxLength ) {
369
-
370
- if ( !isMinLength ) {
371
- errors['isIntegerLength'] = replace(this.error || local.errorLabels['isIntegerMinLength'], this);
372
- isValid = false;
373
- }
374
-
375
- if ( !isMaxLength ) {
376
- errors['isIntegerLength'] = replace(this.error || local.errorLabels['isIntegerMaxLength'], this);
377
- isValid = false;
378
- }
379
-
380
- if ( minLength === maxLength ) {
381
- errors['isIntegerLength'] = replace(this.error || local.errorLabels['isIntegerLength'], this);
382
- isValid = false;
383
- }
384
- }
385
- }
386
-
387
- this.valid = isValid;
388
- val = this.value = local.data[this.name] = Number(val);
389
-
390
- if ( errors.count() > 0 )
391
- this['errors'] = errors;
392
-
393
- return self[this.name]
394
- }
395
-
396
-
397
- self[el]['toFloat'] = function(decimals) {
398
- if ( typeof(this.value) == 'string' ) {
399
- this.value = this.value.replace(/\s+/g, '');
400
- }
401
-
402
- var val = this.value, errors = {}, isValid = true;
403
-
404
- if (decimals) {
405
- this['decimals'] = parseInt(decimals)
406
- } else if ( typeof(this['decimals']) == 'undefined' ) {
407
- this['decimals'] = 2
408
- }
409
-
410
- if (!val) {
411
- return self[this.name]
412
- } else {
413
- if ( this['isNumber']().valid ) {
414
- try {
415
-
416
- if ( !Number.isFinite(val) ) {
417
- val = this.value = local.data[this.name] = new Number(parseFloat(val.match(/[0-9.,]+/g).join('').replace(/,/, '.')));// Number <> number
418
- }
419
-
420
- this.target.setAttribute('value', val);
421
- } catch(err) {
422
- isValid = false;
423
- errors['toFloat'] = replace(this.error || local.errorLabels['toFloat'], this);
424
- this.valid = false;
425
- if ( errors.count() > 0 )
426
- this['errors'] = errors;
427
- }
428
- } else {
429
- isValid = false;
430
- errors['toFloat'] = replace(this.error || local.errorLabels['toFloatNAN'], this)
431
- }
432
- }
433
-
434
- if (this['decimals'] && val && !errors['toFloat']) {
435
- this.value = local.data[this.name] = parseFloat(this.value.toFixed(this['decimals']));
436
- }
437
-
438
- this.valid = isValid;
439
- if ( errors.count() > 0 )
440
- this['errors'] = errors;
441
-
442
- return self[this.name]
443
- }
444
-
445
- /**
446
- * Check if value is float. No transformation is done here.
447
- * Can be used in combo preceded by *.toFloat(2) to transform data if needed:
448
- * 1 => 1.0
449
- * or
450
- * 3 500,5 => 3500.50
451
- *
452
- *
453
- * @param {number} [ decimals ]
454
- *
455
- * TODO - decimals transformation
456
- * */
457
- self[el]['isFloat'] = function(decimals) {
458
-
459
- if ( typeof(this.value) == 'string' ) {
460
- this.value = this.value.replace(/\s+/g, '');
461
- }
462
-
463
- var val = this.value
464
- , isValid = false
465
- , errors = {};
466
-
467
-
468
- if ( typeof(val) == 'string' && /\./.test(val) && Number.isFinite( Number(val) ) ) {
469
- isValid = true
470
- }
471
-
472
- // if string replaces comas by points
473
- if (typeof(val) == 'string' && /,/g.test(val)) {
474
- val = this.value = local.data[this.name] = Number(val.replace(/,/g, '.'))
475
- }
476
-
477
- // test if val is strictly a float
478
- if ( Number(val) === val && val % 1 !== 0 ) {
479
- this.value = local.data[this.name] = Number(val);
480
- isValid = true
481
- } else {
482
- isValid = false
483
- }
484
-
485
- if ( !errors['isRequired'] && this.value == '' ) {
486
- isValid = true
487
- }
488
-
489
- if (!isValid) {
490
- errors['isFloat'] = replace(this.error || local.errorLabels['isFloat'], this)
491
- }
492
-
493
- this.valid = isValid;
494
- if ( errors.count() > 0 )
495
- this['errors'] = errors;
496
-
497
- return self[this.name]
498
- }
499
-
500
- self[el]['isRequired'] = function(isApplicable) {
501
-
502
- if ( typeof(isApplicable) == 'boolean' && !isApplicable ) {
503
-
504
- this.valid = true;
505
-
506
- return self[this.name]
507
- }
508
-
509
- // radio group case
510
- if ( isGFFCtx && this.target.tagName == 'INPUT' && typeof(this.target.type) != 'undefined' && this.target.type == 'radio' ) {
511
- var radios = document.getElementsByName(this.name);
512
- for (var i = 0, len = radios.length; i < len; ++i) {
513
- if (radios[i].checked) {
514
- if ( /true|false/.test(radios[i].value) ) {
515
- this.value = local.data[this.name] = ( /true/.test(radios[i].value) ) ? true : false
516
- } else {
517
- this.value = local.data[this.name] = radios[i].value;
518
- }
519
-
520
- this.valid = true;
521
- break;
522
- }
523
- }
524
- }
525
-
526
-
527
- var isValid = ( typeof(this.value) != 'undefined' && this.value != null && this.value != '') ? true : false;
528
- var errors = {};
529
-
530
-
531
- if (!isValid) {
532
- errors['isRequired'] = replace(this.error || local.errorLabels['isRequired'], this)
533
- }
534
-
535
- this.valid = isValid;
536
- if (errors.count() > 0)
537
- this['errors'] = errors;
538
-
539
- return self[this.name]
540
- }
541
- /**
542
- *
543
- * isString() -> validate if value is string
544
- * isString(10) -> validate if value is at least 10 chars length
545
- * isString(0, 45) -> no minimum length, but validate if value is maximum 45 chars length
546
- *
547
- * @param {number|undefined} [ minLength ]
548
- * @param {number} [ maxLength ]
549
- * */
550
- self[el]['isString'] = function(minLength, maxLength) {
551
-
552
- var val = this.value
553
- , isValid = false
554
- , isMinLength = true
555
- , isMaxLength = true
556
- , errors = {}
557
- ;
558
-
559
-
560
- // test if val is a string
561
- if ( typeof(val) == 'string' ) {
562
- isValid = true;
563
-
564
- if ( !errors['isRequired'] && val != '' ) {
565
- // if so also test max and min length if defined
566
- if (minLength && typeof(minLength) == 'number' && val.length < minLength) {
567
- isMinLength = false;
568
- this['size'] = minLength;
569
- }
570
- if (maxLength && typeof(maxLength) == 'number' && val.length > maxLength) {
571
- isMaxLength = false;
572
- this['size'] = maxLength;
573
- }
574
- }
575
-
576
- }
577
-
578
- // if val is invalid return error message
579
- if (!isValid || !isMinLength || !isMaxLength ) {
580
-
581
- if (!isValid && errors['isRequired'] && val == '') {
582
- isValid = false;
583
- errors['isString'] = replace(this['error'] || local.errorLabels['isString'], this);
584
- } else if (!isValid && !errors['isRequired']) {
585
- isValid = true;
586
- }
587
-
588
- if ( !isMinLength || !isMaxLength) {
589
- isValid = false;
590
-
591
- if ( !isMinLength )
592
- errors['isStringLength'] = replace(this['error'] || local.errorLabels['isStringMinLength'], this);
593
- if ( !isMaxLength )
594
- errors['isStringLength'] = replace(this['error'] || local.errorLabels['isStringMaxLength'], this);
595
- if (minLength === maxLength)
596
- errors['isStringLength'] = replace(this['error'] || local.errorLabels['isStringLength'], this);
597
- }
598
-
599
- }
600
-
601
- this.valid = isValid;
602
- if ( errors.count() > 0 )
603
- this['errors'] = errors;
604
-
605
-
606
- return self[this.name]
607
- }
608
-
609
- /**
610
- * Check if date
611
- *
612
- * @param {string} [mask] - by default "yyyy-mm-dd"
613
- *
614
- * @return {date} date - extended by gina::utils::dateFormat; an adaptation of Steven Levithan's code
615
- * */
616
- self[el]['isDate'] = function(mask) {
617
- var val = this.value
618
- , isValid = false
619
- , errors = {}
620
- ;
621
- if (!val) return self[this.name];
622
-
623
- var m = mask.match(/[^\/\- ]+/g);
624
- val = val.match(/[^\/\- ]+/g);
625
- var dic = {}, d, len;
626
- for (d=0, len=m.length; d<len; ++d) {
627
- dic[m[d]] = val[d]
628
- }
629
- var newMask = 'yyyy-mm-dd';
630
- for (var v in dic) {
631
- newMask = newMask.replace(new RegExp(v, "g"), dic[v])
632
- }
633
-
634
- var date = this.value = local.data[this.name] = new Date(newMask);
635
-
636
- if ( date instanceof Date ) {
637
- isValid = true;
638
- } else {
639
- if ( !errors['isRequired'] && this.value == '' ) {
640
- isValid = true
641
- } else {
642
- errors['isDate'] = replace(this.error || local.errorLabels['isDate'], this);
643
- }
644
-
645
- this.valid = isValid;
646
- if ( errors.count() > 0 )
647
- this['errors'] = errors;
648
-
649
- return self[this.name]
650
- }
651
-
652
- this.valid = isValid;
653
-
654
- return date
655
- }
656
-
657
- /**
658
- * Formating date using DateFormatHelper
659
- * Check out documentation in the helper source: `utils/helpers/dateFormat.js`
660
- * e.g.:
661
- * d.start
662
- * .isDate('dd/mm/yyyy')
663
- * .format('isoDateTime');
664
- *
665
- *
666
- * */
667
- self[el]['format'] = function(mask, utc) {
668
- var val = this.value;
669
- if (!val) return self[this.name];
670
-
671
- return val.format(mask, utc)
672
- };
673
-
674
- /**
675
- * Set flash
676
- *
677
- * @param {str} flash
678
- * */
679
- self[el]['setFlash'] = function(regex, flash) {
680
- if ( typeof(flash) != 'undefined' && flash != '') {
681
- this.error = flash
682
- }
683
- return self[this.name]
684
- }
685
-
686
- /**
687
- * Set label
688
- *
689
- * @param {str} label
690
- * */
691
- self[el]['setLabel'] = function(label) {
692
- if ( typeof(label) != 'undefined' && label != '') {
693
- this.label = label
694
- }
695
- return self[this.name]
696
- }
697
-
698
- /**
699
- * Exclude when converting back to datas
700
- *
701
- * @return {object} data
702
- * */
703
- self[el]['exclude'] = function(isApplicable) {
704
-
705
- if ( typeof(isApplicable) == 'boolean' && !isApplicable ) {
706
-
707
- local.data[this.name] = this.value;
708
-
709
- return self[this.name]
710
- }
711
-
712
- // list field to be purged
713
- local.excluded.push(this.name);
714
- }
715
-
716
- } // EO for (var el in self)
717
-
718
- /**
719
- * Check if errors found during validation
720
- *
721
- * @return {boolean}
722
- * */
723
- self['isValid'] = function() {
724
-
725
- var i = self['getErrors']().count();
726
- var valid = true;
727
-
728
- if (i > 0) {
729
- valid = false;
730
- }
731
-
732
- return valid
733
- }
734
-
735
- self['getErrors'] = function() {
736
- var errors = {};
737
-
738
- for (var field in self) {
739
- if ( typeof(self[field]) != 'function' && typeof(self[field]['errors']) != 'undefined' ) {
740
- if ( self[field]['errors'].count() > 0)
741
- errors[field] = self[field]['errors'];
742
- }
743
- }
744
-
745
- return errors
746
- }
747
-
748
- self['toData'] = function() {
749
-
750
- // cleaning data
751
- if (local.excluded.length > 0) {
752
- for (var i = 0, len = local.excluded.length; i < len; ++i) {
753
- if ( typeof(local.data[ local.excluded[i] ]) != 'undefined' ) {
754
- delete local.data[ local.excluded[i] ]
755
- }
756
- }
757
- }
758
-
759
- return local.data
760
- }
761
-
762
- var replace = function(target, fieldObj) {
763
- var keys = target.match(/%[a-z]+/gi);
764
- if (keys) {
765
- for (var k = 0, len = keys.length; k < len; ++k) {
766
- target = target.replace(new RegExp(keys[k], 'g'), fieldObj[local.keys[keys[k]]])
767
- }
768
- }
769
-
770
- return target
771
- }
772
-
773
- self['setErrorLabels'] = function (errorLabels) {
774
- if ( typeof(errorLabels) != 'undefined') {
775
- local.errorLabels = merge(errorLabels, local.errorLabels)
776
- }
777
- }
778
-
779
- return self
780
- };
781
-
782
- if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
783
- // Publish as node.js module
784
- module.exports = FormValidatorUtil
785
- } else if ( typeof(define) === 'function' && define.amd) {
786
- // Publish as AMD module
787
- define(function() { return FormValidatorUtil })
788
- }