gina 0.1.1-alpha.18 → 0.1.1-alpha.181

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 (366) hide show
  1. package/AUTHORS +2 -1
  2. package/LICENSE +1 -1
  3. package/README-4Contributors.md +30 -0
  4. package/README.md +208 -32
  5. package/bin/cli +165 -68
  6. package/bin/cli-debug +49 -18
  7. package/bin/cmd +40 -18
  8. package/bin/gina +48 -37
  9. package/framework/{v0.1.1-alpha.18/lib/inherits → v0.1.1-alpha.181}/LICENSE +1 -1
  10. package/framework/v0.1.1-alpha.181/VERSION +1 -0
  11. package/framework/{v0.1.1-alpha.18/core/asset/js/plugin/readme.md → v0.1.1-alpha.181/core/asset/plugin/README.md} +31 -9
  12. package/framework/v0.1.1-alpha.181/core/asset/plugin/dist/vendor/gina/css/gina.min.css +1 -0
  13. package/framework/v0.1.1-alpha.181/core/asset/plugin/dist/vendor/gina/css/gina.min.css.map +1 -0
  14. package/framework/v0.1.1-alpha.181/core/asset/plugin/dist/vendor/gina/html/toolbar.html +251 -0
  15. package/framework/{v0.1.1-alpha.18/core/asset/js/plugin/dist → v0.1.1-alpha.181/core/asset/plugin/dist/vendor/gina/js}/gina.js +3988 -3157
  16. package/framework/v0.1.1-alpha.181/core/asset/plugin/dist/vendor/gina/js/gina.min.js +759 -0
  17. package/framework/v0.1.1-alpha.181/core/asset/plugin/dist/vendor/gina/js/gina.min.js.map +8 -0
  18. package/framework/v0.1.1-alpha.181/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +5 -0
  19. package/framework/v0.1.1-alpha.181/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.map +8 -0
  20. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/config.js +125 -55
  21. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/connectors/couchbase/index.js +373 -259
  22. package/framework/v0.1.1-alpha.181/core/connectors/couchbase/lib/connector.js +22 -0
  23. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/connectors/couchbase/lib/connector.v2.js +51 -51
  24. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/connectors/couchbase/lib/connector.v3.js +51 -51
  25. package/framework/v0.1.1-alpha.181/core/connectors/couchbase/lib/connector.v4.js +384 -0
  26. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/connectors/couchbase/lib/n1ql.js +3 -2
  27. package/framework/v0.1.1-alpha.181/core/connectors/couchbase/lib/session-store.js +22 -0
  28. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/connectors/couchbase/lib/session-store.v3.js +12 -12
  29. package/framework/v0.1.1-alpha.181/core/connectors/couchbase/lib/session-store.v4.js +361 -0
  30. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/controller/controller.js +901 -767
  31. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/dev/index.js +1 -1
  32. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/dev/lib/class.js +1 -1
  33. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/dev/lib/factory.js +2 -2
  34. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/gna.js +13 -9
  35. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/locales/README.md +5 -0
  36. package/framework/v0.1.1-alpha.181/core/locales/dist/region/en.json +5727 -0
  37. package/framework/v0.1.1-alpha.181/core/locales/dist/region/fr.json +11452 -0
  38. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/locales/index.js +2 -2
  39. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/locales/src/make.js +39 -41
  40. package/framework/v0.1.1-alpha.181/core/locales/src/resources/region.mapping.json +43 -0
  41. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/model/entity.js +87 -67
  42. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/model/index.js +16 -16
  43. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/model/template/entityFactory.js +1 -1
  44. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/model/template/index.js +17 -15
  45. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/index.js +1 -1
  46. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/file/package.json +1 -1
  47. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/intl/package.json +1 -1
  48. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/intl/src/main.js +5 -5
  49. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/storage/package.json +1 -1
  50. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/storage/src/main.js +6 -5
  51. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/validator/package.json +1 -1
  52. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/validator/src/form-validator.js +403 -300
  53. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/validator/src/main.js +1296 -1262
  54. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/router.js +98 -90
  55. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/server.isaac.js +184 -179
  56. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/server.js +373 -194
  57. package/framework/v0.1.1-alpha.181/core/template/boilerplate/bundle/config/settings.json +12 -0
  58. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle/config/settings.server.json +4 -4
  59. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle/config/templates.json +4 -4
  60. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle/controllers/controller.content.js +1 -1
  61. package/framework/v0.1.1-alpha.181/core/template/boilerplate/bundle/controllers/setup.js +111 -0
  62. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle/index.js +13 -1
  63. package/framework/v0.1.1-alpha.181/core/template/boilerplate/bundle_templates/html/content/homepage.html +8 -0
  64. package/framework/v0.1.1-alpha.181/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +11 -0
  65. package/framework/v0.1.1-alpha.181/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +8 -0
  66. package/framework/{v0.1.1-alpha.18/core/template/boilerplate/bundle_templates/html/layout → v0.1.1-alpha.181/core/template/boilerplate/bundle_templates/html/layouts}/main.html +10 -3
  67. package/framework/v0.1.1-alpha.181/core/template/command/gina.bat.tpl +8 -0
  68. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/command/gina.tpl +4 -4
  69. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/conf/env.json +11 -0
  70. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/conf/package.json +1 -1
  71. package/framework/v0.1.1-alpha.181/core/template/conf/statics.json +12 -0
  72. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/conf/templates.json +2 -2
  73. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/console.js +3 -3
  74. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/context.js +148 -7
  75. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/dateFormat.js +9 -7
  76. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/index.js +13 -8
  77. package/framework/v0.1.1-alpha.181/helpers/json/LICENSE +9 -0
  78. package/framework/v0.1.1-alpha.181/helpers/json/README.md +12 -0
  79. package/framework/{v0.1.1-alpha.18/helpers/plugins → v0.1.1-alpha.181/helpers/json}/package.json +2 -2
  80. package/framework/v0.1.1-alpha.181/helpers/json/src/main.js +361 -0
  81. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/path.js +163 -96
  82. package/framework/{v0.1.1-alpha.18/helpers/json → v0.1.1-alpha.181/helpers/plugins}/package.json +2 -2
  83. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/plugins/src/api-error.js +23 -23
  84. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/plugins/src/main.js +3 -3
  85. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/prototypes.js +46 -38
  86. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/task.js +21 -14
  87. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/text.js +2 -2
  88. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/archiver/package.json +1 -1
  89. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/archiver/src/dep/jszip.min.js +3 -3
  90. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/archiver/src/main.js +168 -168
  91. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/aliases.json +4 -1
  92. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/add.js +79 -22
  93. package/framework/v0.1.1-alpha.181/lib/cmd/bundle/arguments.json +7 -0
  94. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/help.txt +4 -2
  95. package/framework/v0.1.1-alpha.181/lib/cmd/bundle/list.js +176 -0
  96. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/remove.js +22 -22
  97. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/start.js +264 -46
  98. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/stop.js +93 -74
  99. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/list.js +20 -4
  100. package/framework/{v0.1.1-alpha.18/lib/cmd/scope → v0.1.1-alpha.181/lib/cmd/env}/use.js +21 -1
  101. package/framework/v0.1.1-alpha.181/lib/cmd/framework/build.js +85 -0
  102. package/framework/v0.1.1-alpha.181/lib/cmd/framework/init.js +798 -0
  103. package/framework/v0.1.1-alpha.181/lib/cmd/framework/link-node-modules.js +86 -0
  104. package/framework/v0.1.1-alpha.181/lib/cmd/framework/link.js +109 -0
  105. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/open.js +15 -0
  106. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/restart.js +58 -26
  107. package/framework/v0.1.1-alpha.181/lib/cmd/framework/set.js +273 -0
  108. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/start.js +43 -20
  109. package/framework/v0.1.1-alpha.181/lib/cmd/framework/status.js +138 -0
  110. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/stop.js +44 -28
  111. package/framework/v0.1.1-alpha.181/lib/cmd/framework/tail.js +299 -0
  112. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/version.js +12 -3
  113. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/helper.js +82 -6
  114. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/index.js +23 -23
  115. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/port/inc/scan.js +32 -16
  116. package/framework/v0.1.1-alpha.181/lib/cmd/port/list.js +459 -0
  117. package/framework/v0.1.1-alpha.181/lib/cmd/port/reset.js +426 -0
  118. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/add.js +146 -122
  119. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/arguments.json +2 -1
  120. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/list.js +16 -2
  121. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/remove.js +17 -17
  122. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/protocol/set.js +239 -201
  123. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/scope/list.js +24 -8
  124. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/view/add.js +34 -9
  125. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/collection/package.json +1 -1
  126. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/collection/src/main.js +243 -242
  127. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/config.js +31 -30
  128. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cron/package.json +1 -1
  129. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cron/src/main.js +10 -9
  130. package/framework/v0.1.1-alpha.181/lib/domain/LICENSE +9 -0
  131. package/framework/v0.1.1-alpha.181/lib/domain/README.md +46 -0
  132. package/framework/v0.1.1-alpha.181/lib/domain/dist/public_suffix_list.dat +14186 -0
  133. package/framework/v0.1.1-alpha.181/lib/domain/package.json +20 -0
  134. package/framework/v0.1.1-alpha.181/lib/domain/src/main.js +442 -0
  135. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/generator/index.js +4 -4
  136. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/index.js +3 -2
  137. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181/lib/inherits}/LICENSE +1 -1
  138. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/inherits/README.md +2 -2
  139. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/inherits/package.json +3 -4
  140. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/inherits/src/main.js +3 -3
  141. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/package.json +2 -2
  142. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/src/containers/default/index.js +13 -2
  143. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/src/containers/file/index.js +109 -14
  144. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/src/containers/mq/index.js +12 -3
  145. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/src/containers/mq/listener.js +16 -14
  146. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/src/containers/mq/speaker.js +32 -3
  147. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/src/helper.js +21 -1
  148. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/src/main.js +36 -9
  149. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/math/index.js +9 -9
  150. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/merge/README.md +2 -2
  151. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/merge/package.json +1 -1
  152. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/merge/src/main.js +118 -91
  153. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/model.js +10 -10
  154. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/proc.js +87 -49
  155. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/routing/package.json +1 -1
  156. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/routing/src/main.js +280 -274
  157. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/session-store.js +6 -6
  158. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/shell.js +3 -3
  159. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/swig-filters/package.json +1 -1
  160. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/swig-filters/src/main.js +140 -119
  161. package/framework/v0.1.1-alpha.181/lib/url/README.md +0 -0
  162. package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/validator.js +2 -2
  163. package/framework/v0.1.1-alpha.181/package.json +14 -0
  164. package/package.json +33 -24
  165. package/resources/home/main.json +53 -4
  166. package/resources/home/settings.json +9 -0
  167. package/resources/home/user/extensions/logger/default/config.json +1 -1
  168. package/resources/package.json.template +29 -18
  169. package/script/post_install.js +411 -126
  170. package/script/post_publish.js +186 -0
  171. package/script/pre_install.js +425 -77
  172. package/script/prepare_version.js +275 -98
  173. package/services/.gna/67fdf1b224a2ed5597e63d4b64283834468e05e3.txt +0 -0
  174. package/services/.gna/arch +1 -0
  175. package/services/.gna/locals.json +14 -0
  176. package/services/.gna/platform +1 -0
  177. package/services/configure +6 -0
  178. package/services/env.json +18 -0
  179. package/services/manifest.json +30 -0
  180. package/services/package.json +11 -0
  181. package/services/src/proxy/config/app.json +6 -0
  182. package/services/src/proxy/config/routing.json +11 -0
  183. package/services/src/proxy/config/settings.json +9 -0
  184. package/services/src/proxy/config/settings.server.json +31 -0
  185. package/services/src/proxy/config/statics.json +3 -0
  186. package/services/src/proxy/controllers/controller.content.js +58 -0
  187. package/services/src/proxy/controllers/controller.js +30 -0
  188. package/{framework/v0.1.1-alpha.18/core/template/boilerplate/bundle → services/src/proxy}/controllers/setup.js +14 -14
  189. package/services/src/proxy/index.js +31 -0
  190. package/services/src/proxy/lib/domain/README.md +48 -0
  191. package/services/src/proxy/lib/domain/src/config/public_suffix_list.dat +14186 -0
  192. package/services/src/toolbar/config/app.json +6 -0
  193. package/services/src/toolbar/config/routing.json +11 -0
  194. package/{framework/v0.1.1-alpha.18/core/template/boilerplate/bundle → services/src/toolbar}/config/settings.json +0 -0
  195. package/services/src/toolbar/config/settings.server.json +30 -0
  196. package/services/src/toolbar/controllers/controller.content.js +39 -0
  197. package/services/src/toolbar/controllers/controller.js +30 -0
  198. package/services/src/toolbar/controllers/setup.js +111 -0
  199. package/services/src/toolbar/index.js +43 -0
  200. package/utils/helper.js +236 -185
  201. package/utils/prototypes.js +9 -9
  202. package/utils/prototypes.json_clone.js +70 -37
  203. package/doc/framework/cli/doc.json +0 -9
  204. package/doc/framework/index.md +0 -60
  205. package/framework/v0.1.1-alpha.18/VERSION +0 -1
  206. package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.js.map +0 -56
  207. package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.min.css +0 -1
  208. package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.min.css.map +0 -1
  209. package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.min.js +0 -736
  210. package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.min.js.map +0 -56
  211. package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.onload.min.js +0 -5
  212. package/framework/v0.1.1-alpha.18/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
  213. package/framework/v0.1.1-alpha.18/core/connectors/couchbase/lib/connector.js +0 -20
  214. package/framework/v0.1.1-alpha.18/core/connectors/couchbase/lib/session-store.js +0 -21
  215. package/framework/v0.1.1-alpha.18/core/locales/dist/region/en.json +0 -9492
  216. package/framework/v0.1.1-alpha.18/core/locales/dist/region/fr.json +0 -9492
  217. package/framework/v0.1.1-alpha.18/core/locales/src/resources/region.mapping.json +0 -28
  218. package/framework/v0.1.1-alpha.18/core/template/boilerplate/bundle_templates/html/homepage.html +0 -4
  219. package/framework/v0.1.1-alpha.18/core/template/conf/statics.json +0 -10
  220. package/framework/v0.1.1-alpha.18/helpers/json/src/main.js +0 -97
  221. package/framework/v0.1.1-alpha.18/lib/cmd/bundle/arguments.json +0 -4
  222. package/framework/v0.1.1-alpha.18/lib/cmd/bundle/list.js +0 -129
  223. package/framework/v0.1.1-alpha.18/lib/cmd/framework/init.js +0 -514
  224. package/framework/v0.1.1-alpha.18/lib/cmd/framework/set.js +0 -161
  225. package/framework/v0.1.1-alpha.18/lib/cmd/framework/status.js +0 -72
  226. package/framework/v0.1.1-alpha.18/lib/cmd/framework/tail.js +0 -183
  227. package/framework/v0.1.1-alpha.18/lib/cmd/port/list.js +0 -176
  228. package/framework/v0.1.1-alpha.18/package.json +0 -14
  229. /package/{framework/v0.1.1-alpha.18/core/template/command/gina.bat.tpl → bin/gina.bat} +0 -0
  230. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/AUTHORS +0 -0
  231. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/asset/html/nolayout.html +0 -0
  232. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/asset/html/static.html +0 -0
  233. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/asset/img/android-chrome-192x192.png +0 -0
  234. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/asset/img/android-chrome-512x512.png +0 -0
  235. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/asset/img/apple-touch-icon.png +0 -0
  236. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/asset/img/favicon-16x16.png +0 -0
  237. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/asset/img/favicon-32x32.png +0 -0
  238. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/asset/img/favicon.ico +0 -0
  239. /package/framework/{v0.1.1-alpha.18/core/asset/js → v0.1.1-alpha.181/core/asset}/plugin/uuid.json +0 -0
  240. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
  241. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/controller/controller.framework.js +0 -0
  242. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/controller/index.js +0 -0
  243. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/.travis.yml +0 -0
  244. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/LICENSE +0 -0
  245. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/README.md +0 -0
  246. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
  247. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/deps/encoding/encoding.js +0 -0
  248. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/lib/main.js +0 -0
  249. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/lib/types/multipart.js +0 -0
  250. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/lib/types/urlencoded.js +0 -0
  251. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/lib/utils.js +0 -0
  252. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/busboy/package.json +0 -0
  253. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
  254. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/dev/lib/tools.js +0 -0
  255. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/locales/currency.json +0 -0
  256. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/locales/dist/language/en.json +0 -0
  257. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/locales/dist/language/fr.json +0 -0
  258. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/locales/src/resources/currency.csv +0 -0
  259. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/locales/src/resources/region.csv +0 -0
  260. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/mime.types +0 -0
  261. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/README.md +0 -0
  262. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/file/README.md +0 -0
  263. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/file/build.json +0 -0
  264. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/intl/README.md +0 -0
  265. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/intl/build.json +0 -0
  266. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/storage/README.md +0 -0
  267. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/storage/build.json +0 -0
  268. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/validator/README.md +0 -0
  269. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/plugins/lib/validator/build.json +0 -0
  270. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/server.express.js +0 -0
  271. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/status.codes +0 -0
  272. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle/config/app.json +0 -0
  273. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle/config/routing.json +0 -0
  274. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
  275. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
  276. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle_public/css/default.css +0 -0
  277. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
  278. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
  279. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
  280. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle_public/readme.md +0 -0
  281. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
  282. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/conf/manifest.json +0 -0
  283. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/conf/settings.json +0 -0
  284. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/error/client/json/401.json +0 -0
  285. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/error/client/json/403.json +0 -0
  286. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/error/client/json/404.json +0 -0
  287. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/error/server/html/50x.html +0 -0
  288. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/error/server/json/500.json +0 -0
  289. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/error/server/json/503.json +0 -0
  290. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/core/template/extensions/logger/config.json +0 -0
  291. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/helpers/plugins/README.md +0 -0
  292. /package/framework/{v0.1.1-alpha.18/helpers/json → v0.1.1-alpha.181/lib/archiver}/README.md +0 -0
  293. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/archiver/build.json +0 -0
  294. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/copy.js +0 -0
  295. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/cp.js +0 -0
  296. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/help.js +0 -0
  297. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/rename.js +0 -0
  298. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/restart.js +0 -0
  299. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/rm.js +0 -0
  300. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/bundle/status.js +0 -0
  301. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/add.js +0 -0
  302. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/get.js +0 -0
  303. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/help.js +0 -0
  304. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/help.txt +0 -0
  305. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/link-dev.js +0 -0
  306. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/remove.js +0 -0
  307. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/rm.js +0 -0
  308. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/set.js +0 -0
  309. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/env/unset.js +0 -0
  310. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/dot.js +0 -0
  311. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/get.js +0 -0
  312. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/help.js +0 -0
  313. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/help.txt +0 -0
  314. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/msg.json +0 -0
  315. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/framework/update.js +0 -0
  316. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/gina-dev.1.md +0 -0
  317. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/gina-framework.1.md +0 -0
  318. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/gina.1.md +0 -0
  319. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/msg.json +0 -0
  320. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/port/help.js +0 -0
  321. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/port/help.txt +0 -0
  322. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/port/set.js +0 -0
  323. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/build.js +0 -0
  324. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/help.js +0 -0
  325. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/help.txt +0 -0
  326. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/import.js +0 -0
  327. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/move.js +0 -0
  328. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/rename.js +0 -0
  329. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/restart.js +0 -0
  330. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/rm.js +0 -0
  331. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/start.js +0 -0
  332. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/status.js +0 -0
  333. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/project/stop.js +0 -0
  334. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/protocol/help.js +0 -0
  335. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/protocol/help.txt +0 -0
  336. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/protocol/list.js +0 -0
  337. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/scope/help.js +0 -0
  338. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/scope/help.txt +0 -0
  339. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/scope/link-local.js +0 -0
  340. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/scope/remove.js +0 -0
  341. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/scope/rm.js +0 -0
  342. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/scope/set.js +0 -0
  343. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cmd/scope/unset.js +0 -0
  344. /package/framework/{v0.1.1-alpha.18/lib/cmd/env → v0.1.1-alpha.181/lib/cmd/scope}/use.js +0 -0
  345. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/collection/README.md +0 -0
  346. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/collection/build.json +0 -0
  347. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/cron/README.md +0 -0
  348. /package/framework/{v0.1.1-alpha.18/lib/archiver/README.md → v0.1.1-alpha.181/lib/domain/exemples/backend.js} +0 -0
  349. /package/framework/{v0.1.1-alpha.18/lib/routing/README.md → v0.1.1-alpha.181/lib/domain/exemples/frontend.html} +0 -0
  350. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/inherits/example/inheriting_eventemitter.js +0 -0
  351. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/inherits/example/protected_inheritance.js +0 -0
  352. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/inherits/example/simple_inheritance.js +0 -0
  353. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
  354. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/README.md +0 -0
  355. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
  356. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
  357. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/merge/example/merge.js +0 -0
  358. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/merge/example/merge_2_literal objects.js +0 -0
  359. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/merge/example/merge_and_preserve_first.js +0 -0
  360. /package/framework/{v0.1.1-alpha.18/lib/swig-filters → v0.1.1-alpha.181/lib/routing}/README.md +0 -0
  361. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/routing/build.json +0 -0
  362. /package/framework/{v0.1.1-alpha.18/lib/url → v0.1.1-alpha.181/lib/swig-filters}/README.md +0 -0
  363. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/url/index.js +0 -0
  364. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/url/mocks.json +0 -0
  365. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/url/routing.json +0 -0
  366. /package/framework/{v0.1.1-alpha.18 → v0.1.1-alpha.181}/lib/url/test.js +0 -0
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * This file is part of the gina package.
3
- * Copyright (c) 2009-2022 Rhinostone <contact@gina.io>
3
+ * Copyright (c) 2009-2023 Rhinostone <contact@gina.io>
4
4
  *
