gina 0.1.1-alpha.19 → 0.1.1-alpha.191

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 (369) 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.19/lib/inherits → v0.1.1-alpha.191}/LICENSE +1 -1
  10. package/framework/v0.1.1-alpha.191/VERSION +1 -0
  11. package/framework/{v0.1.1-alpha.19/core/asset/js/plugin/readme.md → v0.1.1-alpha.191/core/asset/plugin/README.md} +31 -9
  12. package/framework/v0.1.1-alpha.191/core/asset/plugin/dist/vendor/gina/css/gina.min.css +1 -0
  13. package/framework/v0.1.1-alpha.191/core/asset/plugin/dist/vendor/gina/css/gina.min.css.map +1 -0
  14. package/framework/v0.1.1-alpha.191/core/asset/plugin/dist/vendor/gina/html/toolbar.html +251 -0
  15. package/framework/{v0.1.1-alpha.19/core/asset/js/plugin/dist → v0.1.1-alpha.191/core/asset/plugin/dist/vendor/gina/js}/gina.js +4364 -3175
  16. package/framework/v0.1.1-alpha.191/core/asset/plugin/dist/vendor/gina/js/gina.min.js +764 -0
  17. package/framework/v0.1.1-alpha.191/core/asset/plugin/dist/vendor/gina/js/gina.min.js.map +8 -0
  18. package/framework/v0.1.1-alpha.191/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +5 -0
  19. package/framework/v0.1.1-alpha.191/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.map +8 -0
  20. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/config.js +172 -79
  21. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/connectors/couchbase/index.js +373 -259
  22. package/framework/v0.1.1-alpha.191/core/connectors/couchbase/lib/connector.js +22 -0
  23. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/connectors/couchbase/lib/connector.v2.js +51 -51
  24. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/connectors/couchbase/lib/connector.v3.js +51 -51
  25. package/framework/v0.1.1-alpha.191/core/connectors/couchbase/lib/connector.v4.js +384 -0
  26. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/connectors/couchbase/lib/n1ql.js +3 -2
  27. package/framework/v0.1.1-alpha.191/core/connectors/couchbase/lib/session-store.js +22 -0
  28. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/connectors/couchbase/lib/session-store.v3.js +12 -12
  29. package/framework/v0.1.1-alpha.191/core/connectors/couchbase/lib/session-store.v4.js +361 -0
  30. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/controller/controller.js +921 -773
  31. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/dev/index.js +1 -1
  32. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/dev/lib/class.js +1 -1
  33. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/dev/lib/factory.js +2 -2
  34. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/gna.js +13 -9
  35. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/locales/README.md +5 -0
  36. package/framework/v0.1.1-alpha.191/core/locales/dist/region/en.json +5727 -0
  37. package/framework/v0.1.1-alpha.191/core/locales/dist/region/fr.json +11452 -0
  38. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/locales/index.js +2 -2
  39. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/locales/src/make.js +39 -41
  40. package/framework/v0.1.1-alpha.191/core/locales/src/resources/region.mapping.json +43 -0
  41. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/model/entity.js +87 -67
  42. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/model/index.js +16 -16
  43. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/model/template/entityFactory.js +1 -1
  44. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/model/template/index.js +17 -15
  45. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/index.js +1 -1
  46. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/file/package.json +1 -1
  47. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/intl/package.json +1 -1
  48. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/intl/src/main.js +5 -5
  49. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/storage/package.json +1 -1
  50. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/storage/src/main.js +6 -5
  51. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/validator/package.json +1 -1
  52. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/validator/src/form-validator.js +403 -300
  53. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/validator/src/main.js +1368 -1314
  54. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/router.js +99 -90
  55. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/server.isaac.js +203 -180
  56. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/server.js +439 -238
  57. package/framework/v0.1.1-alpha.191/core/template/boilerplate/bundle/config/settings.json +12 -0
  58. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle/config/settings.server.json +4 -4
  59. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle/config/templates.json +4 -4
  60. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle/controllers/controller.content.js +1 -1
  61. package/framework/v0.1.1-alpha.191/core/template/boilerplate/bundle/controllers/setup.js +111 -0
  62. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle/index.js +13 -1
  63. package/framework/v0.1.1-alpha.191/core/template/boilerplate/bundle_templates/html/content/homepage.html +8 -0
  64. package/framework/v0.1.1-alpha.191/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +11 -0
  65. package/framework/v0.1.1-alpha.191/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +8 -0
  66. package/framework/{v0.1.1-alpha.19/core/template/boilerplate/bundle_templates/html/layout → v0.1.1-alpha.191/core/template/boilerplate/bundle_templates/html/layouts}/main.html +10 -3
  67. package/framework/v0.1.1-alpha.191/core/template/command/gina.bat.tpl +8 -0
  68. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/command/gina.tpl +4 -4
  69. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/conf/env.json +11 -0
  70. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/conf/package.json +1 -1
  71. package/framework/v0.1.1-alpha.191/core/template/conf/statics.json +12 -0
  72. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/conf/templates.json +2 -2
  73. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/console.js +3 -3
  74. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/context.js +148 -7
  75. package/framework/v0.1.1-alpha.191/helpers/data/LICENSE +9 -0
  76. package/framework/v0.1.1-alpha.191/helpers/data/README.md +12 -0
  77. package/framework/v0.1.1-alpha.191/helpers/data/package.json +20 -0
  78. package/framework/v0.1.1-alpha.191/helpers/data/src/main.js +295 -0
  79. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/dateFormat.js +9 -7
  80. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/index.js +13 -8
  81. package/framework/v0.1.1-alpha.191/helpers/json/LICENSE +9 -0
  82. package/framework/v0.1.1-alpha.191/helpers/json/README.md +12 -0
  83. package/framework/{v0.1.1-alpha.19/helpers/plugins → v0.1.1-alpha.191/helpers/json}/package.json +2 -2
  84. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/json/src/main.js +28 -26
  85. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/path.js +176 -96
  86. package/framework/{v0.1.1-alpha.19/helpers/json → v0.1.1-alpha.191/helpers/plugins}/package.json +2 -2
  87. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/plugins/src/api-error.js +23 -23
  88. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/plugins/src/main.js +3 -3
  89. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/prototypes.js +46 -38
  90. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/task.js +21 -14
  91. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/text.js +2 -2
  92. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/archiver/package.json +1 -1
  93. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/archiver/src/dep/jszip.min.js +3 -3
  94. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/archiver/src/main.js +168 -168
  95. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/aliases.json +4 -1
  96. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/add.js +84 -27
  97. package/framework/v0.1.1-alpha.191/lib/cmd/bundle/arguments.json +7 -0
  98. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/help.txt +4 -2
  99. package/framework/v0.1.1-alpha.191/lib/cmd/bundle/list.js +176 -0
  100. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/remove.js +36 -27
  101. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/start.js +264 -46
  102. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/stop.js +93 -74
  103. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/add.js +44 -43
  104. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/list.js +23 -4
  105. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/remove.js +19 -19
  106. package/framework/{v0.1.1-alpha.19/lib/cmd/scope → v0.1.1-alpha.191/lib/cmd/env}/use.js +21 -1
  107. package/framework/v0.1.1-alpha.191/lib/cmd/framework/build.js +88 -0
  108. package/framework/v0.1.1-alpha.191/lib/cmd/framework/init.js +798 -0
  109. package/framework/v0.1.1-alpha.191/lib/cmd/framework/link-node-modules.js +116 -0
  110. package/framework/v0.1.1-alpha.191/lib/cmd/framework/link.js +114 -0
  111. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/open.js +22 -1
  112. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/restart.js +61 -26
  113. package/framework/v0.1.1-alpha.191/lib/cmd/framework/set.js +276 -0
  114. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/start.js +46 -20
  115. package/framework/v0.1.1-alpha.191/lib/cmd/framework/status.js +141 -0
  116. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/stop.js +47 -28
  117. package/framework/v0.1.1-alpha.191/lib/cmd/framework/tail.js +302 -0
  118. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/version.js +15 -3
  119. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/helper.js +131 -18
  120. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/index.js +23 -23
  121. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/port/inc/scan.js +32 -16
  122. package/framework/v0.1.1-alpha.191/lib/cmd/port/list.js +462 -0
  123. package/framework/v0.1.1-alpha.191/lib/cmd/port/reset.js +429 -0
  124. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/add.js +147 -122
  125. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/arguments.json +2 -1
  126. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/build.js +28 -28
  127. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/list.js +19 -2
  128. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/remove.js +19 -17
  129. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/rename.js +11 -11
  130. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/protocol/set.js +256 -209
  131. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/scope/list.js +27 -8
  132. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/scope/remove.js +19 -19
  133. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/view/add.js +35 -10
  134. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/collection/package.json +1 -1
  135. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/collection/src/main.js +243 -242
  136. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/config.js +31 -30
  137. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cron/package.json +1 -1
  138. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cron/src/main.js +10 -9
  139. package/framework/v0.1.1-alpha.191/lib/domain/LICENSE +9 -0
  140. package/framework/v0.1.1-alpha.191/lib/domain/README.md +46 -0
  141. package/framework/v0.1.1-alpha.191/lib/domain/dist/public_suffix_list.dat +14186 -0
  142. package/framework/v0.1.1-alpha.191/lib/domain/package.json +20 -0
  143. package/framework/v0.1.1-alpha.191/lib/domain/src/main.js +442 -0
  144. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/generator/index.js +4 -4
  145. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/index.js +3 -2
  146. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191/lib/inherits}/LICENSE +1 -1
  147. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/inherits/README.md +2 -2
  148. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/inherits/package.json +3 -4
  149. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/inherits/src/main.js +3 -3
  150. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/package.json +2 -2
  151. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/src/containers/default/index.js +13 -2
  152. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/src/containers/file/index.js +109 -14
  153. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/src/containers/mq/index.js +12 -3
  154. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/src/containers/mq/listener.js +16 -14
  155. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/src/containers/mq/speaker.js +32 -3
  156. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/src/helper.js +21 -1
  157. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/src/main.js +36 -9
  158. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/math/index.js +9 -9
  159. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/merge/README.md +2 -2
  160. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/merge/package.json +1 -1
  161. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/merge/src/main.js +118 -91
  162. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/model.js +10 -10
  163. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/proc.js +87 -49
  164. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/routing/package.json +1 -1
  165. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/routing/src/main.js +313 -285
  166. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/session-store.js +6 -6
  167. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/shell.js +3 -3
  168. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/swig-filters/package.json +1 -1
  169. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/swig-filters/src/main.js +140 -119
  170. package/framework/v0.1.1-alpha.191/lib/url/README.md +0 -0
  171. package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/validator.js +2 -2
  172. package/framework/v0.1.1-alpha.191/package.json +14 -0
  173. package/package.json +33 -24
  174. package/resources/home/main.json +53 -4
  175. package/resources/home/settings.json +9 -0
  176. package/resources/home/user/extensions/logger/default/config.json +1 -1
  177. package/resources/package.json.template +29 -18
  178. package/script/post_install.js +409 -124
  179. package/script/post_publish.js +186 -0
  180. package/script/pre_install.js +425 -77
  181. package/script/prepare_version.js +275 -98
  182. package/services/.gna/67fdf1b224a2ed5597e63d4b64283834468e05e3.txt +0 -0
  183. package/services/.gna/arch +1 -0
  184. package/services/.gna/locals.json +14 -0
  185. package/services/.gna/platform +1 -0
  186. package/services/configure +6 -0
  187. package/services/env.json +18 -0
  188. package/services/manifest.json +30 -0
  189. package/services/package.json +11 -0
  190. package/services/src/proxy/config/app.json +6 -0
  191. package/services/src/proxy/config/routing.json +11 -0
  192. package/services/src/proxy/config/settings.json +9 -0
  193. package/services/src/proxy/config/settings.server.json +31 -0
  194. package/services/src/proxy/config/statics.json +3 -0
  195. package/services/src/proxy/controllers/controller.content.js +58 -0
  196. package/services/src/proxy/controllers/controller.js +30 -0
  197. package/{framework/v0.1.1-alpha.19/core/template/boilerplate/bundle → services/src/proxy}/controllers/setup.js +14 -14
  198. package/services/src/proxy/index.js +31 -0
  199. package/services/src/proxy/lib/domain/README.md +48 -0
  200. package/services/src/proxy/lib/domain/src/config/public_suffix_list.dat +14186 -0
  201. package/services/src/toolbar/config/app.json +6 -0
  202. package/services/src/toolbar/config/routing.json +11 -0
  203. package/{framework/v0.1.1-alpha.19/core/template/boilerplate/bundle → services/src/toolbar}/config/settings.json +0 -0
  204. package/services/src/toolbar/config/settings.server.json +30 -0
  205. package/services/src/toolbar/controllers/controller.content.js +39 -0
  206. package/services/src/toolbar/controllers/controller.js +30 -0
  207. package/services/src/toolbar/controllers/setup.js +111 -0
  208. package/services/src/toolbar/index.js +43 -0
  209. package/utils/helper.js +236 -185
  210. package/utils/prototypes.js +9 -9
  211. package/utils/prototypes.json_clone.js +70 -37
  212. package/doc/framework/cli/doc.json +0 -9
  213. package/doc/framework/index.md +0 -60
  214. package/framework/v0.1.1-alpha.19/VERSION +0 -1
  215. package/framework/v0.1.1-alpha.19/core/asset/js/plugin/dist/gina.js.map +0 -56
  216. package/framework/v0.1.1-alpha.19/core/asset/js/plugin/dist/gina.min.css +0 -1
  217. package/framework/v0.1.1-alpha.19/core/asset/js/plugin/dist/gina.min.css.map +0 -1
  218. package/framework/v0.1.1-alpha.19/core/asset/js/plugin/dist/gina.min.js +0 -736
  219. package/framework/v0.1.1-alpha.19/core/asset/js/plugin/dist/gina.min.js.map +0 -56
  220. package/framework/v0.1.1-alpha.19/core/asset/js/plugin/dist/gina.onload.min.js +0 -5
  221. package/framework/v0.1.1-alpha.19/core/asset/js/plugin/dist/gina.onload.min.js.map +0 -8
  222. package/framework/v0.1.1-alpha.19/core/connectors/couchbase/lib/connector.js +0 -20
  223. package/framework/v0.1.1-alpha.19/core/connectors/couchbase/lib/session-store.js +0 -21
  224. package/framework/v0.1.1-alpha.19/core/locales/dist/region/en.json +0 -9492
  225. package/framework/v0.1.1-alpha.19/core/locales/dist/region/fr.json +0 -9492
  226. package/framework/v0.1.1-alpha.19/core/locales/src/resources/region.mapping.json +0 -28
  227. package/framework/v0.1.1-alpha.19/core/template/boilerplate/bundle_templates/html/homepage.html +0 -4
  228. package/framework/v0.1.1-alpha.19/core/template/conf/statics.json +0 -10
  229. package/framework/v0.1.1-alpha.19/lib/cmd/bundle/arguments.json +0 -4
  230. package/framework/v0.1.1-alpha.19/lib/cmd/bundle/list.js +0 -129
  231. package/framework/v0.1.1-alpha.19/lib/cmd/framework/init.js +0 -514
  232. package/framework/v0.1.1-alpha.19/lib/cmd/framework/set.js +0 -161
  233. package/framework/v0.1.1-alpha.19/lib/cmd/framework/status.js +0 -72
  234. package/framework/v0.1.1-alpha.19/lib/cmd/framework/tail.js +0 -183
  235. package/framework/v0.1.1-alpha.19/lib/cmd/port/list.js +0 -176
  236. package/framework/v0.1.1-alpha.19/package.json +0 -14
  237. /package/{framework/v0.1.1-alpha.19/core/template/command/gina.bat.tpl → bin/gina.bat} +0 -0
  238. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/AUTHORS +0 -0
  239. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/asset/html/nolayout.html +0 -0
  240. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/asset/html/static.html +0 -0
  241. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/asset/img/android-chrome-192x192.png +0 -0
  242. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/asset/img/android-chrome-512x512.png +0 -0
  243. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/asset/img/apple-touch-icon.png +0 -0
  244. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/asset/img/favicon-16x16.png +0 -0
  245. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/asset/img/favicon-32x32.png +0 -0
  246. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/asset/img/favicon.ico +0 -0
  247. /package/framework/{v0.1.1-alpha.19/core/asset/js → v0.1.1-alpha.191/core/asset}/plugin/uuid.json +0 -0
  248. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
  249. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/controller/controller.framework.js +0 -0
  250. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/controller/index.js +0 -0
  251. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/.travis.yml +0 -0
  252. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/LICENSE +0 -0
  253. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/README.md +0 -0
  254. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -0
  255. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/deps/encoding/encoding.js +0 -0
  256. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/lib/main.js +0 -0
  257. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/lib/types/multipart.js +0 -0
  258. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/lib/types/urlencoded.js +0 -0
  259. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/lib/utils.js +0 -0
  260. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/busboy/package.json +0 -0
  261. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
  262. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/dev/lib/tools.js +0 -0
  263. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/locales/currency.json +0 -0
  264. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/locales/dist/language/en.json +0 -0
  265. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/locales/dist/language/fr.json +0 -0
  266. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/locales/src/resources/currency.csv +0 -0
  267. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/locales/src/resources/region.csv +0 -0
  268. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/mime.types +0 -0
  269. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/README.md +0 -0
  270. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/file/README.md +0 -0
  271. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/file/build.json +0 -0
  272. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/intl/README.md +0 -0
  273. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/intl/build.json +0 -0
  274. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/storage/README.md +0 -0
  275. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/storage/build.json +0 -0
  276. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/validator/README.md +0 -0
  277. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/plugins/lib/validator/build.json +0 -0
  278. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/server.express.js +0 -0
  279. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/status.codes +0 -0
  280. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle/config/app.json +0 -0
  281. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle/config/routing.json +0 -0
  282. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
  283. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
  284. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle_public/css/default.css +0 -0
  285. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
  286. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
  287. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
  288. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle_public/readme.md +0 -0
  289. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
  290. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/conf/manifest.json +0 -0
  291. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/conf/settings.json +0 -0
  292. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/error/client/json/401.json +0 -0
  293. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/error/client/json/403.json +0 -0
  294. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/error/client/json/404.json +0 -0
  295. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/error/server/html/50x.html +0 -0
  296. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/error/server/json/500.json +0 -0
  297. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/error/server/json/503.json +0 -0
  298. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/core/template/extensions/logger/config.json +0 -0
  299. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/helpers/plugins/README.md +0 -0
  300. /package/framework/{v0.1.1-alpha.19/helpers/json → v0.1.1-alpha.191/lib/archiver}/README.md +0 -0
  301. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/archiver/build.json +0 -0
  302. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/copy.js +0 -0
  303. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/cp.js +0 -0
  304. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/help.js +0 -0
  305. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/rename.js +0 -0
  306. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/restart.js +0 -0
  307. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/rm.js +0 -0
  308. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/bundle/status.js +0 -0
  309. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/get.js +0 -0
  310. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/help.js +0 -0
  311. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/help.txt +0 -0
  312. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/link-dev.js +0 -0
  313. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/rm.js +0 -0
  314. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/set.js +0 -0
  315. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/env/unset.js +0 -0
  316. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/dot.js +0 -0
  317. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/get.js +0 -0
  318. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/help.js +0 -0
  319. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/help.txt +0 -0
  320. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/msg.json +0 -0
  321. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/framework/update.js +0 -0
  322. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/gina-dev.1.md +0 -0
  323. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/gina-framework.1.md +0 -0
  324. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/gina.1.md +0 -0
  325. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/msg.json +0 -0
  326. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/port/help.js +0 -0
  327. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/port/help.txt +0 -0
  328. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/port/set.js +0 -0
  329. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/help.js +0 -0
  330. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/help.txt +0 -0
  331. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/import.js +0 -0
  332. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/move.js +0 -0
  333. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/restart.js +0 -0
  334. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/rm.js +0 -0
  335. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/start.js +0 -0
  336. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/status.js +0 -0
  337. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/project/stop.js +0 -0
  338. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/protocol/help.js +0 -0
  339. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/protocol/help.txt +0 -0
  340. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/protocol/list.js +0 -0
  341. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/scope/help.js +0 -0
  342. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/scope/help.txt +0 -0
  343. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/scope/link-local.js +0 -0
  344. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/scope/rm.js +0 -0
  345. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/scope/set.js +0 -0
  346. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cmd/scope/unset.js +0 -0
  347. /package/framework/{v0.1.1-alpha.19/lib/cmd/env → v0.1.1-alpha.191/lib/cmd/scope}/use.js +0 -0
  348. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/collection/README.md +0 -0
  349. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/collection/build.json +0 -0
  350. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/cron/README.md +0 -0
  351. /package/framework/{v0.1.1-alpha.19/lib/archiver/README.md → v0.1.1-alpha.191/lib/domain/exemples/backend.js} +0 -0
  352. /package/framework/{v0.1.1-alpha.19/lib/routing/README.md → v0.1.1-alpha.191/lib/domain/exemples/frontend.html} +0 -0
  353. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/inherits/example/inheriting_eventemitter.js +0 -0
  354. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/inherits/example/protected_inheritance.js +0 -0
  355. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/inherits/example/simple_inheritance.js +0 -0
  356. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
  357. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/README.md +0 -0
  358. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
  359. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
  360. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/merge/example/merge.js +0 -0
  361. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/merge/example/merge_2_literal objects.js +0 -0
  362. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/merge/example/merge_and_preserve_first.js +0 -0
  363. /package/framework/{v0.1.1-alpha.19/lib/swig-filters → v0.1.1-alpha.191/lib/routing}/README.md +0 -0
  364. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/routing/build.json +0 -0
  365. /package/framework/{v0.1.1-alpha.19/lib/url → v0.1.1-alpha.191/lib/swig-filters}/README.md +0 -0
  366. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/url/index.js +0 -0
  367. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/url/mocks.json +0 -0
  368. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/url/routing.json +0 -0
  369. /package/framework/{v0.1.1-alpha.19 → v0.1.1-alpha.191}/lib/url/test.js +0 -0
