gina 0.1.6-alpha.16 → 0.1.6-alpha.161

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 (410) hide show
  1. package/LICENSE +1 -1
  2. package/README-4Contributors.md +14 -8
  3. package/README.md +13 -4
  4. package/bin/cli +16 -2
  5. package/bin/gina +29 -1
  6. package/framework/{v0.1.6-alpha.16/lib/inherits → v0.1.6-alpha.161}/LICENSE +1 -1
  7. package/framework/v0.1.6-alpha.161/VERSION +1 -0
  8. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/plugin/README.md +1 -0
  9. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/css/gina.min.css.br +0 -0
  10. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/css/gina.min.css.gz +0 -0
  11. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/css/gina.min.css.map +1 -0
  12. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/plugin/dist/vendor/gina/html/toolbar.html +1 -1
  13. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/html/toolbar.html.br +0 -0
  14. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/html/toolbar.html.gz +0 -0
  15. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/plugin/dist/vendor/gina/js/gina.js +6444 -5613
  16. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/js/gina.min.js +790 -0
  17. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/js/gina.min.js.br +0 -0
  18. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/js/gina.min.js.gz +0 -0
  19. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/js/gina.min.js.map +8 -0
  20. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +9 -0
  21. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.br +0 -0
  22. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.gz +0 -0
  23. package/framework/v0.1.6-alpha.161/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.map +8 -0
  24. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/config.js +149 -57
  25. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/connectors/couchbase/index.js +108 -26
  26. package/framework/{v0.1.6-alpha.16/core/connectors/couchbase/lib/connector.v4.js → v0.1.6-alpha.161/core/connectors/couchbase/lib/connector.v3.js} +170 -69
  27. package/framework/v0.1.6-alpha.161/core/connectors/couchbase/lib/connector.v4.js +470 -0
  28. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/connectors/couchbase/lib/session-store.v4.js +5 -2
  29. package/framework/v0.1.6-alpha.161/core/content.encoding +9 -0
  30. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/controller/controller.js +847 -1274
  31. package/framework/v0.1.6-alpha.161/core/controller/controller.render-json.js +262 -0
  32. package/framework/v0.1.6-alpha.161/core/controller/controller.render-swig.js +1080 -0
  33. package/framework/v0.1.6-alpha.161/core/controller/controller.render-v1.js +911 -0
  34. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/controller/index.js +2 -2
  35. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/.github/workflows/ci.yml +24 -0
  36. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/.github/workflows/lint.yml +23 -0
  37. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/README.md +191 -0
  38. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/bench/bench-multipart-fields-100mb-big.js +149 -0
  39. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/bench/bench-multipart-fields-100mb-small.js +143 -0
  40. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/bench/bench-multipart-files-100mb-big.js +154 -0
  41. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/bench/bench-multipart-files-100mb-small.js +148 -0
  42. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/bench/bench-urlencoded-fields-100pairs-small.js +101 -0
  43. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/bench/bench-urlencoded-fields-900pairs-small-alt.js +84 -0
  44. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/lib/index.js +57 -0
  45. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/lib/types/multipart.js +680 -0
  46. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/lib/types/urlencoded.js +350 -0
  47. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/lib/utils.js +596 -0
  48. package/framework/v0.1.6-alpha.161/core/deps/busboy-1.6.0/package.json +22 -0
  49. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/.travis.yml +4 -0
  50. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/LICENSE +21 -0
  51. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/bool.js +10 -0
  52. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/boolean_double.js +7 -0
  53. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/boolean_single.js +7 -0
  54. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/default_hash.js +8 -0
  55. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/default_singles.js +7 -0
  56. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/divide.js +8 -0
  57. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/line_count.js +20 -0
  58. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/line_count_options.js +29 -0
  59. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/line_count_wrap.js +29 -0
  60. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/nonopt.js +4 -0
  61. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/reflect.js +2 -0
  62. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/short.js +3 -0
  63. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/string.js +11 -0
  64. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/usage-options.js +19 -0
  65. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/example/xup.js +10 -0
  66. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/index.js +343 -0
  67. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/package.json +31 -0
  68. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/package.json.dist +39 -0
  69. package/framework/v0.1.6-alpha.161/core/deps/optimist-0.6.1/readme.markdown +513 -0
  70. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/HISTORY.md +498 -0
  71. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/LICENSE +7 -0
  72. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/README.md +88 -0
  73. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/bin/swig.js +161 -0
  74. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/bin/swig.js.dist +161 -0
  75. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/dist/swig.min.js +7 -0
  76. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/dist/swig.min.js.map +8 -0
  77. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/index.js +1 -0
  78. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/dateformatter.js +198 -0
  79. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/filters.js +630 -0
  80. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/lexer.js +306 -0
  81. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/loaders/filesystem.js +59 -0
  82. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/loaders/index.js +53 -0
  83. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/loaders/memory.js +63 -0
  84. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/parser.js +744 -0
  85. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/swig.js +740 -0
  86. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/autoescape.js +37 -0
  87. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/block.js +25 -0
  88. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/else.js +25 -0
  89. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/elseif.js +28 -0
  90. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/extends.js +19 -0
  91. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/filter.js +68 -0
  92. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/for.js +130 -0
  93. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/if.js +86 -0
  94. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/import.js +91 -0
  95. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/include.js +100 -0
  96. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/index.js +16 -0
  97. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/macro.js +79 -0
  98. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/parent.js +51 -0
  99. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/raw.js +23 -0
  100. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/set.js +109 -0
  101. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/tags/spaceless.js +42 -0
  102. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/lib/utils.js +184 -0
  103. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/package.json +57 -0
  104. package/framework/v0.1.6-alpha.161/core/deps/swig-1.4.2/package.json.dist +61 -0
  105. package/framework/v0.1.6-alpha.161/core/deps/swig-client/swig.js +5031 -0
  106. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/dev/index.js +1 -1
  107. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/dev/lib/factory.js +1 -1
  108. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/gna.js +123 -23
  109. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/index.js +3 -3
  110. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/src/make.js +1 -1
  111. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/mime.types +1 -0
  112. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/model/entity.js +5 -5
  113. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/model/index.js +30 -26
  114. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/model/template/entityFactory.js +1 -1
  115. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/model/template/index.js +1 -1
  116. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/index.js +3 -3
  117. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/file/package.json +2 -2
  118. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/intl/package.json +2 -2
  119. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/storage/package.json +2 -2
  120. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/validator/package.json +2 -2
  121. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/validator/src/form-validator.js +39 -27
  122. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/validator/src/main.js +499 -120
  123. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/router.js +100 -49
  124. package/framework/v0.1.6-alpha.161/core/server.isaac.js +790 -0
  125. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/server.js +437 -160
  126. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/status.codes +1 -11
  127. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle/controllers/setup.js +2 -2
  128. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/command/gina.tpl +1 -1
  129. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/conf/env.json +28 -2
  130. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/conf/settings.json +4 -1
  131. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/conf/templates.json +4 -2
  132. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/console.js +1 -1
  133. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/context.js +30 -13
  134. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/data/package.json +2 -2
  135. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/data/src/main.js +1 -1
  136. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/dateFormat.js +1 -1
  137. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/index.js +1 -1
  138. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/json/package.json +2 -2
  139. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/json/src/main.js +7 -4
  140. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/path.js +32 -16
  141. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/plugins/package.json +2 -2
  142. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/plugins/src/api-error.js +2 -2
  143. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/plugins/src/main.js +1 -1
  144. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/prototypes.js +8 -1
  145. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/task.js +2 -2
  146. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/text.js +1 -1
  147. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/archiver/package.json +2 -2
  148. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/archiver/src/main.js +11 -11
  149. package/framework/v0.1.6-alpha.161/lib/cache/README.md +19 -0
  150. package/framework/v0.1.6-alpha.161/lib/cache/package.json +20 -0
  151. package/framework/v0.1.6-alpha.161/lib/cache/src/main.js +239 -0
  152. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/add.js +2 -1
  153. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/restart.js +2 -2
  154. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/start.js +26 -11
  155. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/get.js +1 -1
  156. package/framework/v0.1.6-alpha.161/lib/cmd/env/help.js +30 -0
  157. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/set.js +21 -0
  158. package/framework/v0.1.6-alpha.161/lib/cmd/framework/arguments.json +7 -0
  159. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/build.js +1 -1
  160. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/dot.js +21 -0
  161. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/init.js +21 -3
  162. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/link-node-modules.js +2 -3
  163. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/link.js +3 -2
  164. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/restart.js +3 -3
  165. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/start.js +1 -1
  166. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/tail.js +29 -12
  167. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/version.js +15 -1
  168. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/helper.js +44 -15
  169. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/index.js +1 -1
  170. package/framework/v0.1.6-alpha.161/lib/cmd/minion/help.txt +18 -0
  171. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/port/reset.js +1 -1
  172. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/add.js +7 -2
  173. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/arguments.json +1 -0
  174. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/build.js +32 -7
  175. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/help.txt +4 -0
  176. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/list.js +1 -1
  177. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/protocol/list.js +71 -50
  178. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/collection/package.json +2 -2
  179. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/collection/src/main.js +62 -23
  180. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/config.js +1 -1
  181. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cron/package.json +2 -2
  182. package/framework/v0.1.6-alpha.161/lib/domain/dist/2025-03-14_13-41-20_UTC.dat +15754 -0
  183. package/framework/v0.1.6-alpha.161/lib/domain/dist/public_suffix_list.dat +15754 -0
  184. package/framework/v0.1.6-alpha.161/lib/domain/dist/public_suffix_list.dat.br +0 -0
  185. package/framework/v0.1.6-alpha.161/lib/domain/dist/public_suffix_list.dat.gz +0 -0
  186. package/framework/v0.1.6-alpha.161/lib/domain/exemples/backend.js +12 -0
  187. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/domain/package.json +2 -2
  188. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/domain/src/main.js +75 -13
  189. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/generator/index.js +1 -1
  190. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/index.js +3 -2
  191. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161/lib/inherits}/LICENSE +1 -1
  192. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/inherits/package.json +2 -2
  193. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/inherits/src/main.js +1 -1
  194. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/package.json +2 -2
  195. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/src/containers/file/index.js +2 -0
  196. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/src/containers/mq/listener.js +10 -2
  197. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/src/helper.js +1 -1
  198. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/src/main.js +1 -1
  199. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/math/index.js +1 -1
  200. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/merge/package.json +2 -2
  201. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/model.js +3 -3
  202. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/proc.js +10 -2
  203. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/routing/package.json +2 -2
  204. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/routing/src/main.js +204 -35
  205. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/session-store.js +3 -3
  206. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/shell.js +7 -6
  207. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/swig-filters/package.json +2 -2
  208. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/swig-filters/src/main.js +98 -92
  209. package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/validator.js +2 -2
  210. package/framework/v0.1.6-alpha.161/package.json +11 -0
  211. package/package.json +3 -3
  212. package/resources/package.json.template +1 -1
  213. package/script/post_install.js +4 -4
  214. package/script/pre_install.js +3 -3
  215. package/utils/helper.js +38 -14
  216. package/framework/v0.1.6-alpha.16/VERSION +0 -1
  217. package/framework/v0.1.6-alpha.16/core/asset/plugin/dist/vendor/gina/css/gina.min.css.map +0 -1
  218. package/framework/v0.1.6-alpha.16/core/asset/plugin/dist/vendor/gina/js/gina.min.js +0 -766
  219. package/framework/v0.1.6-alpha.16/core/asset/plugin/dist/vendor/gina/js/gina.min.js.map +0 -8
  220. package/framework/v0.1.6-alpha.16/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +0 -7
  221. package/framework/v0.1.6-alpha.16/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.map +0 -8
  222. package/framework/v0.1.6-alpha.16/core/connectors/couchbase/lib/connector.v3.js +0 -432
  223. package/framework/v0.1.6-alpha.16/core/deps/busboy/.travis.yml +0 -17
  224. package/framework/v0.1.6-alpha.16/core/deps/busboy/README.md +0 -225
  225. package/framework/v0.1.6-alpha.16/core/deps/busboy/deps/encoding/encoding-indexes.js +0 -73
  226. package/framework/v0.1.6-alpha.16/core/deps/busboy/deps/encoding/encoding.js +0 -2391
  227. package/framework/v0.1.6-alpha.16/core/deps/busboy/lib/main.js +0 -89
  228. package/framework/v0.1.6-alpha.16/core/deps/busboy/lib/types/multipart.js +0 -328
  229. package/framework/v0.1.6-alpha.16/core/deps/busboy/lib/types/urlencoded.js +0 -214
  230. package/framework/v0.1.6-alpha.16/core/deps/busboy/lib/utils.js +0 -191
  231. package/framework/v0.1.6-alpha.16/core/deps/busboy/package.json +0 -69
  232. package/framework/v0.1.6-alpha.16/core/server.isaac.js +0 -480
  233. package/framework/v0.1.6-alpha.16/lib/domain/dist/public_suffix_list.dat +0 -14186
  234. package/framework/v0.1.6-alpha.16/package.json +0 -14
  235. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/AUTHORS +0 -0
  236. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/html/nolayout.html +0 -0
  237. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/html/static.html +0 -0
  238. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/img/android-chrome-192x192.png +0 -0
  239. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/img/android-chrome-512x512.png +0 -0
  240. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/img/apple-touch-icon.png +0 -0
  241. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/img/favicon-16x16.png +0 -0
  242. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/img/favicon-32x32.png +0 -0
  243. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/img/favicon.ico +0 -0
  244. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/plugin/dist/vendor/gina/css/gina.min.css +0 -0
  245. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/asset/plugin/uuid.json +0 -0
  246. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/connectors/couchbase/lib/connector.js +0 -0
  247. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/connectors/couchbase/lib/connector.v2.js +0 -0
  248. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/connectors/couchbase/lib/n1ql.js +0 -0
  249. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/connectors/couchbase/lib/session-store.js +0 -0
  250. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/connectors/couchbase/lib/session-store.v2.js +0 -0
  251. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/connectors/couchbase/lib/session-store.v3.js +0 -0
  252. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/controller/controller.framework.js +0 -0
  253. /package/framework/{v0.1.6-alpha.16/core/deps/busboy → v0.1.6-alpha.161/core/deps/busboy-1.6.0}/LICENSE +0 -0
  254. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/deps/swig-client/swig-2.0.0.min.js +0 -0
  255. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/dev/lib/class.js +0 -0
  256. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/dev/lib/tools.js +0 -0
  257. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/README.md +0 -0
  258. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/currency.json +0 -0
  259. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/dist/language/en.json +0 -0
  260. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/dist/language/fr.json +0 -0
  261. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/dist/region/en.json +0 -0
  262. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/dist/region/fr.json +0 -0
  263. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/src/resources/currency.csv +0 -0
  264. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/src/resources/region.csv +0 -0
  265. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/locales/src/resources/region.mapping.json +0 -0
  266. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/README.md +0 -0
  267. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/file/README.md +0 -0
  268. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/file/build.json +0 -0
  269. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/intl/README.md +0 -0
  270. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/intl/build.json +0 -0
  271. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/intl/src/main.js +0 -0
  272. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/storage/README.md +0 -0
  273. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/storage/build.json +0 -0
  274. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/storage/src/main.js +0 -0
  275. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/validator/README.md +0 -0
  276. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/plugins/lib/validator/build.json +0 -0
  277. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/server.express.js +0 -0
  278. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/_gitignore +0 -0
  279. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle/config/app.json +0 -0
  280. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle/config/routing.json +0 -0
  281. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle/config/settings.json +0 -0
  282. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle/config/settings.server.json +0 -0
  283. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle/config/templates.json +0 -0
  284. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle/controllers/controller.content.js +0 -0
  285. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
  286. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle/index.js +0 -0
  287. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
  288. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_public/css/default.css +0 -0
  289. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
  290. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
  291. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
  292. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_public/readme.md +0 -0
  293. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
  294. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_templates/html/content/homepage.html +0 -0
  295. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +0 -0
  296. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +0 -0
  297. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/boilerplate/bundle_templates/html/layouts/main.html +0 -0
  298. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/command/gina.bat.tpl +0 -0
  299. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/conf/manifest.json +0 -0
  300. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/conf/package.json +0 -0
  301. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/conf/statics.json +0 -0
  302. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/error/client/json/401.json +0 -0
  303. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/error/client/json/403.json +0 -0
  304. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/error/client/json/404.json +0 -0
  305. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/error/server/html/50x.html +0 -0
  306. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/error/server/json/500.json +0 -0
  307. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/error/server/json/503.json +0 -0
  308. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/core/template/extensions/logger/config.json +0 -0
  309. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/data/LICENSE +0 -0
  310. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/data/README.md +0 -0
  311. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/json/LICENSE +0 -0
  312. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/json/README.md +0 -0
  313. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/helpers/plugins/README.md +0 -0
  314. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/archiver/README.md +0 -0
  315. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/archiver/build.json +0 -0
  316. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/archiver/src/dep/jszip.min.js +0 -0
  317. /package/framework/{v0.1.6-alpha.16/lib/collection → v0.1.6-alpha.161/lib/cache}/build.json +0 -0
  318. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/aliases.json +0 -0
  319. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/arguments.json +0 -0
  320. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/copy.js +0 -0
  321. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/cp.js +0 -0
  322. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/help.js +0 -0
  323. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/help.txt +0 -0
  324. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/list.js +0 -0
  325. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/remove.js +0 -0
  326. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/rename.js +0 -0
  327. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/rm.js +0 -0
  328. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/status.js +0 -0
  329. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/bundle/stop.js +0 -0
  330. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/add.js +0 -0
  331. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/help.txt +0 -0
  332. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/link-dev.js +0 -0
  333. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/list.js +0 -0
  334. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/remove.js +0 -0
  335. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/rm.js +0 -0
  336. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/unset.js +0 -0
  337. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/env/use.js +0 -0
  338. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/get.js +0 -0
  339. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/help.js +0 -0
  340. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/help.txt +0 -0
  341. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/msg.json +0 -0
  342. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/open.js +0 -0
  343. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/set.js +0 -0
  344. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/status.js +0 -0
  345. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/stop.js +0 -0
  346. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/framework/update.js +0 -0
  347. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/gina-dev.1.md +0 -0
  348. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/gina-framework.1.md +0 -0
  349. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/gina.1.md +0 -0
  350. /package/framework/{v0.1.6-alpha.16/lib/cmd/env → v0.1.6-alpha.161/lib/cmd/minion}/help.js +0 -0
  351. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/msg.json +0 -0
  352. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/port/help.js +0 -0
  353. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/port/help.txt +0 -0
  354. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/port/inc/scan.js +0 -0
  355. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/port/list.js +0 -0
  356. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/port/set.js +0 -0
  357. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/help.js +0 -0
  358. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/import.js +0 -0
  359. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/move.js +0 -0
  360. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/remove.js +0 -0
  361. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/rename.js +0 -0
  362. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/restart.js +0 -0
  363. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/rm.js +0 -0
  364. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/start.js +0 -0
  365. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/status.js +0 -0
  366. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/project/stop.js +0 -0
  367. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/protocol/help.js +0 -0
  368. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/protocol/help.txt +0 -0
  369. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/protocol/set.js +0 -0
  370. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/scope/add.js +0 -0
  371. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/scope/help.js +0 -0
  372. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/scope/help.txt +0 -0
  373. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/scope/link-local.js +0 -0
  374. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/scope/link-production.js +0 -0
  375. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/scope/list.js +0 -0
  376. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/scope/remove.js +0 -0
  377. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/scope/rm.js +0 -0
  378. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/scope/use.js +0 -0
  379. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cmd/view/add.js +0 -0
  380. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/collection/README.md +0 -0
  381. /package/framework/{v0.1.6-alpha.16/lib/routing → v0.1.6-alpha.161/lib/collection}/build.json +0 -0
  382. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cron/README.md +0 -0
  383. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/cron/src/main.js +0 -0
  384. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/domain/LICENSE +0 -0
  385. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/domain/README.md +0 -0
  386. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/domain/exemples/frontend.html +0 -0
  387. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/inherits/README.md +0 -0
  388. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/inherits/example/inheriting_eventemitter.js +0 -0
  389. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/inherits/example/protected_inheritance.js +0 -0
  390. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/inherits/example/simple_inheritance.js +0 -0
  391. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/inherits/example/super_attribute_overridden_by_child_on_init.js +0 -0
  392. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/README.md +0 -0
  393. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/src/containers/default/index.js +0 -0
  394. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/src/containers/file/lib/logrotator/README.md +0 -0
  395. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/src/containers/file/lib/logrotator/index.js +0 -0
  396. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/src/containers/mq/index.js +0 -0
  397. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/logger/src/containers/mq/speaker.js +0 -0
  398. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/merge/README.md +0 -0
  399. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/merge/example/merge.js +0 -0
  400. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/merge/example/merge_2_literal objects.js +0 -0
  401. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/merge/example/merge_and_preserve_first.js +0 -0
  402. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/merge/src/main.js +0 -0
  403. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/routing/README.md +0 -0
  404. /package/framework/{v0.1.6-alpha.16/lib/domain/exemples/backend.js → v0.1.6-alpha.161/lib/routing/build.json} +0 -0
  405. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/swig-filters/README.md +0 -0
  406. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/url/README.md +0 -0
  407. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/url/index.js +0 -0
  408. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/url/mocks.json +0 -0
  409. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/url/routing.json +0 -0
  410. /package/framework/{v0.1.6-alpha.16 → v0.1.6-alpha.161}/lib/url/test.js +0 -0