5
5
  * For the full copyright and license information, please view the LICENSE
6
6
  * file that was distributed with this source code.
@@ -21,12 +21,18 @@ function Routing() {
21
21
  allowedMethods: ['get', 'post', 'put', 'delete'],
22
22
  reservedParams: ['controle', 'file','title', 'namespace', 'path'],
23
23
  notFound: {}
24
- };
25
-
24
+ };
25
+
26
26
  self.allowedMethodsString = self.allowedMethods.join(',');
27
-
28
- // loading utils & plugins
29
- var plugins = null, inherits = null, merge = null, Validator = null, fs = null, promisify = null;
27
+
28
+ // loading lib & plugins
29
+ var plugins = null
30
+ , inherits = null
31
+ , merge = null
32
+ , Validator = null
33
+ , fs = null
34
+ , promisify = null
35
+ ;
30
36
  if (!isGFFCtx) {
31
37
  fs = require('fs');
32
38
  promisify = require('util').promisify;
@@ -34,26 +40,26 @@ function Routing() {
34
40
  merge = require('../../merge');
35
41
  plugins = require(__dirname+'/../../../core/plugins') || getContext('gina').plugins;
36
42
  Validator = plugins.Validator;
37
-
38
- }
43
+
44
+ }
39
45
  // BO - In case of partial rendering whithout handler defined for the partial