@@ -15,7 +15,7 @@ const swig = require( _(GINA_FRAMEWORK_DIR +'/node_modules/swig', true)
15
15
  var Config = require('./config');
16
16
  var Router = require('./router');
17
17
  var lib = require('./../lib');
18
- var routingUtils = lib.routing;
18
+ var routingLib = lib.routing;
19
19
  var inherits = lib.inherits;
20
20
  var merge = lib.merge;
21
21
  var Proc = lib.Proc;
@@ -227,13 +227,56 @@ function Server(options) {
227
227
  })
228
228
  });
229
229
  } catch (err) {
230
- console.emerg(sslDetails +'\n'+ err.stack);
231
- return;
230
+ if (!sslDetails) {
231
+ throw new Error('DNS issue ? Did you check your `/etc/hosts` or your DNS configuration ?\n'+ err.stack);
232
+ }
233
+ throw new Error(sslDetails +'\n'+ err.stack);
232
234
  }
233
235
 
234
236
 
235
237
  const failed = !sslDetails.valid;
236
238
  const humanView = JSON.stringify(sslDetails, null, ' ');
239
+
240
+ // Wildcard exception - See https://github.com/dyaa/ssl-checker/issues/381
241
+ // Date of the test: 2022-12-18T00:00:00.000Z
242
+ // container-87546.dev.sample.app -> not valid when it should return true.
243
+ // {
244
+ // "daysRemaining": 290,
245
+ // "valid": false,
246
+ // "validFrom": "2022-10-03T00:00:00.000Z",
247
+ // "validTo": "2023-10-03T23:59:59.000Z",
248
+ // "validFor": [
249
+ // "*.sample.app",
250
+ // "sample.app"
251
+ // ]
252
+ // }
253
+
254
+ const isHandleByWildcardCert = function(endpoint, hv) {
255
+ var isAllowed = false;
256
+ const start = new Date(hv.validFrom).format('longIsoDateTime');
257
+ const end = new Date(hv.validTo).format('longIsoDateTime');
258
+ const today = new Date().format('longIsoDateTime');
259
+ const allowed = hv.validFor;
260
+
261
+ for (let i=0, len=allowed.length; i<len; ++i ) {
262
+ // skip if not a wildcard
263
+ if ( ! /^[*]\./.test(allowed[i]) ) continue;
264
+
265
+ let re = new RegExp( allowed[i].replace(/^[*]/, '')+'$' );
266
+ if ( ! re.test(endpoint) ) continue;
267
+
268
+ if ( today >= start && today < end) {
269
+ isAllowed = true;
270
+ break
271
+ }
272
+ }
273
+ return isAllowed;
274
+ }
275
+ if ( failed && Array.isArray(sslDetails.validFor) && isHandleByWildcardCert(endpoint, sslDetails) ) {
276
+ return;
277
+ }
278
+
279
+
237
280
  if (failed) {
238
281
  if (sslDetails.daysRemaining > -1) {
239
282
  console.emerg(`[Certificate] ${endpoint} : It is like there is a problem with your CA certificate${'\n'} ${humanView}`);
@@ -495,149 +538,149 @@ function Server(options) {
495
538
  return _hasViews
496
539
  }
497
540
 
498
- var parseCollection = function (collection, obj) {
499
-
500
- for(var i = 0, len = collection.length; i<len; ++i) {
501
- obj[i] = parseObject(collection[i], obj);
502
- }
503
-
504
- return obj
505
- }
506
-
507
- var parseObject = function (tmp, obj) {
508
- var el = []
509
- , key = null
510
- ;
511
-
512
- for (var o in tmp) {
513
-
514
- el[0] = o;
515
- el[1] = tmp[o];
516
-
517
- if ( /^(.*)\[(.*)\]/.test(el[0]) ) { // some[field] ?
518
- key = el[0].replace(/\]/g, '').split(/\[/g);
519
- obj = parseLocalObj(obj, key, 0, el[1])
520
- } else {
521
- obj[ el[0] ] = el[1]
522
- }
523
- }
524
-
525
- return obj
526
- }
527
-
528
- var parseBody = function(body) {
529
- var obj = null, tmp = null, arr = null;
530
- if ( /^(\{|\[|\%7B|\%5B)/.test(body) ) {
531
- try {
532
- obj = {};
533
-
534
- if ( /^(\%7B|\%5B)/.test(body) ) {
535
- tmp = JSON.parse(decodeURIComponent(body))
536
- } else {
537
- tmp = JSON.parse(body)
538
- }
539
-
540
- if ( Array.isArray(tmp) ) {
541
- obj = parseCollection(tmp, obj)
542
- } else {
543
- obj = parseObject(tmp, obj)
544
- }
545
-
546
- return obj
547
- } catch (err) {
548
- console.error('[365] could not parse body:\n' + body)
549
- }
550
-
551
- } else {
552
- obj = {};
553
- arr = body.split(/&/g);
554
- if ( /(\"false\"|\"true\"|\"on\")/.test(body) )
555
- body = body.replace(/\"false\"/g, false).replace(/\"true\"/g, true).replace(/\"on\"/g, true);
556
-
541
+ // var parseCollection = function (collection, obj) {
557
542
 
558
- var el = {}
559
- , value = null
560
- , key = null;
543
+ // for(var i = 0, len = collection.length; i<len; ++i) {
544
+ // obj[i] = parseObject(collection[i], obj);
545
+ // }
561
546
 
562
- for (var i = 0, len = arr.length; i < len; ++i) {
563
- if (!arr[i]) continue;
547
+ // return obj
548
+ // }
564
549
 
565
- arr[i] = decodeURIComponent(arr[i]);
550
+ // var parseObject = function (tmp, obj) {
551
+ // var el = []
552
+ // , key = null
553
+ // ;
566
554
 
567
- if ( /^\{/.test(arr[i]) || /\=\{/.test(arr[i]) || /\=\[/.test(arr[i]) ) {
568
- //if ( /^\{/.test(arr[i]) ) { // is a json string
569
- try {
570
- if (/^\{/.test(arr[i])) {
571
- obj = JSON.parse(arr[i]);
572
- break;
573
- } else {
574
- el = arr[i].match(/\=(.*)/);
575
- el[0] = arr[i].split(/\=/)[0];
576
- obj[ el[0] ] = JSON.parse( el[1] );
577
- }
555
+ // for (var o in tmp) {
578
556
 
557
+ // el[0] = o;
558
+ // el[1] = tmp[o];
579
559
 
580
- } catch (err) {
581
- console.error('[parseBody#1] could not parse body:\n' + arr[i])
582
- }
583
- } else {
584
- el = arr[i].split(/=/);
585
- if ( /\{\}\"\:/.test(el[1]) ) { //might be a json
586
- try {
587
- el[1] = JSON.parse(el[1])
588
- } catch (err) {
589
- console.error('[parseBody#2] could not parse body:\n' + el[1])
590
- }
591
- }
592
-
593
- if ( typeof(el[1]) == 'string' && !/\[object /.test(el[1])) {
594
- key = null;
595
- el[0] = decodeURIComponent(el[0]);
596
- el[1] = decodeURIComponent(el[1]);
560
+ // if ( /^(.*)\[(.*)\]/.test(el[0]) ) { // some[field] ?
561
+ // key = el[0].replace(/\]/g, '').split(/\[/g);
562
+ // obj = parseLocalObj(obj, key, 0, el[1])
563
+ // } else {
564
+ // obj[ el[0] ] = el[1]
565
+ // }
566
+ // }
597
567
 
598
- if ( /^(.*)\[(.*)\]/.test(el[0]) ) { // some[field] ?
599
- key = el[0].replace(/\]/g, '').split(/\[/g);
600
- obj = parseLocalObj(obj, key, 0, el[1])
601
- } else {
602
- obj[ el[0] ] = el[1]
603
- }
604
- }
605
- }
606
- }
568
+ // return obj
569
+ // }
607
570
 
608
- return obj
609
- }
571
+ // var parseBody = function(body) {
572
+ // var obj = null, tmp = null, arr = null;
573
+ // if ( /^(\{|\[|\%7B|\%5B)/.test(body) ) {
574
+ // try {
575
+ // obj = ( /^(\{|\%7B)/.test() ) ? {} : [];
576
+
577
+ // if ( /^(\%7B|\%5B)/.test(body) ) {
578
+ // tmp = JSON.parse(decodeURIComponent(body))
579
+ // } else {
580
+ // tmp = JSON.parse(body)
581
+ // }
582
+
583
+ // if ( Array.isArray(tmp) ) {
584
+ // obj = parseCollection(tmp, obj)
585
+ // } else {
586
+ // obj = parseObject(tmp, obj)
587
+ // }
588
+
589
+ // return obj
590
+ // } catch (err) {
591
+ // console.error('[365] could not parse body:\n' + body)
592
+ // }
593
+
594
+ // } else {
595
+ // obj = {};
596
+ // arr = body.split(/&/g);
597
+ // if ( /(\"false\"|\"true\"|\"on\")/.test(body) )
598
+ // body = body.replace(/\"false\"/g, false).replace(/\"true\"/g, true).replace(/\"on\"/g, true);
599
+
600
+
601
+ // var el = {}
602
+ // , value = null
603
+ // , key = null;
604
+
605
+ // for (var i = 0, len = arr.length; i < len; ++i) {
606
+ // if (!arr[i]) continue;
607
+
608
+ // arr[i] = decodeURIComponent(arr[i]);
609
+
610
+ // if ( /^\{/.test(arr[i]) || /\=\{/.test(arr[i]) || /\=\[/.test(arr[i]) ) {
611
+ // //if ( /^\{/.test(arr[i]) ) { // is a json string
612
+ // try {
613
+ // if (/^\{/.test(arr[i])) {
614
+ // obj = JSON.parse(arr[i]);
615
+ // break;
616
+ // } else {
617
+ // el = arr[i].match(/\=(.*)/);
618
+ // el[0] = arr[i].split(/\=/)[0];
619
+ // obj[ el[0] ] = JSON.parse( el[1] );
620
+ // }
621
+
622
+
623
+ // } catch (err) {
624
+ // console.error('[parseBody#1] could not parse body:\n' + arr[i])
625
+ // }
626
+ // } else {
627
+ // el = arr[i].split(/=/);
628
+ // if ( /\{\}\"\:/.test(el[1]) ) { //might be a json
629
+ // try {
630
+ // el[1] = JSON.parse(el[1])
631
+ // } catch (err) {
632
+ // console.error('[parseBody#2] could not parse body:\n' + el[1])
633
+ // }
634
+ // }
635
+
636
+ // if ( typeof(el[1]) == 'string' && !/\[object /.test(el[1])) {
637
+ // key = null;
638
+ // el[0] = decodeURIComponent(el[0]);
639
+ // el[1] = decodeURIComponent(el[1]);
640
+
641
+ // if ( /^(.*)\[(.*)\]/.test(el[0]) ) { // some[field] ?
642
+ // key = el[0].replace(/\]/g, '').split(/\[/g);
643
+ // obj = parseLocalObj(obj, key, 0, el[1])
644
+ // } else {
645
+ // obj[ el[0] ] = el[1]
646
+ // }
647
+ // }
648
+ // }
649
+ // }
650
+
651
+ // return obj
652
+ // }
610
653
 
611
654
 
612
- }
655
+ // }
613
656
 
614
- var parseLocalObj = function(obj, key, k, value) {
657
+ // var parseLocalObj = function(obj, key, k, value) {
615
658
 
616
- if ( typeof(obj[ key[k] ]) == 'undefined' ) {
617
- obj[ key[k] ] = {};
618
- }
659
+ // if ( typeof(obj[ key[k] ]) == 'undefined' ) {
660
+ // obj[ key[k] ] = {};
661
+ // }
619
662
 
620
- for (var prop in obj) {
663
+ // for (var prop in obj) {
621
664
 
622
- if (k == key.length-1) {
665
+ // if (k == key.length-1) {
623
666
 
624
- if (prop == key[k]) {
625
- obj[prop] = ( typeof(value) != 'undefined' ) ? value : '';
626
- }
667
+ // if (prop == key[k]) {
668
+ // obj[prop] = ( typeof(value) != 'undefined' ) ? value : '';
669
+ // }
627
670
 
628
- } else if ( key.indexOf(prop) > -1 ) {
629
- ++k;
630
- if ( !obj[prop][ key[k] ] )
631
- obj[prop][ key[k] ] = {};
671
+ // } else if ( key.indexOf(prop) > -1 ) {
672
+ // ++k;
673
+ // if ( !obj[prop][ key[k] ] )
674
+ // obj[prop][ key[k] ] = {};
632
675
 
633
676
 
634
- parseLocalObj(obj[prop], key, k, value)
677
+ // parseLocalObj(obj[prop], key, k, value)
635
678
 
636
- }
637
- }
679
+ // }
680
+ // }
638
681
 
639
- return obj;
640
- }
682
+ // return obj;
683
+ // }
641
684
 
642
685
  var getAssetFilenameFromUrl = function(bundleConf, url) {
643
686
 
@@ -1071,7 +1114,6 @@ function Server(options) {
1071
1114
  // Should not override main server.response.header.methods
1072
1115
  resHeaders['access-control-allow-methods'] = request.routing.method.replace(/(\,\s+|\,)/g, ', ').toUpperCase();
1073
1116
 
1074
-
1075
1117
  if ( typeof(request.headers.origin) != 'undefined' ) {
1076
1118
  authority = request.headers.origin;
1077
1119
  } else if (request.headers.referer) {
@@ -1082,7 +1124,6 @@ function Server(options) {
1082
1124
  // access-control-allow-origin settings
1083
1125
  if ( resHeaders.count() > 0 ) {
1084
1126
  // authority by default if no Access Control Allow Origin set
1085
- //authority = ( typeof(referer) != 'undefined') ? conf.server.scheme +'://'+ request.headers.referer.match(/:\/\/(.[^\/]+)(.*)/)[1] : (request.headers[':scheme'] +'://'+request.headers[':authority'] || conf.server.scheme +'://'+request.headers.host || null);
1086
1127
  if (!authority) {
1087
1128
  if (!referer) {
1088
1129
  if ( /http\/2/.test(conf.server.protocol) ) {
@@ -1106,58 +1147,97 @@ function Server(options) {
1106
1147
  re = new RegExp(authority);
1107
1148
  allowedOrigin = ( typeof(conf.server.response.header['access-control-allow-origin']) != 'undefined' && conf.server.response.header['access-control-allow-origin'] != '' ) ? conf.server.response.header['access-control-allow-origin'] : authority;
1108
1149
  var found = null, origin = null, origins = null; // to handles multiple origins
1150
+ // var originHostReplacement = function(name) {
1151
+ // name = name.replace(/\{|\}/g, '');
1152
+ // name = name.split(/\@/);
1153
+ // var bundle = name[0]
1154
+ // , project = name[1]
1155
+ // , arr = null
1156
+ // , domain = null
1157
+ // ;
1158
+ // var env = conf.env; // current env by default
1159
+ // if ( /\//.test(name[1]) ) {
1160
+ // arr = name[1].split(/\//);
1161
+ // project = arr[0];
1162
+ // env = (arr[1]) ? arr[1] : env;
1163
+ // }
1164
+
1165
+ // domain = ( !/^http/.test(self.conf[bundle][env].hostname) || /^\/\//.test(self.conf[bundle][env].hostname) ) ? scheme +'://'+ self.conf[bundle][env].hostname.replace(/^\/\//, '') : self.conf[bundle][env].hostname;
1166
+ // // sameOrigin = (domain == self.conf[bundle][env].hostname) ? self.conf[bundle][env].hostname : false;
1167
+
1168
+ // return domain
1169
+ // }
1170
+
1109
1171
  var originHostReplacement = function(name) {
1110
- name = name.split(/\@/);
1111
- var bundle = name[0]
1112
- , project = name[1]
1113
- , arr = null
1114
- , domain = null
1115
- ;
1116
- var env = conf.env; // current env by default
1117
- if ( /\//.test(name[1]) ) {
1118
- arr = name[1].split(/\//);
1119
- project = arr[0];
1120
- env = (arr[1]) ? arr[1] : env;
1172
+ var matched = name.match(/{([-_A-z]+?@[-_A-z]+?)}/g);
1173
+ if (!matched || !Array.isArray(matched) || Array.isArray(matched) && matched.length == 0 ) {
1174
+ return name
1121
1175
  }
1176
+ var env = self.conf.env;
1177
+
1178
+ for (let i=0, len=matched.length; i<len; ++i) {
1179
+ let oldHost = matched[i];
1180
+ let newHost = matched[i].replace(/\{|\}|\s+/g, '');
1181
+ newHost = newHost.split(/\@/);
1182
+ let bundle = newHost[0]
1183
+ , project = newHost[1]
1184
+ , arr = null
1185
+ , hostname = null
1186
+ , scheme = null
1187
+ ;
1188
+ if ( /\//.test(newHost[1]) ) {
1189
+ arr = newHost[1].split(/\//);
1190
+ project = arr[0];
1191
+ env = (arr[1]) ? arr[1] : env;
1192
+ }
1193
+ scheme = self.conf[bundle][env].server.scheme;
1194
+ hostname = ( !self.conf[bundle][env].hostname ) ? self.conf[bundle][env].server.scheme + '://' + self.conf[bundle][env].host + ':' + self.conf[bundle][env].server.port : self.conf[bundle][env].hostname;
1195
+ name = name.replace(oldHost, hostname);
1196
+ }
1197
+ matched = null;
1198
+ env = null;
1122
1199
 
1123
- domain = ( !/^http/.test(self.conf[bundle][env].hostname) || /^\/\//.test(self.conf[bundle][env].hostname) ) ? scheme +'://'+ self.conf[bundle][env].hostname.replace(/^\/\//, '') : self.conf[bundle][env].hostname;
1124
- sameOrigin = (domain == self.conf[bundle][env].hostname) ? self.conf[bundle][env].hostname : false;
1125
-
1126
- return domain
1200
+ return name;
1127
1201
  }
1128
1202
 
1129
- var headerValue = null;
1203
+ var headerValue = null, re = new RegExp('\{\s*(.*)\s*\}', 'g');
1130
1204
  for (var h in resHeaders) {
1131
- if (!response.headersSent) {
1205
+ if (
1206
+ !response.headersSent
1207
+ ) {
1132
1208
  // handles multiple origins
1133
1209
  if ( /access\-control\-allow\-origin/i.test(h) ) { // re.test(resHeaders[h]
1134
1210
  if (sameOrigin) {
1135
1211
  origin = sameOrigin
1136
1212
  } else {
1137
1213
  if ( /\,/.test(allowedOrigin) ) {
1138
- origins = allowedOrigin.replace(/\s+/g, '').replace(/([a-z0-9_-]+\@[a-z0-9_-]+|[a-z0-9_-]+\@[a-z0-9_-]+\/[a-z0-9_-]+\@[a-z0-9_-]+)/ig, originHostReplacement).split(/\,/g);
1214
+ origins = allowedOrigin.replace(/\s+/g, '').replace(re, originHostReplacement).split(/\,/g);
1139
1215
 
1140
1216
  found = ( origins.indexOf(authority) > -1 ) ? origins[origins.indexOf(authority)] : false;
1141
1217
  if ( found != false ) {
1142
1218
  origin = found
1143
1219
  }
1144
1220
  } else {
1145
- origin = allowedOrigin
1221
+ origin = allowedOrigin.replace(/\s+/g, '').replace(re, originHostReplacement);
1146
1222
  }
1147
1223
  }
1148
1224
 
1149
1225
  if (origin || sameOrigin) {
1150
- if (!origin && sameOrigin)
1226
+ if (!origin && sameOrigin) {
1151
1227
  origin = sameOrigin;
1228
+ }
1152
1229
 
1153
-
1154
- response.setHeader(h, origin);
1230
+ try {
1231
+ response.setHeader(h, origin);
1232
+ } catch (headerError) {
1233
+ console.error(headerError)
1234
+ }
1155
1235
  }
1156
1236
  sameOrigin = false;
1157
1237
  } else {
1158
1238
  headerValue = resHeaders[h];
1159
1239
  try {
1160
- response.setHeader(h, headerValue)
1240
+ response.setHeader(h, headerValue);
1161
1241
  } catch (headerError) {
1162
1242
  console.error(headerError)
1163
1243
  }
@@ -1178,11 +1258,92 @@ function Server(options) {
1178
1258
  }
1179
1259
 
1180
1260
  this.onHttp2Stream = function(stream, headers, response) {
1261
+ var header = null
1262
+ , isWebroot = false
1263
+ , pathname = null
1264
+ , asset = null
1265
+ , assets = this._options.template.assets
1266
+ , conf = this._options.conf
1267
+ , cacheless = conf.cacheless
1268
+ ;
1269
+
1270
+
1271
+ if (
1272
+ headers[':path'] == '/'
1273
+ || headers[':path'] == this._options.conf.server.webroot
1274
+ ) {
1275
+
1276
+ if (
1277
+ this._options.conf.server.webroot != headers[':path']
1278
+ && this._options.conf.server.webrootAutoredirect
1279
+ || headers[':path'] == this._options.conf.server.webroot
1280
+ && this._options.conf.server.webrootAutoredirect
1281
+ ) {
1282
+ isWebroot = true
1283
+ }
1284
+ }
1285
+
1286
+ var url = (isWebroot) ? this._referrer : headers[':path'];
1287
+
1288
+ var hanlersPath = conf.handlersPath
1289
+ , isHandler = (
1290
+ typeof(assets[ url ]) != 'undefined'
1291
+ && typeof(assets[ url ].filename) != 'undefined'
1292
+ && new RegExp('^'+ hanlersPath).test(assets[ url ].filename)
1293
+ ) ? true: false
1294
+ ;
1181
1295
 
1182
1296
  if (!stream.pushAllowed) {
1183
- //header = merge({ ':status': 200 }, response.getHeaders());
1184
- stream.respond({ ':status': 200 });
1185
- stream.end();
1297
+ asset = {
1298
+ url : url,
1299
+ filename : assets[ url ].filename,
1300
+ file : null,
1301
+ isAvailable : assets[ url ].isAvailable,
1302
+ mime : assets[ url ].mime,
1303
+ encoding : conf.encoding,
1304
+ isBinary : assets[ url ].isBinary,
1305
+ isHandler : assets[ url ].isHandler
1306
+ };
1307
+ header = merge({ ':status': 200 }, response.getHeaders());
1308
+ header['content-type'] = ( !/charset/.test(asset.mime ) ) ? asset.mime + '; charset='+ asset.encoding : asset.mime;
1309
+ header = completeHeaders(header, local.request, response);
1310
+ if (asset.isBinary || asset.isHandler ) {
1311
+
1312
+
1313
+ if (asset.isHandler) {
1314
+ // adding handler `gina.ready(...)` wrapper
1315
+ var file = null;
1316
+ if ( !fs.existsSync(asset.filename) ) {
1317
+ throwError({stream: stream}, 404, 'Page not found: \n' + headers[':path']);
1318
+ return;
1319
+ }
1320
+
1321
+ if (!assets[ url ].file) {
1322
+ file = fs.readFileSync(asset.filename, asset.encoding).toString();
1323
+ file = '(gina.ready(function onGinaReady($){\n'+ file + '\n},window["originalContext"]));';
1324
+ this._options.template.assets[ headers[':path'] ].file = file;
1325
+ } else {
1326
+ file = assets[ url ].file;
1327
+ }
1328
+
1329
+ // header['content-length'] = fs.statSync(file).size;
1330
+ stream.respond(header);
1331
+ stream.end(file);
1332
+
1333
+ return;
1334
+ }
1335
+
1336
+ header['content-length'] = fs.statSync(asset.filename).size;
1337
+ stream.respondWithFile(
1338
+ asset.filename
1339
+ , header
1340
+ //, { onError }
1341
+ );
1342
+ } else {
1343
+ stream.respond(header);
1344
+ stream.end();
1345
+ }
1346
+
1186
1347
  return;
1187
1348
  }
1188
1349
 
@@ -1193,18 +1354,18 @@ function Server(options) {
1193
1354
  return;
1194
1355
  }
1195
1356
 
1196
- var header = null, isWebroot = false, pathname = null;
1197
1357
  if (
1198
- headers[':path'] == '/'
1199
- || headers[':path'] == this._options.conf.server.webroot
1358
+ // headers[':path'] == '/'
1359
+ // || headers[':path'] == this._options.conf.server.webroot
1360
+ /^true$/i.test(isWebroot)
1200
1361
  ) {
1201
1362
 
1202
- if (
1203
- this._options.conf.server.webroot != headers[':path']
1204
- && this._options.conf.server.webrootAutoredirect
1205
- || headers[':path'] == this._options.conf.server.webroot
1206
- && this._options.conf.server.webrootAutoredirect
1207
- ) {
1363
+ // if (
1364
+ // this._options.conf.server.webroot != headers[':path']
1365
+ // && this._options.conf.server.webrootAutoredirect
1366
+ // || headers[':path'] == this._options.conf.server.webroot
1367
+ // && this._options.conf.server.webrootAutoredirect
1368
+ // ) {
1208
1369
 
1209
1370
  header = {
1210
1371
  ':status': 301
@@ -1220,9 +1381,10 @@ function Server(options) {
1220
1381
  stream.respond(header);
1221
1382
  stream.end();
1222
1383
  return;
1223
- } else {
1224
- isWebroot = true;
1225
- }
1384
+ // }
1385
+ // else {
1386
+ // isWebroot = true;
1387
+ // }
1226
1388
  }
1227
1389
 
1228
1390
  if (
@@ -1235,21 +1397,19 @@ function Server(options) {
1235
1397
  header = {
1236
1398
  ':status': 200
1237
1399
  };
1238
- var url = (isWebroot) ? this._referrer : headers[':path'];
1239
- var assets = this._options.template.assets;
1400
+ // var assets = this._options.template.assets;
1401
+ // var url = (isWebroot) ? this._referrer : headers[':path'];
1240
1402
  var responseHeaders = ( typeof(this._responseHeaders) != 'undefined') ? this._responseHeaders : null;
1241
- var conf = this._options.conf;
1242
- var asset = {
1243
- url : url,
1244
- filename : assets[ url ].filename,
1245
- file : null,
1246
- isAvailable : assets[ url ].isAvailable,
1247
- mime : assets[ url ].mime,
1248
- encoding : conf.encoding,
1249
- isHandler : false
1250
- }
1251
- , cacheless = conf.cacheless
1252
- ;
1403
+ // var conf = this._options.conf;
1404
+ asset = {
1405
+ url : url,
1406
+ filename : assets[ url ].filename,
1407
+ file : null,
1408
+ isAvailable : assets[ url ].isAvailable,
1409
+ mime : assets[ url ].mime,
1410
+ encoding : conf.encoding,
1411
+ isHandler : isHandler
1412
+ };
1253
1413
 
1254
1414
  console.debug('h2 pushing: '+ headers[':path'] + ' -> '+ asset.filename);
1255
1415
 
@@ -1261,7 +1421,7 @@ function Server(options) {
1261
1421
  return;
1262
1422
  }
1263
1423
 
1264
- asset.isHandler = true;
1424
+ asset.isHandler = this._options.template.assets[ headers[':path'] ].isHandler = true;
1265
1425
  asset.file = fs.readFileSync(asset.filename, asset.encoding).toString();
1266
1426
  asset.file = '(gina.ready(function onGinaReady($){\n'+ asset.file + '\n},window["originalContext"]));';
1267
1427
 
@@ -1287,6 +1447,9 @@ function Server(options) {
1287
1447
 
1288
1448
 
1289
1449
  header['content-type'] = ( !/charset/.test(asset.mime ) ) ? asset.mime + '; charset='+ asset.encoding : asset.mime;
1450
+ if (assets[ url ].isBinary) {
1451
+ header['content-length'] = fs.statSync(assets[ url ].filename).size;
1452
+ }
1290
1453
 
1291
1454
  if (cacheless) {
1292
1455
  // source maps integration for javascript & css
@@ -1305,8 +1468,9 @@ function Server(options) {
1305
1468
  header = merge(header, responseHeaders);
1306
1469
  }
1307
1470
  header = completeHeaders(header, local.request, response);
1471
+ var pushedFile = (/index.html$/.test(headers[':path']) && /\/$/.test(asset.filename) ) ? asset.filename +'index.html': asset.filename;
1308
1472
  pushStream.respondWithFile(
1309
- asset.filename
1473
+ pushedFile
1310
1474
  , header
1311
1475
  //, { onError }
1312
1476
  );
@@ -1382,6 +1546,7 @@ function Server(options) {
1382
1546
  var isFilenameDir = null
1383
1547
  , dirname = null
1384
1548
  , isBinary = null
1549
+ , isHandler = null
1385
1550
  , hanlersPath = null
1386
1551
  ;
1387
1552
 
@@ -1431,7 +1596,7 @@ function Server(options) {
1431
1596
  header['pragma'] = 'no-cache';
1432
1597
  header['expires'] = '0';
1433
1598
  }
1434
- request = checkPreflightRequest(request);
1599
+ request = checkPreflightRequest(request, response);
1435
1600
  header = completeHeaders(header, request, response);
1436
1601
 
1437
1602
  if (!stream.destroyed) {
@@ -1441,7 +1606,7 @@ function Server(options) {
1441
1606
 
1442
1607
  } else {
1443
1608
  response.setHeader('location', request.url);
1444
- request = checkPreflightRequest(request);
1609
+ request = checkPreflightRequest(request, response);
1445
1610
  completeHeaders(null, request, response);
1446
1611
  if (cacheless) {
1447
1612
  response.writeHead(301, {
@@ -1458,20 +1623,27 @@ function Server(options) {
1458
1623
  }
1459
1624
 
1460
1625
 
1461
- if (cacheless)
1626
+ if (cacheless) {
1462
1627
  delete require.cache[require.resolve(filename)];
1628
+ }
1463
1629
 
1464
-
1630
+ if (response.headersSent) {
1631
+ // May be sent by http/2 push
1632
+ return
1633
+ }
1465
1634
  fs.readFile(filename, bundleConf.encoding, function onStaticFileRead(err, file) {
1466
1635
  if (err) {
1467
1636
  throwError(response, 404, 'Page not found: \n' + pathname, next);
1468
1637
  return;
1469
- } else if (!response.headersSent) {
1638
+ }
1639
+
1640
+ if (!response.headersSent) {
1470
1641
 
1471
- isBinary = true;
1642
+ isBinary = true;
1643
+ isHandler = false;
1472
1644
 
1473
1645
  try {
1474
- contentType = getHead(response, filename);
1646
+ contentType = getContentTypeByFilename(filename);
1475
1647
 
1476
1648
  // adding gina loader
1477
1649
  if ( /text\/html/i.test(contentType) && self.isCacheless() ) {
@@ -1488,7 +1660,8 @@ function Server(options) {
1488
1660
  hanlersPath = bundleConf.handlersPath;
1489
1661
 
1490
1662
  if ( new RegExp('^'+ hanlersPath).test(filename) ) {
1491
- isBinary = false;
1663
+ isBinary = false;
1664
+ isHandler = true;
1492
1665
  file = '(gina.ready(function onGinaReady($){\n'+ file + '\n},window["originalContext"]));'
1493
1666
  }
1494
1667
  }
@@ -1513,7 +1686,9 @@ function Server(options) {
1513
1686
  isAvailable: true,
1514
1687
  mime: contentType,
1515
1688
  url: request.url,
1516
- filename: filename
1689
+ filename: filename,
1690
+ isBinary: isBinary,
1691
+ isHandler: isHandler
1517
1692
  }
1518
1693
  }
1519
1694
 
@@ -1577,7 +1752,7 @@ function Server(options) {
1577
1752
  }
1578
1753
  }
1579
1754
 
1580
- contentType = getHead(response, filename);
1755
+ contentType = getContentTypeByFilename(filename);
1581
1756
  contentType = contentType +'; charset='+ bundleConf.encoding;
1582
1757
  ext = request.url.match(/\.([A-Za-z0-9]+)$/);
1583
1758
  request.url = ( ext != null && typeof(ext[0]) != 'undefined' ) ? request.url : request.url + 'index.html';
@@ -1592,12 +1767,15 @@ function Server(options) {
1592
1767
  isAvailable: (!/404\.html/.test(filename)) ? true : false,
1593
1768
  mime: contentType,
1594
1769
  url: request.url,
1595
- filename: filename
1770
+ filename: filename,
1771
+ isBinary: isBinary,
1772
+ isHandler: isHandler
1596
1773
  }
1597
1774
  }
1598
1775
 
1599
1776
  if (!fs.existsSync(filename)) return;
1600
- isBinary = ( /text\/html/i.test(contentType) ) ? false : true;
1777
+ isBinary = ( /text\/html/i.test(contentType) ) ? false : true;
1778
+ isHandler = ( new RegExp('^'+ bundleConf.handlersPath).test(filename) ) ? true : false;
1601
1779
  if ( isBinary ) {
1602
1780
  // override
1603
1781
  self._options.template.assets[request.url] = {
@@ -1605,7 +1783,19 @@ function Server(options) {
1605
1783
  isAvailable: true,
1606
1784
  mime: contentType,
1607
1785
  url: request.url,
1608
- filename: filename
1786
+ filename: filename,
1787
+ isBinary: isBinary,
1788
+ isHandler: isHandler
1789
+ }
1790
+ }
1791
+
1792
+ if ( isHandler ) {
1793
+ // adding handler `gina.ready(...)` wrapper
1794
+ var file = null;
1795
+ if (!self._options.template.assets[request.url].file) {
1796
+ file = fs.readFileSync(filename, bundleConf.encoding).toString();
1797
+ file = '(gina.ready(function onGinaReady($){\n'+ file + '\n},window["originalContext"]));';
1798
+ self._options.template.assets[request.url].file = file;
1609
1799
  }
1610
1800
  }
1611
1801
  self.onHttp2Stream(stream, headers, response);
@@ -1729,21 +1919,23 @@ function Server(options) {
1729
1919
  * */
1730
1920
  request.isWithCredentials = ( request.headers['access-control-allow-credentials'] && request.headers['access-control-allow-credentials'] == true ) ? true : false;
1731
1921
  /**
1732
- * Intercept gina headers
1922
+ * Intercept gina headers for:
1923
+ * - form valdiation
1924
+ * - form security
1733
1925
  */
1734
- if ( typeof(request.headers['x-gina-form-id']) != 'undefined' ) {
1735
- var ginaHeaders = {
1736
- form: {
1737
- id: request.headers['x-gina-form-id']
1738
- }
1739
- };
1740
- if ( typeof(request.headers['x-gina-form-rule']) != 'undefined' ) {
1741
- var rule = request.headers['x-gina-form-rule'].split(/\@/);
1742
- ginaHeaders.form.rule = rule[0];
1743
- ginaHeaders.form.bundle = rule[1];
1744
- }
1745
- request.ginaHeaders = ginaHeaders;
1926
+ var ginaHeaders = {
1927
+ form: {}
1928
+ };
1929
+ // if (/x\-gina\-form\-id/i.test(request.headers['access-control-request-headers']) ) {
1930
+ if ( typeof(request.headers['x-gina-form-rule']) != 'undefined' ) {
1931
+ ginaHeaders.form.id = request.headers['x-gina-form-id'];
1932
+ }
1933
+ if ( typeof(request.headers['x-gina-form-rule']) != 'undefined' ) {
1934
+ var rule = request.headers['x-gina-form-rule'].split(/\@/);
1935
+ ginaHeaders.form.rule = rule[0];
1936
+ ginaHeaders.form.bundle = rule[1];
1746
1937
  }
1938
+ request.ginaHeaders = ginaHeaders;
1747
1939
 
1748
1940
  local.request = request;
1749
1941
 
@@ -1830,8 +2022,6 @@ function Server(options) {
1830
2022
  if (
1831
2023
  staticProps.isStaticFilename && staticsArr.indexOf(request.url) > -1
1832
2024
  || staticProps.isStaticFilename && staticsArr.indexOf( request.url.replace(request.url.substr(request.url.lastIndexOf('/')+1), '') ) > -1
1833
- //|| staticProps.isStaticFilename && staticsArr.indexOf(staticProps.firstLevel) > -1
1834
- // take ^/dir/sub/*
1835
2025
  || staticProps.isStaticFilename && new RegExp('^'+ staticProps.firstLevel).test(request.url)
1836
2026
  || /\/$/.test(request.url) && !isWebrootHandledByRouting && !/\/engine\.io\//.test(request.url)
1837
2027
  ) {
@@ -1845,7 +2035,7 @@ function Server(options) {
1845
2035
  'method': 'GET',
1846
2036
  'bundle' : self.appName
1847
2037
  };
1848
- request = checkPreflightRequest(request);
2038
+ request = checkPreflightRequest(request, response);
1849
2039
  local.request = request; // update request
1850
2040
  // filtered to handle only html for now
1851
2041
  if ( /text\/html/.test(request.headers['accept'])
@@ -1923,6 +2113,8 @@ function Server(options) {
1923
2113
  * - https://developers.google.com/web/updates/2012/06/How-to-convert-ArrayBuffer-to-and-from-String
1924
2114
  * - https://jsperf.com/arraybuffer-string-conversion/4
1925
2115
  *
2116
+ * TODO - Test with audio content
2117
+ *
1926
2118
  * @param {string} str
1927
2119
  *
1928
2120
  * @returns {array} buffer
@@ -2155,16 +2347,16 @@ function Server(options) {
2155
2347
 
2156
2348
  });//EO this.instance
2157
2349
 
2158
-
2159
2350
  self.instance.listen(self.conf[self.appName][self.env].server.port);//By Default 3100
2160
2351
  self.instance.timeout = (1000 * 300); // e.g.: 1000x60 => 60 sec
2161
2352
 
2353
+
2162
2354
  self.emit('started', self.conf[self.appName][self.env], true);
2163
2355
  }
2164
2356
 
2165
2357
  var processRequestData = function(request, response, next) {
2166
2358
 
2167
- var bodyStr = null, obj = null;
2359
+ var bodyStr = null, obj = null, exception = null;
2168
2360
  // to compare with /core/controller/controller.js -> getParams()
2169
2361
  switch( request.method.toLowerCase() ) {
2170
2362
  case 'post':
@@ -2193,7 +2385,13 @@ function Server(options) {
2193
2385
  bodyStr = bodyStr.replace(/\"null\"/ig, null);
2194
2386
 
2195
2387
  try {
2196
- obj = parseBody(bodyStr);
2388
+ // obj = parseBody(bodyStr);
2389
+ obj = formatDataFromString(bodyStr);
2390
+ if ( !obj) {
2391
+ exception = new Error('Could not convert POST::BODY_STRING to POST::OBJECT. Possible JSON error in `bodyStr`');
2392
+ throwError(response, 500, exception, next);
2393
+ return;
2394
+ }
2197
2395
  request.post = obj;
2198
2396
  isPostSet = true;
2199
2397
  } catch (err) {
@@ -2226,7 +2424,8 @@ function Server(options) {
2226
2424
  if (request.body.count() == 0 && typeof(request.query) != 'string' && request.query.count() > 0 ) {
2227
2425
  request.body = request.query
2228
2426
  }
2229
- bodyStr = JSON.stringify(request.body);
2427
+ // 2023-01-31: fixed `request.body` might not be an `object`
2428
+ bodyStr = ( typeof(request.body) == 'object') ? JSON.stringify(request.body) : request.body;
2230
2429
  // false & true case
2231
2430
  if ( /(\"false\"|\"true\"|\"on\")/.test(bodyStr) )
2232
2431
  bodyStr = bodyStr.replace(/\"false\"/g, false).replace(/\"true\"/g, true).replace(/\"on\"/g, true);
@@ -2235,7 +2434,7 @@ function Server(options) {
2235
2434
  }
2236
2435
 
2237
2436
  try {
2238
- if ( obj.count() > 0 ) {
2437
+ if ( typeof(obj) == 'object' && obj.count() > 0 ) {
2239
2438
  // still need this to allow compatibility with express & connect middlewares
2240
2439
  request.body = request.post = obj;
2241
2440
  }
@@ -2276,7 +2475,7 @@ function Server(options) {
2276
2475
 
2277
2476
 
2278
2477
  if ( typeof(request.query.inheritedData) == 'string' ) {
2279
- inheritedDataObj = parseBody(decodeURIComponent(request.query.inheritedData));
2478
+ inheritedDataObj = formatDataFromString(decodeURIComponent(request.query.inheritedData));
2280
2479
  } else {
2281
2480
  inheritedDataObj = JSON.clone(request.query.inheritedData);
2282
2481
  }
@@ -2293,7 +2492,7 @@ function Server(options) {
2293
2492
  bodyStr = bodyStr.replace(/\"null\"/ig, null);
2294
2493
 
2295
2494
 
2296
- obj = parseBody(decodeURIComponent(bodyStr));
2495
+ obj = formatDataFromString(decodeURIComponent(bodyStr));
2297
2496
 
2298
2497
  request.query = merge(obj, inheritedDataObj);
2299
2498
  delete obj;
@@ -2336,7 +2535,7 @@ function Server(options) {
2336
2535
  if ( /(\"null\")/i.test(bodyStr) )
2337
2536
  bodyStr = bodyStr.replace(/\"null\"/ig, null);
2338
2537
 
2339
- obj = parseBody(bodyStr);
2538
+ obj = formatDataFromString(bodyStr);
2340
2539
 
2341
2540
  if ( typeof(obj) != 'undefined' && obj.count() == 0 && bodyStr.length > 1 ) {
2342
2541
  try {
@@ -2418,21 +2617,21 @@ function Server(options) {
2418
2617
  })
2419
2618
  }
2420
2619
 
2421
- var getHead = function(response, file) {
2620
+ var getContentTypeByFilename = function(filename) {
2422
2621
  try {
2423
- var s = file.split(/\./);
2622
+ var s = filename.split(/\./);
2424
2623
  var ext = s[s.length-1];
2425
2624
  var type = null;
2426
2625
  var mime = self.conf[self.appName][self.env].server.coreConfiguration.mime;
2427
2626
 
2428
- if( typeof(mime[ext]) != 'undefined' ) {
2627
+ if ( typeof(mime[ext]) != 'undefined' ) {
2429
2628
  type = mime[ext];
2430
2629
  } else {
2431
- console.warn('[ '+file+' ] extension: `'+s[2]+'` not supported by gina: `core/mime.types`. Replacing with `plain/text` ')
2630
+ console.warn('[ '+filename+' ] extension: `'+s[2]+'` not supported by gina: `core/mime.types`. Pathname must be a directory. Replacing with `plain/text` ')
2432
2631
  }
2433
- return type || 'plain/text'
2632
+ return type || 'plain/text'
2434
2633
  } catch (err) {
2435
- console.error('Error while trying to getHead('+ file +') extention. Replacing with `plain/text` '+ err.stack);
2634
+ console.error('Error while trying to getContentTypeByFilename('+ filename +') extention. Replacing with `plain/text` '+ err.stack);
2436
2635
  return 'plain/text'
2437
2636
  }
2438
2637
 
@@ -2531,13 +2730,13 @@ function Server(options) {
2531
2730
  }
2532
2731
 
2533
2732
  expressMiddlewares[nextMiddleware._index](nextMiddleware._request, nextMiddleware._response, function onNextMiddleware(err, request, response) {
2534
- ++nextMiddleware._index;
2535
2733
 
2536
2734
  if (err) {
2537
2735
  throwError(nextMiddleware._response, 500, (err.stack||err.message||err), nextMiddleware._next, nextMiddleware._nextAction);
2538
2736
  return;
2539
2737
  }
2540
2738
 
2739
+ ++nextMiddleware._index;
2541
2740
  if (request)
2542
2741
  nextMiddleware._request = request;
2543
2742
 
@@ -2562,7 +2761,7 @@ function Server(options) {
2562
2761
  });
2563
2762
  };
2564
2763
 
2565
- var checkPreflightRequest = function(request) {
2764
+ var checkPreflightRequest = function(request, response) {
2566
2765
  var config = self.conf[self.appName][self.env];
2567
2766
  // by default, if not set in `${projectPath}/env.json`
2568
2767
  var corsMethod = 'GET, POST, HEAD';
@@ -2606,7 +2805,7 @@ function Server(options) {
2606
2805
  } else {
2607
2806
  request.method = method
2608
2807
  }
2609
- accessControlRequestHeaders = ( typeof(request.headers['access-control-request-headers']) != 'undefined' ) ? request.headers['access-control-request-headers'] : '';
2808
+ accessControlRequestHeaders = ( typeof(request.headers['access-control-request-headers']) != 'undefined' ) ? request.headers['access-control-request-headers'].replace(/\s+/, '').split(/\,/g) : '';
2610
2809
  if ( typeof(request.headers['access-control-request-credentials']) != 'undefined' && typeof(serverResponseHeaders['access-control-allow-credentials']) != 'undefined' ) {
2611
2810
  request.isWithCredentials = true;
2612
2811
  }
@@ -2616,6 +2815,7 @@ function Server(options) {
2616
2815
  request.isXMLRequest = true;
2617
2816
  }
2618
2817
  }
2818
+ response.setHeader('access-control-allow-headers', request.headers['access-control-request-headers']);
2619
2819
  }
2620
2820
  }
2621
2821
 
@@ -2632,9 +2832,9 @@ function Server(options) {
2632
2832
  , wroot = null
2633
2833
  ;
2634
2834
 
2635
- //matched = routingUtils.getRouteByUrl(req.url, bundle, (req.method||req[':method']), req);
2835
+ //matched = routingLib.getRouteByUrl(req.url, bundle, (req.method||req[':method']), req);
2636
2836
 
2637
- req = checkPreflightRequest(req);
2837
+ req = checkPreflightRequest(req, res);
2638
2838
  var params = {}
2639
2839
  , _routing = {}
2640
2840
  , method = ( /http\/2/.test(self.conf[self.appName][self.env].server.protocol) ) ? req.headers[':method'] : req.method
@@ -2657,9 +2857,10 @@ function Server(options) {
2657
2857
  }
2658
2858
  var isMethodAllowed = null, hostname = null;
2659
2859
  out:
2660
- for (var name in routing) {
2661
- if (typeof(routing[name]['param']) == 'undefined')
2860
+ for (let name in routing) {
2861
+ if ( typeof(routing[name]['param']) == 'undefined' ) {
2662
2862
  break;
2863
+ }
2663
2864
 
2664
2865
  // updating hostname
2665
2866
  // if (
@@ -2687,7 +2888,7 @@ function Server(options) {
2687
2888
  method : method,
2688
2889
  requirements : routing[name].requirements,
2689
2890
  namespace : routing[name].namespace || undefined,
2690
- url : unescape(pathname), /// avoid %20
2891
+ url : decodeURI(pathname), /// avoid %20
2691
2892
  rule : routing[name].originalRule || name,
2692
2893
  param : JSON.clone(routing[name].param),
2693
2894
  middleware : JSON.clone(routing[name].middleware),
@@ -2698,7 +2899,7 @@ function Server(options) {
2698
2899
 
2699
2900
  //Parsing for the right url.
2700
2901
  try {
2701
- isRoute = await routingUtils.compareUrls(params, routing[name].url, req, res, next);
2902
+ isRoute = await routingLib.compareUrls(params, routing[name].url, req, res, next);
2702
2903
  } catch (err) {
2703
2904
  var msg = 'Internal server error.\nRule [ '+name+' ] needs your attention.\n';
2704
2905
  // TODO - Refactor `ApiError`to handle the following param
@@ -2818,8 +3019,8 @@ function Server(options) {
2818
3019
  }
2819
3020
 
2820
3021
  if (!res.headersSent) {
2821
- res.headersSent = true;
2822
- local.request = checkPreflightRequest(local.request);
3022
+ // res.headersSent = true;
3023
+ local.request = checkPreflightRequest(local.request, local.response);
2823
3024
  // updated filter on controller.js : 2020/09/25
2824
3025
  //if (isXMLRequest || !withViews || !isUsingTemplate ) {
2825
3026
  if (isXMLRequest || !withViews || !isUsingTemplate || withViews && !isUsingTemplate ) {
@@ -2875,7 +3076,7 @@ function Server(options) {
2875
3076
  //console.error('[ BUNDLE ][ '+self.appName+' ] '+ local.request.method +' [ '+code+' ] '+ local.request.url);
2876
3077
  console.error(local.request.method +' [ '+code+' ] '+ local.request.url);
2877
3078
  // intercept none HTML mime types
2878
- var url = unescape(local.request.url) /// avoid %20
3079
+ var url = decodeURI(local.request.url) /// avoid %20
2879
3080
  , ext = null
2880
3081
  , isHtmlContent = false
2881
3082
  , hasCustomErrorFile = false
@@ -2937,7 +3138,7 @@ function Server(options) {
2937
3138
  }
2938
3139
 
2939
3140
  var eRule = 'custom-error-page@'+ self.appName;
2940
- var routeObj = routingUtils.getRoute(eRule);
3141
+ var routeObj = routingLib.getRoute(eRule);
2941
3142
  routeObj.rule = eRule;
2942
3143
  routeObj.url = url;
2943
3144
  routeObj.param.title = ( typeof(eData.title) != 'undefined' ) ? eData.title : 'Error ' + eData.status;