@@ -0,0 +1,1080 @@
1
+ const fs = require('fs');
2
+
3
+ const lib = require('./../../lib') || require.cache[require.resolve('./../../lib')];
4
+ const Collection = lib.Collection;
5
+ const cache = new lib.Cache();
6
+ var statusCodes = requireJSON( _( getPath('gina').core + '/status.codes') );
7
+
8
+ // Inherited from controller
9
+ var self = null
10
+ , local = null
11
+ , getData = null
12
+ , hasViews = null
13
+ , setResources = null
14
+ // Default filters
15
+ , SwigFilters = null
16
+ , headersSent = null
17
+ , cachePath = null
18
+ ;
19
+
20
+ function writeCache(bundle, opt, htmlContent) {
21
+ if (
22
+ typeof(local.req.routing.cache) == 'undefined'
23
+ ||
24
+ ! local.req.routing.cache
25
+ ||
26
+ ! /^true$/i.test(self.serverInstance._cacheIsEnabled)
27
+ ) {
28
+ return;
29
+ }
30
+ var cacheKey = "static:"+ local.req.originalUrl;
31
+ var responseHeaders = local.res.getHeaders() || {};
32
+ if ( !cache.has(cacheKey) ) {
33
+ // Caching kinds are: `memory` & `fs`
34
+ var cachingOption = ( typeof(local.req.routing.cache) == 'string' ) ? { type: local.req.routing.cache } : JSON.clone(local.req.routing.cache);
35
+ if ( typeof(cachingOption.ttl) == 'undefined' ) {
36
+ cachingOption.ttl = opt.ttl
37
+ }
38
+ var cacheObject = {
39
+ responseHeaders : responseHeaders
40
+ };
41
+ if ( cachingOption.ttl > 0) {
42
+ cacheObject.ttl = cachingOption.ttl;
43
+ }
44
+ // Caching to `memory`
45
+ // Use this method carefully since it can lead to memory overflow:
46
+ // - only for most visited static content
47
+ // - avoid content linked to sessions
48
+ // - default ttl is 3600 sec
49
+ if ( /^memory$/i.test(cachingOption.type) ) {
50
+ cacheObject.fromMemory = true;
51
+ // content is mandatory here
52
+ cacheObject.content = htmlContent;
53
+
54
+ cache.set(cacheKey, cacheObject);
55
+ }
56
+
57
+ // Caching to `fs` (file system)
58
+ // Use this method for most of your needs:
59
+ // - prioritize content linked to sessions
60
+ // - default ttl is 3600 sec
61
+ if ( /^fs$/i.test(cachingOption.type) ) {
62
+ var url = local.req.originalUrl;
63
+ if ( /\/$/.test(url) ) {
64
+ url += 'index'
65
+ }
66
+ var htmlFilename = _(opt.path +'/'+ bundle +'/html'+ url + '.html', true);
67
+ var htmlDir = htmlFilename.split(/\//g).slice(0, -1).join('/');
68
+ var htmlDirObj = new _(htmlDir);
69
+ if ( !htmlDirObj.existsSync() ) {
70
+ htmlDirObj.mkdirSync()
71
+ }
72
+ htmlDirObj = null;
73
+
74
+ // console.debug("Writting cache to: ", htmlFilename);
75
+ var fd = fs.openSync(htmlFilename, 'w'); // Open file for writing
76
+ var buffer = Buffer.from( htmlContent );
77
+ fs.writeSync(fd, buffer, 0, buffer.length, 0); // Write the buffer
78
+ buffer = null;
79
+ fs.closeSync(fd); // Close the file descriptor
80
+ fd = null;
81
+
82
+ // filename is mandatory here
83
+ cacheObject.filename = htmlFilename;
84
+
85
+ cache.set(cacheKey, cacheObject);
86
+ }
87
+
88
+
89
+ }
90
+ }
91
+ /**
92
+ * Render HTML templates : Swig is the default template engine
93
+ *
94
+ * Extend default filters
95
+ * - length
96
+ *
97
+ * Available filters:
98
+ * - getWebroot()
99
+ * - getUrl()
100
+ *
101
+ * N.B.: Filters can be extended through your `<project>/src/<bundle>/templates/swig/filters.js`
102
+ *
103
+ *
104
+ * @param {object} userData
105
+ * @param {boolean} [displayToolbar]
106
+ * @param {object} [errOptions]
107
+ *
108
+ * @returns {void}
109
+ * */
110
+ async function render(userData, displayToolbar, errOptions) {
111
+
112
+ // Using server cache to cache compiledTemplates
113
+ cache.from(self.serverInstance._cached);
114
+
115
+ cachePath = self.serverInstance._cachePath;
116
+
117
+ var err = null;
118
+ var isRenderingCustomError = (
119
+ typeof(userData.isRenderingCustomError) != 'undefined'
120
+ && /^true$/i.test(userData.isRenderingCustomError)
121
+ ) ? true : false;
122
+ if (isRenderingCustomError)
123
+ delete userData.isRenderingCustomError;
124
+
125
+ var localOptions = (errOptions) ? errOptions : local.options;
126
+ localOptions.renderingStack.push( self.name );
127
+ // preventing multiple call of self.render() when controller is rendering from another required controller
128
+ if ( localOptions.renderingStack.length > 1 && !isRenderingCustomError ) {
129
+ return false;
130
+ }
131
+
132
+
133
+ var data = null
134
+ , layout = null
135
+ , newLayoutFilename = null
136
+ , fd = null
137
+ , buffer = null
138
+ , compiledTemplate = null
139
+ , template = null
140
+ , file = null
141
+ , path = null
142
+ , htmlContent = null
143
+ , cacheKey = null
144
+ , cacheObject = null
145
+ , plugin = null
146
+ // By default
147
+ , isWithoutLayout = (localOptions.isWithoutLayout) ? true : false
148
+ ;
149
+
150
+ try {
151
+ data = getData();
152
+ // Display session
153
+ if (
154
+ typeof(local.req.session) != 'undefined'
155
+ ) {
156
+ if ( typeof(data.page.data) == 'undefined' ) {
157
+ data.page.data = {};
158
+ }
159
+
160
+ if ( typeof(local.req.session.cookie._expires) != 'undefined' ) {
161
+ var dateEnd = local.req.session.cookie._expires;
162
+ var dateStart = ( typeof(local.req.session.lastModified) != 'undefined')
163
+ ? new Date(local.req.session.lastModified)
164
+ : new Date()
165
+ ;
166
+ var elapsed = dateEnd - dateStart;
167
+ // var expiresAt =
168
+ if ( typeof(data.page.data.session) == 'undefined' ) {
169
+ data.page.data.session = {
170
+ id : local.req.session.id,
171
+ lastModified: local.req.session.lastModified
172
+ };
173
+ }
174
+ // In milliseconds
175
+ data.page.data.session.createdAt = local.req.session.createdAt;
176
+ data.page.data.session.expiresAt = dateEnd.format('isoDateTime');
177
+ data.page.data.session.timeout = elapsed;
178
+
179
+ dateEnd = null;
180
+ dateStart = null;
181
+ elapsed = null;
182
+ }
183
+ }
184
+
185
+ // in case `local.req.routing.param.file` has been changed on the fly
186
+ if (
187
+ local.req.routing.param.file
188
+ && local.req.routing.param.file != data.page.view.file
189
+ ) {
190
+ data.page.view.file = local.req.routing.param.file;
191
+ }
192
+ if (
193
+ local.req.routing.param.ext
194
+ && local.req.routing.param.ext != data.page.view.ext
195
+ ) {
196
+ data.page.view.ext = local.req.routing.param.ext;
197
+ }
198
+ file = (isRenderingCustomError) ? localOptions.file : data.page.view.file;
199
+ // making path thru [namespace &] file
200
+ if ( typeof(localOptions.namespace) != 'undefined' && localOptions.namespace ) {
201
+ // excepted for custom paths
202
+ var fileNamingConvention = file.replace(localOptions.namespace+'-', '');
203
+ if ( !/^(\.|\/|\\)/.test(file) && file != fileNamingConvention ) {
204
+ var _ext = data.page.view.ext;
205
+
206
+ console.warn('file `'+ file +'` used in routing `'+ localOptions.rule +'` does not respect gina naming convention ! You should rename the file `'+ file + _ext +'` to `'+ ''+ fileNamingConvention + _ext +'`');
207
+ console.warn('The reason you are getting this message is because your filename begeins with `<namespace>-`\n If you don\‘t want to rename, use template path like ./../'+ localOptions.namespace +'/'+file);
208
+ file = ''+ file.replace(localOptions.namespace+'-', '');
209
+ }
210
+ fileNamingConvention = null;
211
+ _ext = null;
212
+
213
+
214
+ // means that rule name === namespace -> pointing to root namespace dir
215
+ if (!file || file === localOptions.namespace) {
216
+ file = 'index'
217
+ }
218
+ path = (isRenderingCustomError) ? _(file) : _(localOptions.template.html +'/'+ localOptions.namespace + '/' + file)
219
+ } else {
220
+ if ( localOptions.path && !/(\?|\#)/.test(localOptions.path) ) {
221
+ path = _(localOptions.path);
222
+ var re = new RegExp( data.page.view.ext+'$');
223
+ if ( data.page.view.ext && re.test(data.page.view.file) ) {
224
+ data.page.view.path = path.replace('/'+ data.page.view.file, '');
225
+
226
+ path = path.replace(re, '');
227
+ data.page.view.file = data.page.view.file.replace(re, '');
228
+
229
+ } else {
230
+ data.page.view.path = path.replace('/'+ data.page.view.file, '');
231
+ }
232
+ re = null;
233
+ } else {
234
+ path = (!isRenderingCustomError && !/^(\.|\/|\\)/.test(file))
235
+ ? _(localOptions.template.html +'/'+ file)
236
+ : file
237
+ }
238
+ }
239
+
240
+ if (data.page.view.ext && !new RegExp(data.page.view.ext+ '$').test(file) ) {
241
+ path += data.page.view.ext
242
+ }
243
+
244
+ data.page.view.path = path;
245
+ } catch (dataErr) {
246
+ return self.throwError(dataErr);
247
+ }
248
+
249
+ // isWithoutLayout from content
250
+ var pageContentObj = new _(data.page.view.path);
251
+ var _templateContent = null;
252
+ try {
253
+ _templateContent = fs.readFileSync(path).toString()
254
+ } catch (pathException) {
255
+ console.warn("Path exception: ", pathException);
256
+ }
257
+ var hasLayoutInPath = /\{\%(\s+extends|extends)/.test(_templateContent) || false;
258
+ var layoutPath = null;
259
+ var subFolder = path.split(/\//g).slice(0, -1).join('/').replace(localOptions.template.html, '') || '';
260
+ var hasSubFolder = (subFolder && subFolder != '') ? true : false;
261
+
262
+ if (
263
+ !isWithoutLayout
264
+ && !isRenderingCustomError
265
+ && pageContentObj.existsSync()
266
+ && !hasLayoutInPath
267
+ ) {
268
+ isWithoutLayout = true;
269
+ }
270
+ pageContentObj = null;
271
+
272
+ cacheKey = 'swig:' + localOptions.bundle + subFolder +'/'+ data.page.view.file;
273
+ // Retrieve layoutPath from content
274
+ if (
275
+ hasLayoutInPath
276
+ && _templateContent
277
+ && !cache.has(cacheKey)
278
+ ) {
279
+
280
+ // subFolder = path.split(/\//g).slice(0, -1).join('/').replace(localOptions.template.html, '');
281
+ // hasSubFolder = (subFolder) ? true : false;
282
+ var extendFound = _templateContent.match(/\{\%(\s+extends|extends)(.*)\%}/);
283
+ if (extendFound && Array.isArray(extendFound)) {
284
+ try {
285
+ // localOptions.template.templates +'/'+
286
+ layoutPath = extendFound[0].match(/(\"|\')(.*)(\"|\')/)[0].replace(/(\"|\')/g, '');
287
+
288
+ // adding layout
289
+ var newLayoutPath = 'swig' + subFolder +'/'+ layoutPath;
290
+ newLayoutFilename = _(cachePath +'/'+ localOptions.bundle +'/'+ newLayoutPath, true);
291
+
292
+ // For dev/cacheless envs
293
+ if (
294
+ !/^true$/i.test(self.serverInstance._cacheIsEnabled)
295
+ && fs.existsSync( newLayoutFilename )
296
+ ) {
297
+ fs.rmSync( newLayoutFilename )
298
+ }
299
+
300
+ if ( !fs.existsSync( newLayoutFilename ) ) {
301
+ var newLayoutDir = newLayoutFilename.split(/\//g).slice(0, -1).join('/');
302
+ var newLayoutDirObj = new _(newLayoutDir);
303
+ if ( !newLayoutDirObj.existsSync() ) {
304
+ newLayoutDirObj.mkdirSync()
305
+ }
306
+ newLayoutDirObj = null;
307
+ fd = fs.openSync(newLayoutFilename, 'w'); // Open file for writing
308
+ buffer = Buffer.from( fs.readFileSync(localOptions.template.html + '/'+ layoutPath) );
309
+ fs.writeSync(fd, buffer, 0, buffer.length, 0); // Write the buffer
310
+ buffer = null;
311
+ fs.closeSync(fd); // Close the file descriptor
312
+ fd = null;
313
+ }
314
+
315
+ // updating extends
316
+ _templateContent = _templateContent.replace(layoutPath, _(cachePath +'/'+ localOptions.bundle +'/'+ newLayoutPath, true) );
317
+
318
+ // override layout path
319
+ layoutPath = newLayoutPath;
320
+
321
+ data.page.view.layout = layoutPath;
322
+ layoutPath = cachePath +'/'+ localOptions.bundle +'/'+ layoutPath;
323
+
324
+ localOptions.template.layout = layoutPath;
325
+
326
+ } catch (extendErr) {
327
+ // nothing to do
328
+ }
329
+ }
330
+ extendFound = null;
331
+ }
332
+
333
+ localOptions.debugMode = ( typeof(displayToolbar) == 'undefined' ) ? undefined : ( (/true/i.test(displayToolbar)) ? true : false ); // only active for dev env
334
+
335
+ // specific override
336
+ if (
337
+ self.isCacheless()
338
+ && typeof(local.req[ local.req.method.toLowerCase() ]) != 'undefined'
339
+ && typeof(local.req[ local.req.method.toLowerCase() ].debug) != 'undefined'
340
+ ) {
341
+ if ( !/^(true|false)$/i.test(local.req[ local.req.method.toLowerCase() ].debug) ) {
342
+ console.warn('Detected wrong value for `debug`: '+ local.req[ local.req.method.toLowerCase() ].debug);
343
+ console.warn('Switching `debug` to `true` as `cacheless` mode is enabled');
344
+ local.req[ local.req.method.toLowerCase() ].debug = true;
345
+ }
346
+ localOptions.debugMode = ( /^true$/i.test(local.req[ local.req.method.toLowerCase() ].debug) ) ? true : false;
347
+ } else if (
348
+ self.isCacheless()
349
+ && hasViews()
350
+ && !isWithoutLayout
351
+ && localOptions.debugMode == undefined
352
+ ) {
353
+ localOptions.debugMode = true;
354
+ } else if ( localOptions.debugMode == undefined ) {
355
+ localOptions.debugMode = self.isCacheless()
356
+ }
357
+
358
+ try {
359
+
360
+ if (!userData) {
361
+ userData = { page: { view: {}}}
362
+ } else if ( userData && !userData['page']) {
363
+
364
+ if ( typeof(data['page']['data']) == 'undefined' )
365
+ data['page']['data'] = userData;
366
+ else
367
+ data['page']['data'] = (isRenderingCustomError) ? userData : merge( userData, data['page']['data'] );
368
+ } else {
369
+ data = (isRenderingCustomError) ? userData : merge(userData, data)
370
+ }
371
+
372
+ template = localOptions.rule.replace('\@'+ localOptions.bundle, '');
373
+ var localTemplateConf = localOptions.template;
374
+ if ( isWithoutLayout ) {
375
+ localTemplateConf = JSON.clone(localOptions.template);
376
+ localTemplateConf.javascripts = new Collection(localTemplateConf.javascripts).find({ isCommon: false}, { isCommon: true, name: 'gina' });
377
+ localTemplateConf.stylesheets = new Collection(localTemplateConf.stylesheets).find({ isCommon: false}, { isCommon: true, name: 'gina' });
378
+ }
379
+ setResources(localTemplateConf);
380
+
381
+ // Allowing file & ext override
382
+ if (
383
+ typeof(local.req.routing.param.file) != 'undefined'
384
+ && data.page.view.file !== local.req.routing.param.file
385
+ ) {
386
+ data.page.view.file = localOptions.file = local.req.routing.param.file
387
+ }
388
+ if (
389
+ typeof(local.req.routing.param.ext) != 'undefined'
390
+ && data.page.view.ext !== local.req.routing.param.ext
391
+ ) {
392
+ data.page.view.ext = localOptions.template.ext = local.req.routing.param.ext
393
+ }
394
+
395
+
396
+ // pre-compiling variables
397
+ data = merge(data, getData()); // needed !!
398
+
399
+ if (typeof(data.page.data) == 'undefined' ) {
400
+ data.page.data = {}
401
+ }
402
+
403
+
404
+ if (
405
+ !localOptions.isRenderingCustomError
406
+ && typeof(data.page.data.status) != 'undefined'
407
+ && !/^2/.test(data.page.data.status)
408
+ && typeof(data.page.data.error) != 'undefined'
409
+ ) {
410
+
411
+ var errorObject = {
412
+ status : data.page.data.status,
413
+ error : statusCodes[data.page.data.status] || msg.error || msg,
414
+ message : data.page.data.message || data.page.data.error,
415
+ stack : data.page.data.stack
416
+ };
417
+ if ( typeof(data.page.data.session) != 'undefined' ) {
418
+ errorObject.session = data.page.data.session;
419
+ }
420
+
421
+ return self.throwError(errorObject);
422
+ }
423
+
424
+
425
+ // data.page.view.path = path;
426
+
427
+ var dic = {}, msg = '';
428
+ for (let d in data.page) {
429
+ dic['page.'+d] = data.page[d]
430
+ }
431
+
432
+
433
+
434
+ // please, do not start with a slashe when including...
435
+ // ex.:
436
+ // /inc/_partial.html (BAD)
437
+ // inc/_partial.html (GOOD)
438
+ // ./namespace/page.html (GOOD)
439
+
440
+ if ( !fs.existsSync(path) ) {
441
+ msg = 'could not open "'+ path +'"' +
442
+ '\n1) The requested file does not exists in your templates/html (check your template directory). Can you find: '+path +
443
+ '\n2) Check the following rule in your `'+localOptions.conf.bundlePath+'/config/routing.json` and look around `param` to make sure that nothing is wrong with your file declaration: '+
444
+ '\n' + localOptions.rule +':'+ JSON.stringify(localOptions.conf.content.routing[localOptions.rule], null, 4) +
445
+ '\n3) At this point, if you still have problems trying to run this portion of code, you can contact us telling us how to reproduce the bug.'
446
+ //'\n\r[ stack trace ] '
447
+ ;
448
+ err = new ApiError(msg, 500);
449
+ console.error(err.stack);
450
+ self.throwError(err);
451
+ return;
452
+ }
453
+
454
+ var localRequestPort = local.req.headers.port || local.req.headers[':port'];
455
+ var isProxyHost = (
456
+ typeof(local.req.headers.host) != 'undefined'
457
+ && typeof(localRequestPort) != 'undefined'
458
+ && /^(80|443)$/.test(localRequestPort)
459
+ && localOptions.conf.server.scheme +'://'+ local.req.headers.host+':'+ localRequestPort != localOptions.conf.hostname.replace(/\:\d+$/, '') +':'+ localOptions.conf.server.port
460
+ ||
461
+ typeof(local.req.headers[':authority']) != 'undefined'
462
+ && localOptions.conf.server.scheme +'://'+ local.req.headers[':authority'] != localOptions.conf.hostname
463
+ ||
464
+ typeof(local.req.headers.host) != 'undefined'
465
+ && typeof(localRequestPort) != 'undefined'
466
+ && /^(80|443)$/.test(localRequestPort)
467
+ && local.req.headers.host == localOptions.conf.host
468
+ ||
469
+ typeof(local.req.headers['x-nginx-proxy']) != 'undefined'
470
+ && /^true$/i.test(local.req.headers['x-nginx-proxy'])
471
+ ||
472
+ typeof(process.gina.PROXY_HOSTNAME) != 'undefined'
473
+ ) ? true : false;
474
+
475
+
476
+ // Setup swig default filters
477
+ var filters = SwigFilters({
478
+ options : JSON.clone(localOptions),
479
+ isProxyHost : isProxyHost,
480
+ throwError : self.throwError,
481
+ req : local.req,
482
+ res : local.res
483
+ });
484
+ try {
485
+
486
+ // To extends default filters with user defined filters, go to controllers/setup.js
487
+
488
+ // Allows you to get a bundle web root
489
+ // e.g.: swig.setFilter('getWebroot', filters.getWebroot);
490
+ // e.g.: swig.setFilter('nl2br', filters.nl2br);
491
+ for (let filter in filters) {
492
+ if ( typeof(filters[filter]) == 'function' && !/^getConfig$/.test(filter) ) {
493
+ swig.setFilter(filter, filters[filter]);
494
+ }
495
+ }
496
+ } catch (err) {
497
+ self.throwError(local.res, 500, new Error('[SwigFilters] template filters setup exception encoutered: [ '+path+' ]\n'+(err.stack||err.message)));
498
+ return;
499
+ }
500
+
501
+
502
+ var assets = null
503
+ , mapping = null
504
+ , XHRData = null
505
+ , XHRView = null
506
+ , isDeferModeEnabled = null
507
+ , hasExternalsPlugins = null
508
+ , viewInfos = null
509
+ , filename = null
510
+ , isWithSwigLayout = null
511
+ , isUsingGinaLayout = (!isWithoutLayout && typeof(localOptions.template.layout) != 'undefined' && fs.existsSync(localOptions.template.layout)) ? true : false
512
+ ;
513
+
514
+ if ( isWithoutLayout || isUsingGinaLayout ) {
515
+ layoutPath = (isWithoutLayout) ? localOptions.template.noLayout : localOptions.template.layout;
516
+ // user layout override
517
+ if ( isUsingGinaLayout && !isWithoutLayout ) {
518
+ layoutPath = localOptions.template.layout;
519
+ }
520
+ if (isWithoutLayout) {
521
+ data.page.view.layout = layoutPath;
522
+ }
523
+ }
524
+ // without layout case
525
+ else if (!hasLayoutInPath) {
526
+
527
+ // by default
528
+ layoutPath = localOptions.template.layout;
529
+ if ( !/^\//.test(layoutPath)) {
530
+ layoutPath = localOptions.template.templates +'/'+ layoutPath;
531
+ }
532
+ // default layout
533
+ if (
534
+ !isWithoutLayout && !fs.existsSync(layoutPath) && layoutPath == localOptions.template.templates +'/index.html'
535
+ ) {
536
+ console.warn('Layout '+ localOptions.template.layout +' not found, replacing with `nolayout`: '+ localOptions.template.noLayout);
537
+ layoutPath = localOptions.template.noLayout
538
+ isWithoutLayout = true;
539
+ data.page.view.layout = layoutPath;
540
+ }
541
+ // user defined layout
542
+ else if ( !isWithoutLayout && !fs.existsSync(layoutPath) ) {
543
+ isWithSwigLayout = true;
544
+ layoutPath = localOptions.template.noLayout;
545
+ data.page.view.layout = layoutPath;
546
+ }
547
+ // layout defiendd but not found
548
+ else if (!fs.existsSync(layoutPath) ) {
549
+ err = new ApiError(localOptions.bundle +' SuperController exception while trying to load your layout `'+ layoutPath +'`.\nIt seems like you have defined a layout, but gina could not locate the file.\nFor more informations, check your `config/templates.json` declaration around `'+ localOptions.rule.replace(/\@(.*)/g, '') +'`', 500);
550
+ self.throwError(err);
551
+ return;
552
+ }
553
+ }
554
+
555
+
556
+ // errors first
557
+ if (!headersSent) {
558
+
559
+ //catching errors
560
+ local.res.statusCode = ( typeof(localOptions.conf.server.coreConfiguration.statusCodes[data.page.data.status]) != 'undefined' ) ? data.page.data.status : 200; // by default
561
+
562
+ // HTTP/2 (RFC7540 8.1.2.4):
563
+ // This standard for HTTP/2 explicitly states that status messages are not supported.
564
+ // In HTTP/2, the status is conveyed solely by the numerical status code (e.g., 200, 404, 500),
565
+ // and there is no field for a human-readable status message.
566
+ if (
567
+ typeof(data.page.data.errno) != 'undefined'
568
+ && /^2/.test(data.page.data.status)
569
+ && typeof(localOptions.conf.server.coreConfiguration.statusCodes[data.page.data.status]) != 'undefined'
570
+ && !/http\/2/.test(localOptions.conf.server.protocol)
571
+ ||
572
+ typeof(data.page.data.status) != 'undefined'
573
+ && !/^2/.test(data.page.data.status)
574
+ && typeof(localOptions.conf.server.coreConfiguration.statusCodes[data.page.data.status]) != 'undefined'
575
+ && !/http\/2/.test(localOptions.conf.server.protocol)
576
+ ) {
577
+
578
+ try {
579
+ local.res.statusMessage = localOptions.conf.server.coreConfiguration.statusCodes[data.page.data.status];
580
+ } catch (err){
581
+ local.res.statusCode = 500;
582
+ local.res.statusMessage = err.stack||err.message||localOptions.conf.server.coreConfiguration.statusCodes[local.res.statusCode];
583
+ }
584
+ }
585
+
586
+ local.res.setHeader('content-type', localOptions.conf.server.coreConfiguration.mime['html'] + '; charset='+ localOptions.conf.encoding );
587
+
588
+ try {
589
+
590
+ // escape special chars
591
+ var blacklistRe = new RegExp('[\<\>]', 'g');
592
+ // DO NOT REPLACE IT BY JSON.clone() !!!!
593
+
594
+ data.page.data = JSON.parse(JSON.stringify(data.page.data).replace(blacklistRe, '\$&'));
595
+ blacklistRe = null;
596
+ } catch (err) {
597
+ filename = localOptions.template.html;
598
+ filename += ( typeof(data.page.view.namespace) != 'undefined' && data.page.view.namespace != '' && new RegExp('^' + data.page.view.namespace +'-').test(data.page.view.file) ) ? '/' + data.page.view.namespace + data.page.view.file.split(data.page.view.namespace +'-').join('/') + ( (data.page.view.ext != '') ? data.page.view.ext: '' ) : '/' + data.page.view.file+ ( (data.page.view.ext != '') ? data.page.view.ext: '' );
599
+ self.throwError(local.res, 500, new Error('Controller::render(...) compilation error encountered while trying to process template `'+ filename + '`\n' + (err.stack||err.message||err) ));
600
+ filename = null;
601
+ blacklistRe = null;
602
+ return;
603
+ }
604
+ }
605
+
606
+
607
+ var isLoadingPartial = false;
608
+ assets = {assets:"${assets}"};
609
+ layout = fs.readFileSync(layoutPath, 'utf8');
610
+ // Loading from cache
611
+ if (
612
+ /^true$/i.test(self.serverInstance._cacheIsEnabled)
613
+ && cache.has(cacheKey)
614
+ ) {
615
+ compiledTemplate = cache.get(cacheKey).template;
616
+
617
+ if ( !headersSent() ) {
618
+ if ( localOptions.isRenderingCustomError ) {
619
+ localOptions.isRenderingCustomError = false;
620
+ }
621
+
622
+ htmlContent = compiledTemplate(data);
623
+ local.res.setHeader('content-type', localOptions.conf.server.coreConfiguration.mime['html'] + '; charset='+ localOptions.conf.encoding );
624
+
625
+ if (
626
+ !self.isCacheless()
627
+ && typeof(local.req.routing.cache) != 'undefined'
628
+ && /^GET$/i.test(local.req.method)
629
+ ||
630
+ // allowing caching even for dev env
631
+ /^true$/i.test(self.serverInstance._cacheIsEnabled)
632
+ && typeof(local.req.routing.cache) != 'undefined'
633
+ && /^GET$/i.test(local.req.method)
634
+ ) {
635
+ writeCache(localOptions.bundle, localOptions.conf.server.cache, htmlContent);
636
+ }
637
+
638
+ console.info(local.req.method +' ['+local.res.statusCode +'] '+ local.req.url);
639
+ local.res.end( htmlContent );
640
+ layout = null;
641
+ }
642
+
643
+ if ( typeof(local.next) != 'undefined' ) {
644
+ return local.next();
645
+ }
646
+ return;
647
+ } // EO /^true$/i.test(self.serverInstance._cacheIsEnabled)
648
+
649
+
650
+
651
+ isLoadingPartial = (
652
+ !/\<html/i.test(layout)
653
+ || !/\<head/i.test(layout)
654
+ || !/\<body/i.test(layout)
655
+ ) ? true : false;
656
+
657
+ // if (isLoadingPartial) {
658
+ // console.warn('----------------> loading partial `'+ path);
659
+ // }
660
+
661
+ isDeferModeEnabled = localOptions.template.javascriptsDeferEnabled || localOptions.conf.content.templates._common.javascriptsDeferEnabled || false;
662
+ hasExternalsPlugins = (localOptions.template.externalPlugins.length > 0) ? true : false;
663
+
664
+ // iframe case - without HTML TAG
665
+ if (!self.isXMLRequest() && !/\<html/.test(layout) ) {
666
+ layout = '<html>\n\t<head></head>\n\t<body class="gina-iframe-body">\n\t\t'+ layout +'\n\t</body>\n</html>';
667
+ }
668
+
669
+ // adding stylesheets
670
+ if (!isWithoutLayout && data.page.view.stylesheets && !/\{\{\s+(page\.view\.stylesheets)\s+\}\}/.test(layout) ) {
671
+ layout = layout.replace(/\<\/head\>/i, '\n\t{{ page.view.stylesheets }}\n</head>')
672
+ }
673
+
674
+ if (hasViews() && isWithoutLayout) {
675
+ // $.getScript(...)
676
+ //var isProxyHost = ( typeof(local.req.headers.host) != 'undefined' && localOptions.conf.server.scheme +'://'+ local.req.headers.host != localOptions.conf.hostname || typeof(local.req.headers[':authority']) != 'undefined' && localOptions.conf.server.scheme +'://'+ local.req.headers[':authority'] != localOptions.conf.hostname ) ? true : false;
677
+ //var hostname = (isProxyHost) ? localOptions.conf.hostname.replace(/\:\d+$/, '') : localOptions.conf.hostname;
678
+
679
+
680
+
681
+ var scripts = data.page.view.scripts;
682
+ scripts = scripts.replace(/\s+\<script/g, '\n<script');
683
+
684
+ if (!isProxyHost) {
685
+ var webroot = data.page.environment.webroot;
686
+ scripts = scripts.replace(/src\=\"\/(.*)\"/g, 'src="'+ webroot +'$1"');
687
+ //stylesheets = stylesheets.replace(/href\=\"\/(.*)\"/g, 'href="'+ webroot +'$1"')
688
+ webroot = null;
689
+ }
690
+
691
+ // iframe case - without HTML TAG
692
+ if (self.isXMLRequest() || !/\<html/.test(layout) ) {
693
+ layout += scripts;
694
+ //layout += stylesheets;
695
+ }
696
+
697
+ }
698
+
699
+ // Adding plugins
700
+ // Means that we don't want GFF context or we already have it loaded
701
+ viewInfos = JSON.clone(data.page.view);
702
+ if ( !isWithoutLayout )
703
+ viewInfos.assets = assets;
704
+
705
+ if (
706
+ hasViews() && self.isCacheless() && !isWithoutLayout
707
+ && localOptions.debugMode
708
+ ||
709
+ hasViews() && self.isCacheless() && !isWithoutLayout
710
+ && typeof(localOptions.debugMode) == 'undefined'
711
+ ||
712
+ hasViews() && localOptions.debugMode
713
+ ) {
714
+ if ( !/\{\%\- set ginaDataInspector/.test(layout) ) {
715
+ layout = ''
716
+ // + '{%- set ginaDataInspector = JSON.clone(page) -%}'
717
+ + '{%- set ginaDataInspector = JSON.clone(page) -%}'
718
+ // + '{%- set ginaDataInspector = { view: {}, environment: { routing: {}}} -%}'
719
+ + '{%- set ginaDataInspector.view.assets = {} -%}'
720
+ + '{%- set ginaDataInspector.view.scripts = "ignored-by-toolbar" -%}'
721
+ + '{%- set ginaDataInspector.view.stylesheets = "ignored-by-toolbar" -%}'
722
+ + layout
723
+ ;
724
+ }
725
+
726
+
727
+ plugin = '\t'
728
+ + '{# Gina Toolbar #}'
729
+ + '{%- set userDataInspector = JSON.clone(page) -%}'
730
+ + '{%- set userDataInspector.view.scripts = "ignored-by-toolbar" -%}'
731
+ + '{%- set userDataInspector.view.stylesheets = "ignored-by-toolbar" -%}'
732
+ + '{%- set userDataInspector.view.assets = '+ JSON.stringify(assets) +' -%}'
733
+ + '{# END Gina Toolbar #}'
734
+ + '{%- include "'+ getPath('gina').core +'/asset/plugin/dist/vendor/gina/html/toolbar.html" with { gina: ginaDataInspector, user: userDataInspector } -%}'// jshint ignore:line
735
+ ;
736
+
737
+
738
+ if (isWithoutLayout && localOptions.debugMode || localOptions.debugMode ) {
739
+ if (self.isXMLRequest()) {
740
+ XHRData = '\t<input type="hidden" id="gina-without-layout-xhr-data" value="'+ encodeRFC5987ValueChars(JSON.stringify(data.page.data)) +'">\n\r';
741
+ XHRView = '\n<input type="hidden" id="gina-without-layout-xhr-view" value="'+ encodeRFC5987ValueChars(JSON.stringify(viewInfos)) +'">';
742
+ if ( /<\/body>/i.test(layout) ) {
743
+ layout = layout.replace(/<\/body>/i, XHRData + XHRView + '\n\t</body>');
744
+ } else {
745
+ // Popin case
746
+ // Fix added on 2023-01-25
747
+ layout += XHRData + XHRView + '\n\t'
748
+ }
749
+ }
750
+ }
751
+
752
+
753
+ if (
754
+ self.isCacheless()
755
+ && !/\{\# Gina Toolbar \#\}/.test(layout)
756
+ ||
757
+ localOptions.debugMode
758
+ && !/\{\# Gina Toolbar \#\}/.test(layout)
759
+ ) {
760
+ layout = layout.replace(/<\/body>/i, plugin + '\n\t</body>');
761
+ }
762
+
763
+ // adding javascripts
764
+ layout.replace('{{ page.view.scripts }}', '');
765
+ // placed in the HEAD excepted when rendering a partial or when `isDeferModeEnabled` == true
766
+ if (isLoadingPartial) {
767
+ if ( !/\{\{ page\.view\.scripts \}\}/.test(layout) ) {
768
+ layout += '\t{{ page.view.scripts }}';
769
+ }
770
+ } else {
771
+ // placed in the HEAD
772
+ if ( isDeferModeEnabled ) {
773
+ layout = layout.replace(/\<\/head\>/i, '\t{{ page.view.scripts }}\n\t</head>');
774
+ }
775
+ // placed in the BODY
776
+ else {
777
+ if ( !/\{\{ page\.view\.scripts \}\}/.test(layout) ) {
778
+ layout = layout.replace(/\<\/body\>/i, '\t{{ page.view.scripts }}\n</body>');
779
+ }
780
+ if (hasExternalsPlugins) {
781
+ for (let i =0, len = localOptions.template.externalPlugins.length; i<len; i++) {
782
+ layout = layout.replace(/\<\/head\>/i, '\t'+ localOptions.template.externalPlugins +'\n</head>');
783
+ }
784
+ }
785
+ }
786
+ }
787
+
788
+ // ginaLoader cannot be deferred
789
+ if (
790
+ !localOptions.template.javascriptsExcluded
791
+ && !/window\.onGinaLoaded/.test(layout)
792
+ ||
793
+ localOptions.template.javascriptsExcluded != '**'
794
+ && !/window\.onGinaLoaded/.test(layout)
795
+
796
+ ) {
797
+ layout = layout.replace(/\<\/head\>/i, '\t'+ localOptions.template.ginaLoader +'\n</head>');
798
+ }
799
+
800
+ } else if ( hasViews() && self.isCacheless() && self.isXMLRequest() ) {
801
+
802
+ if (isWithoutLayout) {
803
+ delete data.page.view.scripts;
804
+ delete data.page.view.stylesheets;
805
+ }
806
+ // means that we don't want GFF context or we already have it loaded
807
+ // viewInfos = JSON.clone(data.page.view);
808
+ // if ( !isWithoutLayout )
809
+ // viewInfos.assets = assets;
810
+
811
+
812
+ XHRData = '\n<input type="hidden" id="gina-without-layout-xhr-data" value="'+ encodeRFC5987ValueChars(JSON.stringify(data.page.data)) +'">';
813
+ XHRView = '\n<input type="hidden" id="gina-without-layout-xhr-view" value="'+ encodeRFC5987ValueChars(JSON.stringify(viewInfos)) +'">';
814
+ if ( /<\/body>/i.test(layout) ) {
815
+ layout = layout.replace(/<\/body>/i, XHRData + XHRView + '\n\t</body>');
816
+ } else {
817
+ // Popin case
818
+ // Fix added on 2023-01-25
819
+ layout += XHRData + XHRView + '\n\t'
820
+ }
821
+
822
+ // layout += XHRData + XHRView;
823
+
824
+ } else { // other envs like prod ...
825
+ // adding javascripts
826
+ layout.replace('{{ page.view.scripts }}', '');
827
+ if (isLoadingPartial) {
828
+ if ( !/\{\{ page\.view\.scripts \}\}/.test(layout) ) {
829
+ layout += '\t{{ page.view.scripts }}\n';
830
+ }
831
+ if (
832
+ !localOptions.template.javascriptsExcluded
833
+ && !/window\.onGinaLoaded/.test(layout)
834
+ ||
835
+ localOptions.template.javascriptsExcluded != '**'
836
+ && !/window\.onGinaLoaded/.test(layout)
837
+
838
+ ) {
839
+ layout += '\t'+ localOptions.template.ginaLoader +'\n';
840
+ }
841
+ } else {
842
+ // placed in the HEAD
843
+ if (
844
+ isDeferModeEnabled && /\<\/head\>/i.test(layout)
845
+ && !/\{\{ page\.view\.scripts \}\}/.test(layout)
846
+ ) { // placed in the HEAD
847
+ layout = layout.replace(/\<\/head\>/i, '\t{{ page.view.scripts }}\n\t</head>');
848
+ }
849
+ // placed in the BODY
850
+ else {
851
+ if ( !/\{\{ page\.view\.scripts \}\}/.test(layout) ) {
852
+ layout = layout.replace(/\<\/body\>/i, '\t{{ page.view.scripts }}\n</body>');
853
+ }
854
+ if (hasExternalsPlugins) {
855
+ for (let i =0, len = localOptions.template.externalPlugins.length; i<len; i++) {
856
+ layout = layout.replace(/\<\/head\>/i, '\t'+ localOptions.template.externalPlugins +'\n</head>');
857
+ }
858
+ }
859
+ }
860
+ // ginaLoader cannot be deferred
861
+ if (
862
+ !localOptions.template.javascriptsExcluded
863
+ && !/window\.onGinaLoaded/.test(layout)
864
+ ||
865
+ localOptions.template.javascriptsExcluded != '**'
866
+ && !/window\.onGinaLoaded/.test(layout)
867
+
868
+ ) {
869
+ layout = layout.replace(/\<\/head\>/i, '\t'+ localOptions.template.ginaLoader +'\n</head>');
870
+ }
871
+ }
872
+ }
873
+
874
+
875
+ layout = whisper(dic, layout, /\{{ ([a-zA-Z.]+) \}}/g );
876
+ dic['page.content'] = layout;
877
+
878
+
879
+ if ( !headersSent() ) {
880
+ // //catching errors
881
+ // local.res.statusCode = ( typeof(localOptions.conf.server.coreConfiguration.statusCodes[data.page.data.status]) != 'undefined' ) ? data.page.data.status : 200; // by default
882
+
883
+ // // HTTP/2 (RFC7540 8.1.2.4):
884
+ // // This standard for HTTP/2 explicitly states that status messages are not supported.
885
+ // // In HTTP/2, the status is conveyed solely by the numerical status code (e.g., 200, 404, 500),
886
+ // // and there is no field for a human-readable status message.
887
+ // if (
888
+ // typeof(data.page.data.errno) != 'undefined'
889
+ // && /^2/.test(data.page.data.status)
890
+ // && typeof(localOptions.conf.server.coreConfiguration.statusCodes[data.page.data.status]) != 'undefined'
891
+ // && !/http\/2/.test(localOptions.conf.server.protocol)
892
+ // ||
893
+ // typeof(data.page.data.status) != 'undefined'
894
+ // && !/^2/.test(data.page.data.status)
895
+ // && typeof(localOptions.conf.server.coreConfiguration.statusCodes[data.page.data.status]) != 'undefined'
896
+ // && !/http\/2/.test(localOptions.conf.server.protocol)
897
+ // ) {
898
+
899
+ // try {
900
+ // local.res.statusMessage = localOptions.conf.server.coreConfiguration.statusCodes[data.page.data.status];
901
+ // } catch (err){
902
+ // local.res.statusCode = 500;
903
+ // local.res.statusMessage = err.stack||err.message||localOptions.conf.server.coreConfiguration.statusCodes[local.res.statusCode];
904
+ // }
905
+ // }
906
+
907
+ // local.res.setHeader('content-type', localOptions.conf.server.coreConfiguration.mime['html'] + '; charset='+ localOptions.conf.encoding );
908
+
909
+ // try {
910
+
911
+ // // escape special chars
912
+ // var blacklistRe = new RegExp('[\<\>]', 'g');
913
+ // // DO NOT REPLACE IT BY JSON.clone() !!!!
914
+
915
+ // data.page.data = JSON.parse(JSON.stringify(data.page.data).replace(blacklistRe, '\$&'));
916
+ // blacklistRe = null;
917
+ // } catch (err) {
918
+ // filename = localOptions.template.html;
919
+ // filename += ( typeof(data.page.view.namespace) != 'undefined' && data.page.view.namespace != '' && new RegExp('^' + data.page.view.namespace +'-').test(data.page.view.file) ) ? '/' + data.page.view.namespace + data.page.view.file.split(data.page.view.namespace +'-').join('/') + ( (data.page.view.ext != '') ? data.page.view.ext: '' ) : '/' + data.page.view.file+ ( (data.page.view.ext != '') ? data.page.view.ext: '' );
920
+ // self.throwError(local.res, 500, new Error('Controller::render(...) compilation error encountered while trying to process template `'+ filename + '`\n' + (err.stack||err.message||err) ));
921
+ // filename = null;
922
+ // blacklistRe = null;
923
+ // return;
924
+ // }
925
+
926
+
927
+
928
+ // Only available for http/2.0 for now
929
+ if ( !self.isXMLRequest() && /http\/2/.test(localOptions.conf.server.protocol) ) {
930
+ var assets = null;
931
+ try {
932
+ // TODO - button in toolbar to empty url assets cache
933
+ if ( /** self.isCacheless() ||*/ typeof(localOptions.template.assets) == 'undefined' || typeof(localOptions.template.assets[local.req.url]) == 'undefined' ) {
934
+ // assets string -> object
935
+ //assets = self.serverInstance.getAssets(localOptions.conf, layout.toString(), swig, data);
936
+ assets = self.serverInstance.getAssets(localOptions.conf, layout, null, data);
937
+ localOptions.template.assets = JSON.parse(assets);
938
+ }
939
+
940
+ // only for toolbar - TODO hasToolbar()
941
+ if (
942
+ self.isCacheless() && hasViews() && !isWithoutLayout
943
+ || hasViews() && localOptions.debugMode
944
+ || self.isCacheless() && hasViews() && self.isXMLRequest()
945
+ ) {
946
+ layout = layout.replace('{"assets":"${assets}"}', assets );
947
+ }
948
+
949
+ if ( !self.isCacheless() ) {
950
+ var links = localOptions.template.h2Links;
951
+ for (let l in localOptions.template.assets) {
952
+ let link = localOptions.template.assets[l]
953
+ if (
954
+ /^_/.test(l)
955
+ || typeof(link.as) == 'undefined'
956
+ || typeof(link.as) != 'undefined'
957
+ && link.as != 'null'
958
+ && !link.isAvailable
959
+ || !link.as
960
+ ) {
961
+ // ignoring
962
+ continue;
963
+ }
964
+
965
+ links += '<'+ l +'>; as='+ link.as +'; '
966
+ if ( link.imagesrcset) {
967
+ links += 'imagesrcset='+ link.imagesrcset +'; ';
968
+ }
969
+ if ( link.imagesizes) {
970
+ links += 'imagesizes='+ link.imagesizes +'; ';
971
+ }
972
+ links += 'rel=preload,'
973
+
974
+ }
975
+ if ( /\,$/.test(links) ) {
976
+ links = links.substring(0, links.length-1);
977
+ }
978
+ local.res.setHeader('link', links);
979
+ links = null;
980
+ }
981
+
982
+ assets = null;
983
+
984
+ } catch (err) {
985
+ assets = null;
986
+ self.throwError(local.res, 500, new Error('Controller::render(...) calling getAssets(...) \n' + (err.stack||err.message||err) ));
987
+ return;
988
+ }
989
+ }
990
+
991
+ if (newLayoutFilename) {
992
+ fd = fs.openSync(newLayoutFilename, 'w'); // Open file for writing
993
+ buffer = Buffer.from( layout );
994
+ fs.writeSync(fd, buffer, 0, buffer.length, 0); // Write the buffer
995
+ buffer = null;
996
+ fs.closeSync(fd); // Close the file descriptor
997
+ fd = null;
998
+ }
999
+
1000
+ // Last compilation before rendering
1001
+ // Now we can use `data` instead of `swigData`
1002
+ mapping = { filename: path };
1003
+ compiledTemplate = swig.compile(_templateContent, mapping);
1004
+
1005
+ if (
1006
+ /^true$/i.test(self.serverInstance._cacheIsEnabled)
1007
+ && hasLayoutInPath
1008
+ && !cache.has(cacheKey)
1009
+ ) {
1010
+ // Caching template
1011
+ cacheObject = {
1012
+ template: compiledTemplate
1013
+ };
1014
+ cache.set(cacheKey, cacheObject);
1015
+ }
1016
+
1017
+ if ( !headersSent() ) {
1018
+ if ( localOptions.isRenderingCustomError ) {
1019
+ localOptions.isRenderingCustomError = false;
1020
+ }
1021
+ htmlContent = compiledTemplate(data);
1022
+ local.res.setHeader('content-type', localOptions.conf.server.coreConfiguration.mime['html'] + '; charset='+ localOptions.conf.encoding );
1023
+
1024
+ if (
1025
+ !self.isCacheless()
1026
+ && typeof(local.req.routing.cache) != 'undefined'
1027
+ && /^GET$/i.test(local.req.method)
1028
+ ||
1029
+ // allowing caching even for dev env
1030
+ /^true$/i.test(self.serverInstance._cacheIsEnabled)
1031
+ && typeof(local.req.routing.cache) != 'undefined'
1032
+ && /^GET$/i.test(local.req.method)
1033
+ ) {
1034
+ writeCache(localOptions.bundle, localOptions.conf.server.cache, htmlContent);
1035
+ }
1036
+
1037
+ console.info(local.req.method +' ['+local.res.statusCode +'] '+ local.req.url);
1038
+ local.res.end( htmlContent );
1039
+
1040
+ layout = null;
1041
+ }
1042
+
1043
+ // console.info(local.req.method +' ['+local.res.statusCode +'] '+ local.req.url);
1044
+
1045
+ if ( typeof(local.next) != 'undefined' ) {
1046
+ return local.next();
1047
+ }
1048
+ return;
1049
+ }
1050
+
1051
+
1052
+ if ( typeof(local.req.params.errorObject) != 'undefined' ) {
1053
+ return self.throwError(local.req.params.errorObject);
1054
+ }
1055
+ local.res.end('Unexpected controller error while trying to render.');
1056
+
1057
+ if (typeof(local.next) != 'undefined') {
1058
+ return local.next();
1059
+ }
1060
+
1061
+ return;
1062
+
1063
+ } catch (err) {
1064
+ return self.throwError(local.res, 500, err);
1065
+ }
1066
+ }
1067
+
1068
+ module.exports = function onDeps(deps) {
1069
+
1070
+ self = deps.self;
1071
+ local = deps.local;
1072
+ getData = deps.getData;
1073
+ hasViews = deps.hasViews;
1074
+ setResources = deps.setResources;
1075
+ swig = deps.swig;
1076
+ SwigFilters = deps.SwigFilters;
1077
+ headersSent = deps.headersSent;
1078
+
1079
+ return render;
1080
+ };