40
46
  else {
41
47
  if ( !merge || typeof(merge) != 'function' ) {
42
- var merge = require('utils/merge');
48
+ merge = require('lib/merge');
43
49
  }
44
- if ( !Validator || typeof(Validator) != 'function' ) {
45
- var Validator = require('utils/form-validator');
50
+ if ( !Validator || typeof(Validator) != 'function' ) {
51
+ Validator = require('lib/form-validator');
46
52
  }
47
- }
53
+ }
48
54
  // EO - In case of partial rendering whithout handler defined for the partial
49
-
55
+
50
56
  /**
51
57
  * Get url props
52
58
  * Used to retrieve additional properties for routes with redirect flag for example
53
- *
59
+ *
54
60
  * @param {string} [bundle]
55
- * @param {string} [env]
56
- *
61
+ * @param {string} [env]
62
+ *
57
63
  * @returns {object} urlProps - { .host, .hostname, .webroot }
58
64
  */
59
65
  self.getUrlProps = function(bundle, env) {
@@ -69,7 +75,7 @@ function Routing() {
69
75
  urlProps.hostname = _route.hostname;
70
76
  urlProps.host = _route.host;
71
77
  urlProps.webroot = _route.webroot;
72
- }
78
+ }
73
79
  } else {
74
80
  config = getContext('gina').config;
75
81
  if ( typeof(getContext('argvFilename')) != 'undefined' ) {
@@ -81,47 +87,47 @@ function Routing() {
81
87
  if ( typeof(env) == 'undefined' ) {
82
88
  env = config.env;
83
89
  }
84
-
90
+
85
91
  urlProps.hostname = config.envConf[bundle][env].hostname;
86
92
  urlProps.host = config.envConf[bundle][env].host;
87
93
  urlProps.webroot = config.envConf[bundle][env].server.webroot;
88
94
  }
89
-
95
+
90
96
  return urlProps;
91
97
  }
92
-
98
+
93
99
  /**
94
100
  * Load bundle routing configuration
95
- *
101
+ *
96
102
  * @param {object} options
97
103
  * {
98
104
  * isStadalone: false,
99
105
  * bundle: 'default', // bundle's name
100
106
  * wroot: '/', // by default
101
- *
107
+ *
102
108
  * }
103
- *
109
+ *
104
110
  */
105
111
  // self.loadBundleRoutingConfiguration = function(options, filename) {
106
-
112
+
107
113
  // }
108
-
114
+
109
115
  /**
110
116
  * Get routing
111
- *
117
+ *
112
118
  * @param {string} [bundle]
113
119
  */
114
120
  // self.getRouting = function(bundle) {
115
-
121
+
116
122
  // }
117
-
123
+
118
124
  /**
119
125
  * Get reversed routing
120
- *
126
+ *
121
127
  * @param {string} [bundle]
122
128
  */
123
129
  // self.getReverseRouting = function(bundle) {
124
-
130
+
125
131
  // }
126
132
 
127
133
  /**
@@ -136,7 +142,7 @@ function Routing() {
136
142
  * @returns {object|false} foundRoute
137
143
  * */
138
144
  self.compareUrls = async function(params, url, request, response, next) {
139
-
145
+
140
146
  if ( typeof(request) == 'undefined' ) {
141
147
  request = { routing: {} };
142
148
  }
@@ -174,7 +180,7 @@ function Routing() {
174
180
  * @private
175
181
  * */
176
182
  var hasParams = function(pathname) {
177
- return (/:/.test(pathname)) ? true : false;
183
+ return (/\:/.test(pathname)) ? true : false;
178
184
  };
179
185
 
180
186
  /**
@@ -190,12 +196,12 @@ function Routing() {
190
196
  *
191
197
  * */
192
198
  var parseRouting = async function(params, url, request, response, next) {
193
-
199
+
194
200
  // Sample debug break for specific rule
195
201
  // if ( params.rule == 'my-specific-rule@bundle' ) {
196
202
  // console.debug('passed '+ params.rule);
197
203
  // }
198
-
204
+
199
205
  var uRe = params.url.split(/\//)
200
206
  , uRo = url.split(/\//)
201
207
  , uReCount = 0
@@ -206,30 +212,30 @@ function Routing() {
206
212
  , i = 0
207
213
  , method = request.method.toLowerCase()
208
214
  ;
209
-
215
+
210
216
  // TODO - remove comments
211
217
  // when requirement is not listed but still validated
212
- // if (
213
- // typeof(params.requirements) != 'undefined'
218
+ // if (
219
+ // typeof(params.requirements) != 'undefined'
214
220
  // && method == params.method.toLowerCase()
215
221
  // //&& /validator\:\:/.test(JSON.stringify(params.requirements))
216
222
  // ) {
217
-
223
+
218
224
  // var requiremements = Object.getOwnPropertyNames(params.requirements);
219
225
  // var r = 0;
220
226
  // // In order to filter variables
221
227
  // var uRoVars = uRo.join(',').match(/\:[-_a-z0-9]+/g);
222
228
  // // var uRoVarCount = (uRoVars) ? uRoVars.length : 0;
223
229
  // while ( r < requiremements.length ) {
224
-
230
+
225
231
  // // if not listed, but still needing validation
226
- // if (
227
- // typeof(params.param[ requiremements[r] ]) == 'undefined'
232
+ // if (
233
+ // typeof(params.param[ requiremements[r] ]) == 'undefined'
228
234
  // && /^validator\:\:/i.test(params.requirements[ requiremements[r] ])
229
235
  // && typeof(request[method][ requiremements[r] ])
230
236
  // ) {
231
237
  // if (uRo.length != uRe.length) {
232
- // // r++;
238
+ // // r++;
233
239
  // // continue;
234
240
  // break;
235
241
  // }
@@ -239,22 +245,22 @@ function Routing() {
239
245
  // * "requirements" : {
240
246
  // * "email": "validator::{ isEmail: true, isString: [7] }"
241
247
  // * }
242
- // *
248
+ // *
243
249
  // * e.g.: result = new Validator('routing', _data, null, {email: {isEmail: true, subject: \"Anything\"}} ).isEmail().valid;
244
- // */
250
+ // */
245
251
  // let regex = params.requirements[ requiremements[r] ];
246
252
  // let _data = {}, _ruleObj = {}, _rule = {};
247
-
253
+
248
254
  // try {
249
255
  // _ruleObj = JSON.parse(
250
256
  // regex.split(/::/).splice(1)[0]
251
257
  // .replace(/([^\:\"\s+](\w+))\:/g, '"$1":') // { query: { validIf: true }} => { "query": { "validIf": true }}
252
258
  // .replace(/([^\:\"\s+](\w+))\s+\:/g, '"$1":') // note the space between `validIf` & `:` { query: { validIf : true }} => { "query": { "validIf": true }}
253
- // );
259
+ // );
254
260
  // } catch (err) {
255
261
  // throw err;
256
262
  // }
257
-
263
+
258
264
  // let key = requiremements[r];
259
265
  // // validator.query case
260
266
  // if (typeof(_ruleObj.query) != 'undefined' && typeof(_ruleObj.query.data) != 'undefined') {
@@ -268,7 +274,7 @@ function Routing() {
268
274
  // for (let p = 0, pLen = uRo.length; p < pLen; p++) {
269
275
  // // :variable only
270
276
  // if (!/^\:/.test(uRo[p])) continue;
271
-
277
+
272
278
  // let pName = uRo[p].replace(/^\:/, '');
273
279
  // if ( pName != '' && typeof(uRe[p]) != 'undefined' ) {
274
280
  // _data[ pName ] = uRe[p];
@@ -278,24 +284,24 @@ function Routing() {
278
284
  // request.params[pName] = uRe[p];
279
285
  // }
280
286
  // }
281
- // }
287
+ // }
282
288
  // }
283
289
  // // normal case
284
290
  // _data = merge(_data, request[method]);
285
-
291
+
286
292
  // if ( typeof(_data[key]) == 'undefined' ) {
287
293
  // // init default value for unlisted variable/param
288
294
  // _data[key] = null;
289
295
  // }
290
-
291
- // _rule[key] = _ruleObj;
296
+
297
+ // _rule[key] = _ruleObj;
292
298
  // _validator = new Validator('routing', _data, null, _rule );
293
-
299
+
294
300
  // if (_ruleObj.count() == 0 ) {
295
301
  // console.error('Route validation failed '+ params.rule);
296
302
  // return false;
297
303
  // }
298
-
304
+
299
305
  // for (let rule in _ruleObj) {
300
306
  // let _result = null;
301
307
  // if (Array.isArray(_ruleObj[rule])) { // has args
@@ -313,12 +319,12 @@ function Routing() {
313
319
  // r++
314
320
  // }
315
321
  // }
316
-
322
+
317
323
  // attaching routing description for this request
318
324
  var paramMethod = params.method.toLowerCase();
319
-
325
+
320
326
  var hasAlreadyBeenScored = false;
321
- if (
327
+ if (
322
328
  typeof(params.requirements) != 'undefined'
323
329
  && /get|delete/i.test(method)
324
330
  && typeof(request[method]) != 'undefined'
@@ -327,20 +333,20 @@ function Routing() {
327
333
  typeof(params.requirements) != 'undefined'
328
334
  && /get/i.test(method)
329
335
  && /delete/i.test(paramMethod)
330
- ) {
336
+ ) {
331
337
  if ( /get/i.test(method) && /delete/i.test(paramMethod) ) {
332
338
  method = paramMethod;
333
339
  }
334
340
  // `delete` methods don't have a body
335
341
  // So, request.delete is {} by default
336
- if ( /^(delete)$/i.test(method) && uRe.length === uRo.length ) {
342
+ if ( /^(delete)$/i.test(method) && uRe.length === uRo.length ) {
337
343
  // just in case
338
344
  if ( typeof(request[method]) == 'undefined' ) {
339
345
  request[method] = {};
340
346
  }
341
347
  for (let p = 0, pLen = uRo.length; p < pLen; p++) {
342
- if (uRe[p] === uRo[p]) {
343
- ++score;
348
+ if (uRe[p] === uRo[p]) {
349
+ ++score;
344
350
  continue;
345
351
  }
346
352
  let _key = uRo[p].substr(1);
@@ -355,44 +361,44 @@ function Routing() {
355
361
  continue;
356
362
  }
357
363
  if (
358
- /^:/.test(uRo[p])
364
+ /^:/.test(uRo[p])
359
365
  && typeof(condition) != 'undefined'
360
366
  && new RegExp(condition).test(uRe[p])
361
367
  ) {
362
- ++score;
363
- request[method][uRo[p].substr(1)] = uRe[p];
368
+ ++score;
369
+ request[method][uRo[p].substr(1)] = uRe[p];
364
370
  }
365
371
  }
366
- hasAlreadyBeenScored = true;
367
- }
368
-
372
+ hasAlreadyBeenScored = true;
373
+ }
374
+
369
375
  // Sample debug break for specific rule
370
376
  // if ( params.rule == 'my-specific-rule@bundle' ) {
371
377
  // console.debug('passed '+ params.rule);
372
378
  // }
373
379
  for (let p in request[method]) {
374
380
  if ( typeof(params.requirements[p]) != 'undefined' && uRo.indexOf(':' + p) < 0 ) {
375
- uRo[uRoCount] = ':' + p;
381
+ uRo[uRoCount] = ':' + p;
376
382
  ++uRoCount;
377
-
383
+
378
384
  uRe[uReCount] = request[method][p];
379
385
  ++uReCount;
380
386
  if (!hasAlreadyBeenScored && uRe.length === uRo.length)
381
- ++maxLen;
387
+ ++maxLen;
382
388
  }
383
389
  }
384
390
  }
385
-
386
-
391
+
392
+
387
393
  // Sample debug break for specific rule
388
394
  // if ( params.rule == 'my-specific-rule@bundle' ) {
389
395
  // console.debug('passed '+ params.rule);
390
396
  // }
391
-
397
+
392
398
  if (!hasAlreadyBeenScored && uRe.length === uRo.length) {
393
-
399
+
394
400
  for (; i < maxLen; ++i) {
395
-
401
+
396
402
  if (uRe[i] === uRo[i]) {
397
403
  ++score;
398
404
  }
@@ -401,15 +407,15 @@ function Routing() {
401
407
  }
402
408
  }
403
409
  }
404
-
410
+
405
411
  // This test is done to catch `validator::` rules under requirements
406
- if (
407
- typeof(params.requirements) != 'undefined'
412
+ if (
413
+ typeof(params.requirements) != 'undefined'
408
414
  && method == params.method.toLowerCase()
409
415
  && !hasAlreadyBeenScored
410
416
  && score >= maxLen
411
417
  ) {
412
-
418
+
413
419
  var requiremements = Object.getOwnPropertyNames(params.requirements);
414
420
  var r = 0;
415
421
  // In order to filter variables
@@ -419,12 +425,12 @@ function Routing() {
419
425
  // requirement name as `key`
420
426
  let key = requiremements[r];
421
427
  // if not listed, but still needing validation
422
- if (
423
- typeof(params.param[ key ]) == 'undefined'
428
+ if (
429
+ typeof(params.param[ key ]) == 'undefined'
424
430
  && /^validator\:\:/i.test(params.requirements[ key ])
425
431
  ) {
426
432
  if (uRo.length != uRe.length) {
427
- // r++;
433
+ // r++;
428
434
  // continue;
429
435
  break;
430
436
  }
@@ -434,22 +440,22 @@ function Routing() {
434
440
  * "requirements" : {
435
441
  * "email": "validator::{ isEmail: true, isString: [7] }"
436
442
  * }
437
- *
443
+ *
438
444
  * e.g.: result = new Validator('routing', _data, null, {email: {isEmail: true, subject: \"Anything\"}} ).isEmail().valid;
439
- */
445
+ */
440
446
  let regex = params.requirements[ key ];
441
447
  let _data = {}, _ruleObj = {}, _rule = {};
442
-
448
+
443
449
  try {
444
450
  _ruleObj = JSON.parse(
445
451
  regex.split(/::/).splice(1)[0]
446
452
  .replace(/([^\:\"\s+](\w+))\:/g, '"$1":') // { query: { validIf: true }} => { "query": { "validIf": true }}
447
453
  .replace(/([^\:\"\s+](\w+))\s+\:/g, '"$1":') // note the space between `validIf` & `:` { query: { validIf : true }} => { "query": { "validIf": true }}
448
- );
454
+ );
449
455
  } catch (err) {
450
456
  throw err;
451
457
  }
452
-
458
+
453
459
  // validator.query case
454
460
  if (typeof(_ruleObj.query) != 'undefined' && typeof(_ruleObj.query.data) != 'undefined') {
455
461
  _data = _ruleObj.query.data;
@@ -462,7 +468,7 @@ function Routing() {
462
468
  for (let p = 0, pLen = uRo.length; p < pLen; p++) {
463
469
  // :variable only
464
470
  if (!/^\:/.test(uRo[p])) continue;
465
-
471
+
466
472
  let pName = uRo[p].replace(/^\:/, '');
467
473
  if ( pName != '' && typeof(uRe[p]) != 'undefined' ) {
468
474
  _data[ pName ] = uRe[p];
@@ -472,9 +478,9 @@ function Routing() {
472
478
  request.params[pName] = uRe[p];
473
479
  }
474
480
  }
475
- }
481
+ }
476
482
  }
477
-
483
+
478
484
  // If validator.query has data, _data should inherit from request data
479
485
  _data = merge(_data, JSON.clone(request[method]) || {} );
480
486
  // This test is to initialize query.data[key] to null by default
@@ -482,20 +488,20 @@ function Routing() {
482
488
  // init default value for unlisted variable/param
483
489
  _data[key] = null;
484
490
  }
485
-
486
- _rule[key] = _ruleObj;
491
+
492
+ _rule[key] = _ruleObj;
487
493
  if (!isGFFCtx) {
488
494
  _validator = new Validator('routing', _data, null, _rule );
489
495
  } else {
490
496
  _validator = new Validator(_data);
491
497
  }
492
-
498
+
493
499
  if (_ruleObj.count() == 0 ) {
494
500
  console.error('Route validation failed '+ params.rule);
495
501
  --score;
496
502
  r++;
497
503
  continue;
498
- }
504
+ }
499
505
  // for each validation rule
500
506
  for (let rule in _ruleObj) {
501
507
  // updating query.data
@@ -507,8 +513,8 @@ function Routing() {
507
513
  _result = await _validator[key][rule].apply(_validator[key], _ruleObj[rule]);
508
514
  } else {
509
515
  _result = await _validator[key][rule](_ruleObj[rule], request, response, next);
510
- }
511
-
516
+ }
517
+
512
518
  //let condition = _ruleObj[rule].validIf.replace(new RegExp('\\$isValid'), _result.isValid);
513
519
  // if ( eval(condition)) {
514
520
  if ( !_result.isValid ) {
@@ -524,7 +530,7 @@ function Routing() {
524
530
  }
525
531
 
526
532
  foundRoute.past = (score === maxLen) ? true : false;
527
-
533
+
528
534
  if (foundRoute.past) {
529
535
  // attaching routing description for this request
530
536
  //request.routing = params; // can be retried in controller with: req.routing
@@ -532,7 +538,7 @@ function Routing() {
532
538
  request.routing = checkRouteParams(params, request[method]);
533
539
  foundRoute.request = request;
534
540
  }
535
-
541
+
536
542
 
537
543
  return foundRoute;
538
544
  };
@@ -563,7 +569,7 @@ function Routing() {
563
569
  , flags = null
564
570
  , key = null
565
571
  , tested = false
566
-
572
+
567
573
  , _validator = null
568
574
  , _data = null
569
575
  , _ruleObj = null
@@ -573,57 +579,57 @@ function Routing() {
573
579
  // request method
574
580
  , requestMethod = request.method.toLowerCase()
575
581
  ;
576
-
582
+
577
583
  if (!_param.length) return false;
578
584
 
579
585
  // if custom path, path rewrite
580
586
  if (params.param.path && regex.test(params.param.path)) {
581
587
  params.param.path = params.param.path.replace(regex, urlVal);
582
588
  }
583
-
589
+
584
590
  // if custom namespace, namespace rewrite
585
- if (params.param.namespace && regex.test(params.param.namespace)) {
586
- params.param.namespace = params.param.namespace.replace(regex, urlVal);
591
+ if (params.param.namespace && regex.test(params.param.namespace)) {
592
+ params.param.namespace = params.param.namespace.replace(regex, urlVal);
587
593
  }
588
-
594
+
589
595
  // if custom file, file rewrite
590
- // if (params.param.file && regex.test(params.param.file)) {
591
- // params.param.file = params.param.file.replace(regex, urlVal);
596
+ // if (params.param.file && regex.test(params.param.file)) {
597
+ // params.param.file = params.param.file.replace(regex, urlVal);
592
598
  // }
593
599
  // file is handle like url replacement (path is like pathname)
594
- if (typeof (params.param.file) != 'undefined' && /:/.test(params.param.file)) {
595
- var _regex = new RegExp('(:'+urlVar+'/|:'+urlVar+'$)', 'g');
596
- replacement.variable = urlVal;
600
+ if ( typeof(params.param.file) != 'undefined' && /\:/.test(params.param.file)) {
601
+ var _regex = new RegExp('(:'+urlVar+'/|:'+urlVar+'$)', 'g');
602
+ replacement.variable = urlVal;
597
603
  params.param.file = params.param.file.replace( _regex, replacement );
598
604
  }
599
605
 
600
606
  // if custom title, title rewrite
601
- if (params.param.title && regex.test(params.param.title)) {
607
+ if (params.param.title && regex.test(params.param.title)) {
602
608
  params.param.title = params.param.title.replace(regex, urlVal);
603
609
  }
604
610
 
605
611
  if (_param.length == 1) { // fast one
606
-
612
+
607
613
  re = new RegExp( _param[0]);
608
614
  matched = (_param.indexOf(urlVar) > -1) ? _param.indexOf(urlVar) : false;
609
-
615
+
610
616
  if (matched === false ) {
611
617
  // In order to support rules defined like :
612
618
  // { params.url } => `/section/:name/page:number`
613
619
  // { request.url } => `/section/plante/page4`
614
620
  //
615
621
  // with keys = [ ":name", ":number" ]
616
-
622
+
617
623
  if ( urlVar.match(re) ) {
618
624
  matched = 0;
619
625
  }
620
626
  }
621
-
627
+
622
628
 
623
629
  if (matched === false) return matched;
624
630
  // filter on method
625
631
  if (params.method.toLowerCase() !== requestMethod) return false;
626
-
632
+
627
633
  if ( typeof(request[requestMethod]) == 'undefined' ) {
628
634
  request[requestMethod] = {}
629
635
  }
@@ -635,7 +641,7 @@ function Routing() {
635
641
  regex = params.requirements[key];
636
642
  if (/^\//.test(regex)) {
637
643
  re = regex.match(/\/(.*)\//).pop();
638
- flags = regex.replace('/' + re + '/', '');
644
+ flags = regex.replace('/' + re + '/', '');
639
645
 
640
646
  tested = new RegExp(re, flags).test(urlVal)
641
647
  } else if ( /^validator\:\:/.test(regex) && urlVal) {
@@ -644,11 +650,11 @@ function Routing() {
644
650
  * "id" : "/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i",
645
651
  * "email": "validator::{ isEmail: true, isString: [7] }"
646
652
  * }
647
- *
653
+ *
648
654
  * e.g.: tested = new Validator('routing', _data, null, {email: {isEmail: true, subject: \"Anything\"}} ).isEmail().valid;
649
- */
650
- _data = {}; _ruleObj = {}; _rule = {}; str = '';
651
- urlVar.replace( new RegExp('[^'+ key +']','g'), function(){ str += arguments[0] });
655
+ */
656
+ _data = {}; _ruleObj = {}; _rule = {}; str = '';
657
+ urlVar.replace( new RegExp('[^'+ key +']','g'), function(){ str += arguments[0] });
652
658
  _data[key] = urlVal.replace( new RegExp(str, 'g'), '');
653
659
  try {
654
660
  //_ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
@@ -656,11 +662,11 @@ function Routing() {
656
662
  regex.split(/::/).splice(1)[0]
657
663
  .replace(/([^\:\"\s+](\w+))\:/g, '"$1":') // { query: { validIf: true }} => { "query": { "validIf": true }}
658
664
  .replace(/([^\:\"\s+](\w+))\s+\:/g, '"$1":') // note the space between `validIf` & `:` { query: { validIf : true }} => { "query": { "validIf": true }}
659
- );
665
+ );
660
666
  } catch (err) {
661
667
  throw err;
662
668
  }
663
- //_ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
669
+ //_ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
664
670
  if (typeof(_ruleObj.query) != 'undefined' && typeof(_ruleObj.query.data) != 'undefined') {
665
671
  // since we only have one param
666
672
  // :var1 == :var1
@@ -670,7 +676,7 @@ function Routing() {
670
676
  request.params[key] = _data[key];
671
677
  }
672
678
  }
673
- _rule[key] = _ruleObj;
679
+ _rule[key] = _ruleObj;
674
680
  _validator = new Validator('routing', _data, null, _rule );
675
681
  if (_ruleObj.count() == 0 ) {
676
682
  console.error('Route validation failed '+ params.rule);
@@ -681,7 +687,7 @@ function Routing() {
681
687
  await _validator[key][rule].apply(_validator[key], _ruleObj[rule]);
682
688
  } else {
683
689
  await _validator[key][rule](_ruleObj[rule], request, response, next);
684
- }
690
+ }
685
691
  }
686
692
  tested = _validator.isValid();
687
693
  } else {
@@ -694,7 +700,7 @@ function Routing() {
694
700
  typeof(params.requirements[key]) != 'undefined' &&
695
701
  typeof(request.params) != 'undefined' &&
696
702
  tested
697
- ) {
703
+ ) {
698
704
  request.params[key] = urlVal;
699
705
  if ( typeof(request[requestMethod][key]) == 'undefined' ) {
700
706
  request[requestMethod][key] = urlVal;
@@ -744,22 +750,22 @@ function Routing() {
744
750
  * "id" : "/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i",
745
751
  * "email": "validator::{ isEmail: true, isString: [7] }"
746
752
  * }
747
- *
753
+ *
748
754
  * e.g.: tested = new Validator('routing', _data, null, {email: {isEmail: true}} ).isEmail().valid;
749
- */
750
- _data = {}; _ruleObj = {}; _rule = {}; str = '';
751
- urlVar.replace( new RegExp('[^'+ key[0] +']','g'), function(){ str += arguments[0] });
755
+ */
756
+ _data = {}; _ruleObj = {}; _rule = {}; str = '';
757
+ urlVar.replace( new RegExp('[^'+ key[0] +']','g'), function(){ str += arguments[0] });
752
758
  _data[key[0]] = urlVal.replace( new RegExp(str, 'g'), '');
753
- _ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
754
- _rule[key[0]] = _ruleObj;
759
+ _ruleObj = JSON.parse(regex.split(/::/).splice(1)[0].replace(/([^\W+ true false])+(\w+)/g, '"$&"'));
760
+ _rule[key[0]] = _ruleObj;
755
761
  _validator = new Validator('routing', _data, null, _rule );
756
-
762
+
757
763
  for (let rule in _ruleObj) {
758
764
  if (Array.isArray(_ruleObj[rule])) { // has args
759
765
  _validator[key[0]][rule].apply(_validator[key[0]], _ruleObj[rule])
760
766
  } else {
761
767
  _validator[key[0]][rule](_ruleObj[rule])
762
- }
768
+ }
763
769
  }
764
770
  tested = _validator.isValid();
765
771
  } else {
@@ -817,9 +823,9 @@ function Routing() {
817
823
 
818
824
  return false
819
825
  }
820
-
826
+
821
827
  var replacement = function(matched){
822
- return ( /\/$/.test(matched) ? replacement.variable+ '/': replacement.variable )
828
+ return ( /\/$/.test(matched) ? replacement.variable+ '/': replacement.variable )
823
829
  };
824
830
  var checkRouteParams = function(route, params) {
825
831
  var variable = null
@@ -833,48 +839,48 @@ function Routing() {
833
839
  ;
834
840
  for (p in route.param) {
835
841
  if ( typeof(params) != 'undefined' && typeof(params[p]) == 'undefined' ) continue;
836
-
842
+
837
843
  if ( /^:/.test(route.param[p]) ) {
838
844
  variable = route.param[p].substr(1);
839
-
845
+
840
846
  if ( typeof(params) != 'undefined' && typeof(params[variable]) != 'undefined' ) {
841
-
842
- regex = new RegExp('(:'+variable+'/|:'+variable+'$)', 'g');
843
-
844
847
 
845
- if ( typeof(route.param.path) != 'undefined' && /:/.test(route.param.path) ) {
848
+ regex = new RegExp('(:'+variable+'/|:'+variable+'$)', 'g');
849
+
850
+
851
+ if ( typeof(route.param.path) != 'undefined' && /\:/.test(route.param.path) ) {
846
852
  route.param.path = route.param.path.replace( regex, params[variable]);
847
853
  }
848
- if (typeof (route.param.title) != 'undefined' && /:/.test(route.param.title)) {
854
+ if (typeof (route.param.title) != 'undefined' && /\:/.test(route.param.title)) {
849
855
  route.param.title = route.param.title.replace( regex, params[variable]);
850
856
  }
851
- if (typeof (route.param.namespace) != 'undefined' && /:/.test(route.param.namespace)) {
857
+ if (typeof (route.param.namespace) != 'undefined' && /\:/.test(route.param.namespace)) {
852
858
  route.param.namespace = route.param.namespace.replace( regex, params[variable]);
853
859
  }
854
860
  // file is handle like url replacement (path is like pathname)
855
- if (typeof (route.param.file) != 'undefined' && /:/.test(route.param.file)) {
856
- replacement.variable = params[variable];
861
+ if (typeof (route.param.file) != 'undefined' && /\:/.test(route.param.file)) {
862
+ replacement.variable = params[variable];
857
863
  route.param.file = route.param.file.replace( regex, replacement );
858
864
  }
859
-
860
- if ( /\,/.test(route.url) ) {
865
+
866
+ if ( /\,/.test(route.url) ) {
861
867
  urls = route.url.split(/\,/g);
862
868
  i = 0; len = urls.length;
863
869
  for (; i < len; ++i) {
864
- replacement.variable = params[variable];
870
+ replacement.variable = params[variable];
865
871
  urls[i] = urls[i].replace( regex, replacement );
866
872
  }
867
873
  route.url = urls.join(',');
868
- } else {
869
- replacement.variable = params[variable];
874
+ } else {
875
+ replacement.variable = params[variable];
870
876
  route.url = route.url.replace( regex, replacement );
871
877
  }
872
878
  }
873
879
  }
874
880
  }
875
-
881
+
876
882
  // Selecting url in case of multiple urls & optional requirmements
877
- if ( urls ) {
883
+ if ( urls ) {
878
884
  i = 0; len = urls.length;
879
885
  var rawUrlVars = null
880
886
  , rawUrlScore = null
@@ -901,8 +907,8 @@ function Routing() {
901
907
  route.urlIndex = i;
902
908
  }
903
909
  }
904
- }
905
-
910
+ }
911
+
906
912
  return route;
907
913
  }
908
914
 
@@ -916,7 +922,7 @@ function Routing() {
916
922
  * @returns {object} route
917
923
  * */
918
924
  self.getRoute = function(rule, params, urlIndex) {
919
-
925
+
920
926
  var config = null;
921
927
  if (isGFFCtx) {
922
928
  config = window.gina.config;
@@ -926,13 +932,13 @@ function Routing() {
926
932
  config.getRouting = getContext('gina').Config.instance.getRouting;
927
933
  }
928
934
  }
929
-
935
+
930
936
  var env = config.env || GINA_ENV // by default, takes the current bundle
931
937
  , envTmp = null
932
938
  //, scheme = null
933
939
  , bundle = config.bundle // by default, takes the current bundle
934
940
  ;
935
-
941
+
936
942
  if ( !/\@/.test(rule) && typeof(bundle) != 'undefined' && bundle != null) {
937
943
  rule = rule.toLowerCase()
938
944
  rule += '@' + bundle
@@ -957,8 +963,8 @@ function Routing() {
957
963
 
958
964
  rule = arr[0].toLowerCase() +'@'+ bundle;
959
965
  }
960
-
961
-
966
+
967
+
962
968
  var routing = config.getRouting(bundle, env);
963
969
 
964
970
  if ( typeof(routing[rule]) == 'undefined' ) {
@@ -981,14 +987,14 @@ function Routing() {
981
987
  delete route.urlIndex;
982
988
  }
983
989
  urlIndex = ( typeof(urlIndex) != 'undefined' ) ? urlIndex : 0;
984
- route.url = route.url.split(/,/g)[urlIndex];
990
+ route.url = route.url.split(/,/g)[urlIndex];
985
991
  }
986
992
  // fix url in case of empty param value allowed by the routing rule
987
993
  // to prevent having a folder.
988
994
  // eg.: {..., id: '/^\\s*$/'} => {..., id: ''} => /path/to/ becoming /path/to
989
995
  if ( /\/$/.test(route.url) && route.url != '/' )
990
996
  route.url = route.url.substr(0, route.url.length-1);
991
-
997
+
992
998
  // Completeting url with extra params e.g.: ?param1=val1&param2=val2
993
999
  if ( /GET/i.test(route.method) && typeof(params) != 'undefined' ) {
994
1000
  var queryParams = '?', maskedUrl = routing[rule].url;
@@ -997,48 +1003,48 @@ function Routing() {
997
1003
  if ( self.reservedParams.indexOf(r) > -1 || new RegExp(route.param[r]).test(maskedUrl) )
998
1004
  continue;
999
1005
  if (typeof(params[r]) != 'undefined' )
1000
- queryParams += r +'='+ encodeURIComponent(params[r])+ '&';
1006
+ queryParams += r +'='+ encodeRFC5987ValueChars(params[r])+ '&';
1001
1007
  }
1002
-
1008
+
1003
1009
  if (queryParams.length > 1) {
1004
1010
  queryParams = queryParams.substring(0, queryParams.length-1);
1005
1011
  route.url += queryParams;
1006
1012
  }
1007
1013
  }
1008
-
1014
+
1009
1015
  // recommanded for x-bundle coms
1010
1016
  // leave `ignoreWebRoot` empty or set it to false for x-bundle coms
1011
1017
  route.toUrl = function (ignoreWebRoot) {
1012
-
1018
+
1013
1019
  var urlProps = null;
1014
1020
  if ( /^redirect$/i.test(this.param.control) ) {
1015
1021
  urlProps = self.getUrlProps(this.bundle, (env||GINA_ENV));
1016
1022
  }
1017
-
1023
+
1018
1024
  var wroot = this.webroot || urlProps.webroot
1019
1025
  , hostname = this.hostname || urlProps.hostname
1020
1026
  , path = this.url
1021
1027
  ;
1022
-
1028
+
1023
1029
  this.url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : path;
1024
1030
 
1025
1031
  return hostname + this.url
1026
1032
  };
1027
-
1033
+
1028
1034
  /**
1029
1035
  * request current url
1030
- *
1031
- *
1032
- *
1036
+ *
1037
+ *
1038
+ *
1033
1039
  * @param {boolean} [ignoreWebRoot]
1034
1040
  * @param {object} [options] - see: https://nodejs.org/api/https.html#https_new_agent_options
1035
1041
  * @param {object} [_this] - current context: only used when `promisify`is used
1036
- *
1042
+ *
1037
1043
  * @callback {callback} [cb] - see: https://nodejs.org/api/https.html#https_new_agent_options
1038
1044
  * @param {object} res
1039
1045
  */
1040
1046
  route.request = function(ignoreWebRoot, options) {
1041
-
1047
+
1042
1048
  var cb = null, _this = null;
1043
1049
  if ( typeof(arguments[arguments.length-1]) == 'function' ) {
1044
1050
  cb = arguments[arguments.length-1];
@@ -1046,14 +1052,14 @@ function Routing() {
1046
1052
  if ( typeof(arguments[2]) == 'object' ) {
1047
1053
  _this = arguments[2];
1048
1054
  }
1049
-
1055
+
1050
1056
  var wroot = this.webroot || _this.webroot
1051
1057
  , hostname = this.hostname || _this.hostname
1052
1058
  , url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : this.url || _this.url
1053
1059
  ;
1054
-
1060
+
1055
1061
  var scheme = ( /^https/.test(hostname) ) ? 'https' : 'http';
1056
-
1062
+
1057
1063
  if (isGFFCtx) {
1058
1064
  var target = ( typeof(options) != 'undefined' && typeof(options.target) != 'undefined' ) ? options.target : "_self";
1059
1065
  window.open(url, target)
@@ -1063,11 +1069,11 @@ function Routing() {
1063
1069
  // create an agent just for this request
1064
1070
  options.agent = false;
1065
1071
  }
1066
- var agent = require(''+scheme);
1067
- var onAgentResponse = function(res) {
1068
-
1072
+ var agent = require(''+scheme);
1073
+ var onAgentResponse = function(res) {
1074
+
1069
1075
  var data = '', err = false;
1070
-
1076
+
1071
1077
  res.on('data', function (chunk) {
1072
1078
  data += chunk;
1073
1079
  });
@@ -1091,26 +1097,26 @@ function Routing() {
1091
1097
  err = parseError
1092
1098
  }
1093
1099
  }
1094
- if (err) {
1100
+ if (err) {
1095
1101
  cb(err);
1096
1102
  return;
1097
1103
  }
1098
-
1104
+
1099
1105
  cb(false, data);
1100
1106
  return;
1101
1107
  });
1102
1108
  }
1103
- if (cb) {
1109
+ if (cb) {
1104
1110
  agent.get(url, options, onAgentResponse);
1105
1111
  } else {
1106
1112
  // just throw the request without waiting/handling response
1107
1113
  agent.get(url, options);
1108
- }
1114
+ }
1109
1115
  }
1110
- return;
1111
-
1116
+ return;
1117
+
1112
1118
  } // EO route.request()
1113
-
1119
+
1114
1120
  if ( /\:/.test(route.url) ) {
1115
1121
  var paramList = route.url
1116
1122
  .match(/(\:(.*)\/|\:(.*)$)/g)
@@ -1134,21 +1140,21 @@ function Routing() {
1134
1140
  // adding hash if found
1135
1141
  if (hash)
1136
1142
  url += hash;
1137
-
1143
+
1138
1144
  route.url = url;
1139
1145
  // recommanded for x-bundle coms
1140
1146
  // leave `ignoreWebRoot` empty or set it to false for x-bundle coms
1141
- route.toUrl = function (ignoreWebRoot) {
1147
+ route.toUrl = function (ignoreWebRoot) {
1142
1148
  var wroot = this.webroot
1143
1149
  , hostname = this.hostname
1144
1150
  , path = this.url
1145
1151
  ;
1146
-
1152
+
1147
1153
  this.url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : path;
1148
1154
 
1149
1155
  return hostname + this.url
1150
1156
  };
1151
-
1157
+
1152
1158
  return route
1153
1159
  }
1154
1160
 
@@ -1161,18 +1167,18 @@ function Routing() {
1161
1167
  * @param {string} url e.g.: /webroot/some/url/path or http
1162
1168
  * @param {string} [bundle] targeted bundle
1163
1169
  * @param {string} [method] request method (GET|PUT|PUT|DELETE) - GET is set by default
1164
- * @param {object} [request]
1170
+ * @param {object} [request]
1165
1171
  * @param {boolean} [isOverridinMethod] // will replace request.method by the provided method - Used for redirections
1166
- *
1172
+ *
1167
1173
  * @returns {object|boolean} route - when route is found; `false` when not found
1168
1174
  * */
1169
-
1175
+
1170
1176
  self.getRouteByUrl = function (url, bundle, method, request, isOverridinMethod) {
1171
-
1177
+
1172
1178
  if (
1173
- arguments.length == 2
1174
- && typeof(arguments[1]) != 'undefined'
1175
- && self.allowedMethods.indexOf(arguments[1].toLowerCase()) > -1
1179
+ arguments.length == 2
1180
+ && typeof(arguments[1]) != 'undefined'
1181
+ && self.allowedMethods.indexOf(arguments[1].toLowerCase()) > -1
1176
1182
  ) {
1177
1183
  method = arguments[1];
1178
1184
  bundle = undefined;
@@ -1185,24 +1191,24 @@ function Routing() {
1185
1191
  , hostname = null
1186
1192
  , host = null
1187
1193
  ;
1188
-
1194
+
1189
1195
  if ( /\#/.test(url) && url.length > 1 ) {
1190
1196
  var urlPart = url.split(/\#/);
1191
1197
  url = urlPart[0];
1192
1198
  hash = '#' + urlPart[1];
1193
-
1199
+
1194
1200
  urlPart = null;
1195
1201
  }
1196
-
1202
+
1197
1203
  // fast method
1198
1204
  if (
1199
- arguments.length == 1
1200
- && typeof(arguments[0]) != 'undefined'
1205
+ arguments.length == 1
1206
+ && typeof(arguments[0]) != 'undefined'
1201
1207
  ) {
1202
1208
  if ( !/^(https|http)/i.test(url) && !/^\//.test(url)) {
1203
1209
  url = '/'+ url;
1204
1210
  }
1205
-
1211
+
1206
1212
  webroot = '/' + url.split(/\//g)[1];
1207
1213
  if (isGFFCtx) {
1208
1214
  reverseRouting = gina.config.reverseRouting;
@@ -1216,24 +1222,24 @@ function Routing() {
1216
1222
  host = infos.host;
1217
1223
  hostname = infos.hostname;
1218
1224
  infos = null;
1219
- }
1225
+ }
1220
1226
  }
1221
-
1227
+
1222
1228
  isOverridinMethod = ( typeof(arguments[arguments.length-1]) != 'boolean') ? false : arguments[arguments.length-1];
1223
1229
 
1224
- var matched = false
1230
+ var matched = false
1225
1231
  , config = null
1226
1232
  , env = null
1227
1233
  , prefix = null
1228
1234
  , pathname = null
1229
1235
  , params = null
1230
1236
  , isRoute = null
1231
- , foundRoute = null
1232
- , routeObj = null
1237
+ , foundRoute = null
1238
+ , routeObj = null
1233
1239
  ;
1234
-
1235
-
1236
-
1240
+
1241
+
1242
+
1237
1243
  var isMethodProvidedByDefault = ( typeof(method) != 'undefined' ) ? true : false;
1238
1244
 
1239
1245
  if (isGFFCtx) {
@@ -1257,18 +1263,18 @@ function Routing() {
1257
1263
  } else {
1258
1264
 
1259
1265
  var gnaCtx = getContext('gina');
1260
-
1266
+
1261
1267
  config = gnaCtx.config;
1262
1268
  bundle = (typeof (bundle) != 'undefined') ? bundle : config.bundle;
1263
1269
  env = config.env;
1264
1270
  routing = config.getRouting(bundle);
1265
-
1266
-
1271
+
1272
+
1267
1273
 
1268
1274
  hostname = config.envConf[bundle][env].hostname;
1269
1275
  webroot = config.envConf[bundle][env].server.webroot;
1270
1276
  prefix = hostname + webroot;
1271
-
1277
+
1272
1278
  if ( !request ) {
1273
1279
  request = {
1274
1280
  routing: {},
@@ -1286,15 +1292,15 @@ function Routing() {
1286
1292
 
1287
1293
  pathname = url.replace( new RegExp('^('+ hostname +'|'+hostname.replace(/\:\d+/, '') +')' ), '');
1288
1294
  if ( typeof(request.routing.path) == 'undefined' )
1289
- request.routing.path = unescape(pathname);
1295
+ request.routing.path = decodeURI(pathname);
1290
1296
  method = ( typeof(method) != 'undefined' ) ? method.toLowerCase() : 'get';
1291
-
1297
+
1292
1298
  if (isMethodProvidedByDefault) {
1293
1299
  // to handle 303 redirect like PUT -> GET
1294
1300
  request.originalMethod = request.method;
1295
-
1301
+
1296
1302
  request.method = method;
1297
- request.routing.path = unescape(pathname)
1303
+ request.routing.path = decodeURI(pathname)
1298
1304
  }
1299
1305
  // last method check
1300
1306
  if ( !request.method)
@@ -1302,8 +1308,8 @@ function Routing() {
1302
1308
 
1303
1309
  // getting params
1304
1310
  params = {};
1305
-
1306
-
1311
+
1312
+
1307
1313
 
1308
1314
  var paramsList = null;
1309
1315
  var re = new RegExp(method, 'i');
@@ -1318,18 +1324,18 @@ function Routing() {
1318
1324
  if (routing[name].bundle != bundle) continue;
1319
1325
 
1320
1326
  // method filter
1321
- localMethod = routing[name].method;
1327
+ localMethod = routing[name].method;
1322
1328
  if ( /\,/.test( localMethod ) && re.test(localMethod) ) {
1323
1329
  localMethod = request.method
1324
- }
1330
+ }
1325
1331
  if (typeof (routing[name].method) != 'undefined' && !re.test(localMethod)) continue;
1326
-
1327
- //Preparing params to relay to the core/router.
1332
+
1333
+ //Preparing params to relay to the core/router.
1328
1334
  params = {
1329
1335
  method : localMethod,
1330
1336
  requirements : routing[name].requirements,
1331
1337
  namespace : routing[name].namespace || undefined,
1332
- url : unescape(pathname), /// avoid %20
1338
+ url : decodeURI(pathname), /// avoid %20
1333
1339
  rule : routing[name].originalRule || name,
1334
1340
  param : routing[name].param,
1335
1341
  //middleware: routing[name].middleware,
@@ -1340,8 +1346,8 @@ function Routing() {
1340
1346
 
1341
1347
  // normal case
1342
1348
  //Parsing for the right url.
1343
- try {
1344
-
1349
+ try {
1350
+
1345
1351
  isRoute = self.compareUrls(params, routing[name].url, request);
1346
1352
 
1347
1353
  if (isRoute.past) {
@@ -1361,96 +1367,96 @@ function Routing() {
1361
1367
  } //EO for break out
1362
1368
 
1363
1369
  if (!matched) {
1364
- if (isGFFCtx) {
1365
- var urlHasChanged = false;
1366
- if (
1367
- url == '#'
1368
- && /GET/i.test(method)
1369
- && isMethodProvidedByDefault
1370
+ if (isGFFCtx) {
1371
+ var urlHasChanged = false;
1372
+ if (
1373
+ url == '#'
1374
+ && /GET/i.test(method)
1375
+ && isMethodProvidedByDefault
1370
1376
  || /^404\:/.test(url)
1371
1377
  ) {
1372
1378
  url = location.pathname;
1373
1379
  urlHasChanged = true;
1374
1380
  }
1375
-
1381
+
1376
1382
  if ( typeof(self.notFound) == 'undefined' ) {
1377
1383
  self.notFound = {}
1378
1384
  }
1379
-
1385
+
1380
1386
  var notFound = null, msg = '[ RoutingHelper::getRouteByUrl(rule[, bundle, method]) ] : route [ %r ] is called but not found inside your view: `' + url + '` !';
1381
1387
  if ( gina.hasPopinHandler && gina.popinIsBinded ) {
1382
1388
  notFound = gina.popin.getActivePopin().target.innerHTML.match(/404\:\[\w+\][a-z 0-9-_@]+/);
1383
1389
  } else {
1384
1390
  notFound = document.body.innerHTML.match(/404\:\[\w+\][a-z 0-9-_@]+/);
1385
1391
  }
1386
-
1392
+
1387
1393
  notFound = (notFound && notFound.length > 0) ? notFound[0] : null;
1388
-
1394
+
1389
1395
  if ( notFound && isMethodProvidedByDefault && urlHasChanged ) {
1390
-
1391
- var m = notFound.match(/\[\w+\]/)[0];
1392
-
1396
+
1397
+ var m = notFound.match(/\[\w+\]/)[0];
1398
+
1393
1399
  notFound = notFound.replace('404:'+m, m.replace(/\[|\]/g, '')+'::' );
1394
-
1400
+
1395
1401
  msg = msg.replace(/\%r/, notFound.replace(/404\:\s+/, ''));
1396
-
1402
+
1397
1403
  if (typeof(self.notFound[notFound]) == 'undefined') {
1398
- self.notFound[notFound] = {
1404
+ self.notFound[notFound] = {
1399
1405
  count: 1,
1400
- message: msg
1406
+ message: msg
1401
1407
  };
1402
1408
  } else if ( isMethodProvidedByDefault && typeof(self.notFound[notFound]) != 'undefined' ) {
1403
1409
  ++self.notFound[notFound].count;
1404
1410
  }
1405
-
1406
- return false
1407
- }
1408
-
1409
- notFound = null;
1410
-
1411
- var altRule = gina.config.reverseRouting[url] || null;
1411
+
1412
+ return false
1413
+ }
1414
+
1415
+ notFound = null;
1416
+
1417
+ var altRule = gina.config.reverseRouting[url] || null;
1412
1418
  if (
1413
- !notFound
1419
+ !notFound
1414
1420
  && altRule
1415
1421
  && typeof(altRule) != 'undefined'
1416
1422
  && altRule.split(/\@(.+)$/)[1] == bundle
1417
1423
  ) {
1418
-
1424
+
1419
1425
  notFound = altRule;
1420
1426
  if ( typeof(self.notFound[notFound]) == 'undefined' ) {
1421
-
1427
+
1422
1428
  msg = msg.replace(/\%r/, method.toUpperCase() +'::'+ altRule);
1423
-
1424
- self.notFound[notFound] = {
1429
+
1430
+ self.notFound[notFound] = {
1425
1431
  count: 1,
1426
- message: msg
1432
+ message: msg
1427
1433
  };
1428
- //console.warn(msg);
1434
+ //console.warn(msg);
1429
1435
  } else if ( isMethodProvidedByDefault && typeof(self.notFound[notFound]) != 'undefined' ) {
1430
1436
  ++self.notFound[notFound].count;
1431
1437
  }
1432
-
1438
+
1433
1439
  return false
1434
1440
  }
1435
-
1441
+
1436
1442
  // forms
1437
1443
  var altRoute = self.compareUrls(params, url, request) || null;
1438
1444
  if(altRoute.past && isMethodProvidedByDefault) {
1439
1445
  notFound = method.toUpperCase() +'::'+ altRoute.request.routing.rule;
1440
1446
  if ( typeof(self.notFound[notFound]) == 'undefined' ) {
1441
1447
  msg = msg.replace(/\%r/, notFound);
1442
- //console.warn(msg);
1448
+ //console.warn(msg);
1443
1449
  } else {
1444
1450
  ++self.notFound[notFound].count;
1445
1451
  }
1446
-
1452
+
1447
1453
  return false
1448
- }
1454
+ }
1449
1455
  return false
1450
1456
  }
1451
1457
 
1452
-
1453
- console.warn( new Error('[ RoutingHelper::getRouteByUrl(rule[, bundle, method, request]) ] : route not found for url: `' + url + '` !').stack );
1458
+
1459
+ console.warn( new Error('[ RoutingHelper::getRouteByUrl(rule[, bundle, method, request]) ] : route not found for url: `' + url + '` !').stack );
1454
1460
  return false;
1455
1461
  } else {
1456
1462
  // fix url in case of empty param value allowed by the routing rule
@@ -1461,21 +1467,21 @@ function Routing() {
1461
1467
  // adding hash if found
1462
1468
  if (hash)
1463
1469
  url += hash;
1464
-
1470
+
1465
1471
  route.url = url;
1466
1472
  // recommanded for x-bundle coms
1467
1473
  // leave `ignoreWebRoot` empty or set it to false for x-bundle coms
1468
- route.toUrl = function (ignoreWebRoot) {
1474
+ route.toUrl = function (ignoreWebRoot) {
1469
1475
  var wroot = this.webroot
1470
1476
  , hostname = this.hostname
1471
1477
  , path = this.url
1472
1478
  ;
1473
-
1479
+
1474
1480
  this.url = ( typeof(ignoreWebRoot) != 'undefined' && ignoreWebRoot == true ) ? path.replace(wroot, '/') : path;
1475
-
1481
+
1476
1482
  return hostname + this.url
1477
1483
  };
1478
-
1484
+
1479
1485
  return route
1480
1486
  }
1481
1487
  }
@@ -1487,6 +1493,6 @@ if ((typeof (module) !== 'undefined') && module.exports) {
1487
1493
  // Publish as node.js module
1488
1494
  module.exports = Routing()
1489
1495
  } else if (typeof (define) === 'function' && define.amd) {
1490
- // Publish as AMD module
1491
- define('utils/routing', ['require', 'utils/form-validator', 'utils/merge'], function() { return Routing() })
1496
+ // Publish as AMD module
1497
+ define('lib/routing', ['require', 'lib/form-validator', 'lib/merge'], function() { return Routing() })
1492
1498
  }