gina 0.7.3 → 0.7.4

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 (636) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +48 -40
  3. package/ROADMAP.md +1 -0
  4. package/bin/cli +33 -4
  5. package/bin/cli-debug +37 -1
  6. package/bin/cmd +18 -0
  7. package/framework/v0.7.4/VERSION +1 -0
  8. package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/js/gina.js +1504 -621
  9. package/framework/v0.7.4/core/asset/plugin/dist/vendor/gina/js/gina.min.js +736 -0
  10. package/framework/v0.7.4/core/asset/plugin/dist/vendor/gina/js/gina.min.js.br +0 -0
  11. package/framework/v0.7.4/core/asset/plugin/dist/vendor/gina/js/gina.min.js.gz +0 -0
  12. package/framework/{v0.7.3 → v0.7.4}/core/config.js +13 -3
  13. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.js +268 -14
  14. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-json.js +9 -2
  15. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-nunjucks.js +88 -9
  16. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-swig-async.js +87 -7
  17. package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-swig.js +115 -9
  18. package/framework/{v0.7.3 → v0.7.4}/core/gna.js +44 -2
  19. package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/src/form-validator.js +43 -4
  20. package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/src/main.js +847 -515
  21. package/framework/{v0.7.3 → v0.7.4}/core/router.js +139 -40
  22. package/framework/{v0.7.3 → v0.7.4}/core/server.express.js +5 -4
  23. package/framework/{v0.7.3 → v0.7.4}/core/server.isaac.js +93 -10
  24. package/framework/{v0.7.3 → v0.7.4}/core/server.js +348 -46
  25. package/framework/{v0.7.3 → v0.7.4}/helpers/context.js +47 -2
  26. package/framework/{v0.7.3 → v0.7.4}/helpers/data/src/main.js +10 -1
  27. package/framework/{v0.7.3 → v0.7.4}/helpers/prototypes.js +23 -1
  28. package/framework/v0.7.4/lib/cmd/bundle/inc/start-status.js +420 -0
  29. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/restart.js +71 -1
  30. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/start.js +207 -41
  31. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/cache/clear.js +39 -8
  32. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/cache/help.txt +3 -4
  33. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/inc/ps-titles.js +62 -6
  34. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/init.js +12 -1
  35. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/restart.js +49 -11
  36. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/status.js +23 -1
  37. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/stop.js +150 -48
  38. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/helper.js +24 -0
  39. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/run.js +6 -0
  40. package/framework/{v0.7.3 → v0.7.4}/lib/cmd/index.js +8 -1
  41. package/framework/{v0.7.3 → v0.7.4}/lib/collection/src/main.js +373 -74
  42. package/framework/{v0.7.3 → v0.7.4}/lib/job/src/main.js +49 -5
  43. package/framework/{v0.7.3 → v0.7.4}/lib/lane/src/main.js +81 -5
  44. package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/main.js +184 -15
  45. package/framework/v0.7.4/lib/logger/src/redact.js +1003 -0
  46. package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-filters/src/main.js +118 -11
  47. package/framework/{v0.7.3 → v0.7.4}/lib/proc.js +27 -8
  48. package/framework/{v0.7.3 → v0.7.4}/lib/render-cache/src/main.js +97 -0
  49. package/framework/{v0.7.3 → v0.7.4}/lib/routing/src/main.js +140 -14
  50. package/framework/{v0.7.3 → v0.7.4}/lib/sqlite-driver.js +15 -5
  51. package/framework/{v0.7.3 → v0.7.4}/lib/swig-filters/src/main.js +123 -16
  52. package/framework/{v0.7.3 → v0.7.4}/package.json +1 -1
  53. package/gna.js +4 -4
  54. package/llms.txt +24 -22
  55. package/package.json +5 -4
  56. package/schema/settings.json +25 -1
  57. package/script/smoke_in_container.js +69 -12
  58. package/types/index.d.ts +3 -2
  59. package/utils/prototypes.js +37 -2
  60. package/framework/v0.7.3/VERSION +0 -1
  61. package/framework/v0.7.3/core/asset/plugin/dist/vendor/gina/js/gina.min.js +0 -726
  62. package/framework/v0.7.3/core/asset/plugin/dist/vendor/gina/js/gina.min.js.br +0 -0
  63. package/framework/v0.7.3/core/asset/plugin/dist/vendor/gina/js/gina.min.js.gz +0 -0
  64. package/framework/v0.7.3/lib/logger/src/redact.js +0 -391
  65. /package/framework/{v0.7.3 → v0.7.4}/AUTHORS +0 -0
  66. /package/framework/{v0.7.3 → v0.7.4}/LICENSE +0 -0
  67. /package/framework/{v0.7.3 → v0.7.4}/core/asset/html/nolayout.html +0 -0
  68. /package/framework/{v0.7.3 → v0.7.4}/core/asset/html/static.html +0 -0
  69. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/android-chrome-192x192.png +0 -0
  70. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/android-chrome-512x512.png +0 -0
  71. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/apple-touch-icon.png +0 -0
  72. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/favicon-16x16.png +0 -0
  73. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/favicon-32x32.png +0 -0
  74. /package/framework/{v0.7.3 → v0.7.4}/core/asset/img/favicon.ico +0 -0
  75. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/README.md +0 -0
  76. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/beemaster/beemaster.css +0 -0
  77. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/beemaster/beemaster.js +0 -0
  78. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/beemaster/index.html +0 -0
  79. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/css/gina.min.css +0 -0
  80. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/css/gina.min.css.br +0 -0
  81. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/css/gina.min.css.gz +0 -0
  82. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/html/statusbar.html +0 -0
  83. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/html/statusbar.html.br +0 -0
  84. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/html/statusbar.html.gz +0 -0
  85. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/have_heart_one-webfont.woff2 +0 -0
  86. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/index.html +0 -0
  87. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/inspector.css +0 -0
  88. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/inspector.js +0 -0
  89. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/inspector/logo.svg +0 -0
  90. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js +0 -0
  91. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.br +0 -0
  92. /package/framework/{v0.7.3 → v0.7.4}/core/asset/plugin/dist/vendor/gina/js/gina.onload.min.js.gz +0 -0
  93. /package/framework/{v0.7.3 → v0.7.4}/core/config.requirements-anchor.js +0 -0
  94. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/ai/index.js +0 -0
  95. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/ai/lib/connector.js +0 -0
  96. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/index.js +0 -0
  97. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/connector.js +0 -0
  98. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/connector.v3.js +0 -0
  99. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/connector.v4.js +0 -0
  100. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/n1ql.js +0 -0
  101. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/session-store.js +0 -0
  102. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/session-store.v3.js +0 -0
  103. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/session-store.v4.js +0 -0
  104. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/couchbase/lib/storage-store.js +0 -0
  105. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/duckdb/index.js +0 -0
  106. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/duckdb/lib/connector.js +0 -0
  107. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/index.js +0 -0
  108. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/lib/connector.js +0 -0
  109. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/lib/job-store.js +0 -0
  110. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/lib/pipeline-loader.js +0 -0
  111. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mongodb/lib/session-store.js +0 -0
  112. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mysql/index.js +0 -0
  113. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/mysql/lib/connector.js +0 -0
  114. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/param-redact.js +0 -0
  115. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/postgresql/index.js +0 -0
  116. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/postgresql/lib/connector.js +0 -0
  117. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/index.js +0 -0
  118. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/connector.js +0 -0
  119. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/job-store.js +0 -0
  120. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/kv-store.js +0 -0
  121. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/render-cache-store.js +0 -0
  122. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/redis/lib/session-store.js +0 -0
  123. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/scylladb/index.js +0 -0
  124. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/scylladb/lib/connector.js +0 -0
  125. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/scylladb/lib/session-store.js +0 -0
  126. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/settle-once.js +0 -0
  127. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sql-parser.js +0 -0
  128. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/index.js +0 -0
  129. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/lib/connector.js +0 -0
  130. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/lib/job-store.js +0 -0
  131. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/lib/kv-store.js +0 -0
  132. /package/framework/{v0.7.3 → v0.7.4}/core/connectors/sqlite/lib/session-store.js +0 -0
  133. /package/framework/{v0.7.3 → v0.7.4}/core/content.encoding +0 -0
  134. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.framework.js +0 -0
  135. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-nunjucks-async.js +0 -0
  136. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-stream.js +0 -0
  137. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-v1.js +0 -0
  138. /package/framework/{v0.7.3 → v0.7.4}/core/controller/controller.render-xml.js +0 -0
  139. /package/framework/{v0.7.3 → v0.7.4}/core/controller/index.js +0 -0
  140. /package/framework/{v0.7.3 → v0.7.4}/core/controller/inline-script.js +0 -0
  141. /package/framework/{v0.7.3 → v0.7.4}/core/controller/inspector-window-emit.js +0 -0
  142. /package/framework/{v0.7.3 → v0.7.4}/core/controller/preload-hints.js +0 -0
  143. /package/framework/{v0.7.3 → v0.7.4}/core/controller/release-banner.js +0 -0
  144. /package/framework/{v0.7.3 → v0.7.4}/core/dev/index.js +0 -0
  145. /package/framework/{v0.7.3 → v0.7.4}/core/dev/lib/class.js +0 -0
  146. /package/framework/{v0.7.3 → v0.7.4}/core/dev/lib/factory.js +0 -0
  147. /package/framework/{v0.7.3 → v0.7.4}/core/dev/lib/tools.js +0 -0
  148. /package/framework/{v0.7.3 → v0.7.4}/core/locales/README.md +0 -0
  149. /package/framework/{v0.7.3 → v0.7.4}/core/locales/currency.json +0 -0
  150. /package/framework/{v0.7.3 → v0.7.4}/core/locales/dist/language/en.json +0 -0
  151. /package/framework/{v0.7.3 → v0.7.4}/core/locales/dist/language/fr.json +0 -0
  152. /package/framework/{v0.7.3 → v0.7.4}/core/locales/dist/region/en.json +0 -0
  153. /package/framework/{v0.7.3 → v0.7.4}/core/locales/dist/region/fr.json +0 -0
  154. /package/framework/{v0.7.3 → v0.7.4}/core/locales/index.js +0 -0
  155. /package/framework/{v0.7.3 → v0.7.4}/core/mime.types +0 -0
  156. /package/framework/{v0.7.3 → v0.7.4}/core/model/entity.js +0 -0
  157. /package/framework/{v0.7.3 → v0.7.4}/core/model/index.js +0 -0
  158. /package/framework/{v0.7.3 → v0.7.4}/core/model/template/entityFactory.js +0 -0
  159. /package/framework/{v0.7.3 → v0.7.4}/core/model/template/index.js +0 -0
  160. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/README.md +0 -0
  161. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/index.js +0 -0
  162. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/csrf/README.md +0 -0
  163. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/csrf/package.json +0 -0
  164. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/csrf/src/main.js +0 -0
  165. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/README.md +0 -0
  166. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coep/README.md +0 -0
  167. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coep/package.json +0 -0
  168. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coep/src/main.js +0 -0
  169. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coop/README.md +0 -0
  170. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coop/package.json +0 -0
  171. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/coop/src/main.js +0 -0
  172. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/corp/README.md +0 -0
  173. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/corp/package.json +0 -0
  174. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/corp/src/main.js +0 -0
  175. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/csp/README.md +0 -0
  176. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/csp/package.json +0 -0
  177. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/csp/src/main.js +0 -0
  178. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hide-powered-by/README.md +0 -0
  179. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hide-powered-by/package.json +0 -0
  180. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hide-powered-by/src/main.js +0 -0
  181. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hsts/README.md +0 -0
  182. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hsts/package.json +0 -0
  183. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/hsts/src/main.js +0 -0
  184. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/origin-agent-cluster/README.md +0 -0
  185. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/origin-agent-cluster/package.json +0 -0
  186. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/origin-agent-cluster/src/main.js +0 -0
  187. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/package.json +0 -0
  188. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/referrer-policy/README.md +0 -0
  189. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/referrer-policy/package.json +0 -0
  190. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/referrer-policy/src/main.js +0 -0
  191. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/src/main.js +0 -0
  192. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-content-type-options/README.md +0 -0
  193. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-content-type-options/package.json +0 -0
  194. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-content-type-options/src/main.js +0 -0
  195. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-dns-prefetch-control/README.md +0 -0
  196. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-dns-prefetch-control/package.json +0 -0
  197. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-dns-prefetch-control/src/main.js +0 -0
  198. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-download-options/README.md +0 -0
  199. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-download-options/package.json +0 -0
  200. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-download-options/src/main.js +0 -0
  201. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-frame-options/README.md +0 -0
  202. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-frame-options/package.json +0 -0
  203. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-frame-options/src/main.js +0 -0
  204. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-permitted-cross-domain-policies/README.md +0 -0
  205. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-permitted-cross-domain-policies/package.json +0 -0
  206. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-permitted-cross-domain-policies/src/main.js +0 -0
  207. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-xss-protection/README.md +0 -0
  208. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-xss-protection/package.json +0 -0
  209. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/security-headers/x-xss-protection/src/main.js +0 -0
  210. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/session/README.md +0 -0
  211. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/session/package.json +0 -0
  212. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/session/src/main.js +0 -0
  213. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/storage/README.md +0 -0
  214. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/storage/build.json +0 -0
  215. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/storage/package.json +0 -0
  216. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/storage/src/main.js +0 -0
  217. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/README.md +0 -0
  218. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/build.json +0 -0
  219. /package/framework/{v0.7.3 → v0.7.4}/core/plugins/lib/validator/package.json +0 -0
  220. /package/framework/{v0.7.3 → v0.7.4}/core/server.isaac.rapid-reset.js +0 -0
  221. /package/framework/{v0.7.3 → v0.7.4}/core/server.route-candidates.js +0 -0
  222. /package/framework/{v0.7.3 → v0.7.4}/core/status.codes +0 -0
  223. /package/framework/{v0.7.3 → v0.7.4}/core/template/_gitignore +0 -0
  224. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/app.json +0 -0
  225. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/connectors.json +0 -0
  226. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/routing.json +0 -0
  227. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/settings.json +0 -0
  228. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/settings.server.json +0 -0
  229. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/templates.json +0 -0
  230. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/config/watchers.json +0 -0
  231. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/controllers/controller.content.js +0 -0
  232. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/controllers/controller.js +0 -0
  233. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/controllers/setup.js +0 -0
  234. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/index.js +0 -0
  235. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle/locales/en.json +0 -0
  236. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_namespace/controllers/controller.js +0 -0
  237. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/css/default.css +0 -0
  238. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/css/home.css +0 -0
  239. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/css/vendor/readme.md +0 -0
  240. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/favicon.ico +0 -0
  241. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/js/components/x-checklist.js +0 -0
  242. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/js/vendor/readme.md +0 -0
  243. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/manifest.webmanifest +0 -0
  244. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/readme.md +0 -0
  245. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_public/sw.js +0 -0
  246. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/handlers/main.js +0 -0
  247. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/content/homepage.html +0 -0
  248. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/includes/error-msg-noscript.html +0 -0
  249. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/includes/error-msg-outdated-browser.html +0 -0
  250. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/includes/x-checklist.html +0 -0
  251. /package/framework/{v0.7.3 → v0.7.4}/core/template/boilerplate/bundle_templates/html/layouts/main.html +0 -0
  252. /package/framework/{v0.7.3 → v0.7.4}/core/template/command/gina.bat.tpl +0 -0
  253. /package/framework/{v0.7.3 → v0.7.4}/core/template/command/gina.tpl +0 -0
  254. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/env.json +0 -0
  255. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/manifest.json +0 -0
  256. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/package.json +0 -0
  257. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/settings.json +0 -0
  258. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/statics.json +0 -0
  259. /package/framework/{v0.7.3 → v0.7.4}/core/template/conf/templates.json +0 -0
  260. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/client/json/401.json +0 -0
  261. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/client/json/403.json +0 -0
  262. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/client/json/404.json +0 -0
  263. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/server/html/50x.html +0 -0
  264. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/server/json/500.json +0 -0
  265. /package/framework/{v0.7.3 → v0.7.4}/core/template/error/server/json/503.json +0 -0
  266. /package/framework/{v0.7.3 → v0.7.4}/core/template/extensions/logger/config.json +0 -0
  267. /package/framework/{v0.7.3 → v0.7.4}/helpers/console.js +0 -0
  268. /package/framework/{v0.7.3 → v0.7.4}/helpers/data/LICENSE +0 -0
  269. /package/framework/{v0.7.3 → v0.7.4}/helpers/data/README.md +0 -0
  270. /package/framework/{v0.7.3 → v0.7.4}/helpers/data/package.json +0 -0
  271. /package/framework/{v0.7.3 → v0.7.4}/helpers/dateFormat.js +0 -0
  272. /package/framework/{v0.7.3 → v0.7.4}/helpers/index.js +0 -0
  273. /package/framework/{v0.7.3 → v0.7.4}/helpers/json/LICENSE +0 -0
  274. /package/framework/{v0.7.3 → v0.7.4}/helpers/json/README.md +0 -0
  275. /package/framework/{v0.7.3 → v0.7.4}/helpers/json/package.json +0 -0
  276. /package/framework/{v0.7.3 → v0.7.4}/helpers/json/src/main.js +0 -0
  277. /package/framework/{v0.7.3 → v0.7.4}/helpers/path.js +0 -0
  278. /package/framework/{v0.7.3 → v0.7.4}/helpers/plugins/README.md +0 -0
  279. /package/framework/{v0.7.3 → v0.7.4}/helpers/plugins/package.json +0 -0
  280. /package/framework/{v0.7.3 → v0.7.4}/helpers/plugins/src/api-error.js +0 -0
  281. /package/framework/{v0.7.3 → v0.7.4}/helpers/plugins/src/main.js +0 -0
  282. /package/framework/{v0.7.3 → v0.7.4}/helpers/task.js +0 -0
  283. /package/framework/{v0.7.3 → v0.7.4}/helpers/text.js +0 -0
  284. /package/framework/{v0.7.3 → v0.7.4}/lib/admin/package.json +0 -0
  285. /package/framework/{v0.7.3 → v0.7.4}/lib/admin/src/main.js +0 -0
  286. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/README.md +0 -0
  287. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/build.json +0 -0
  288. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/package.json +0 -0
  289. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/src/dep/jszip.min.js +0 -0
  290. /package/framework/{v0.7.3 → v0.7.4}/lib/archiver/src/main.js +0 -0
  291. /package/framework/{v0.7.3 → v0.7.4}/lib/async/package.json +0 -0
  292. /package/framework/{v0.7.3 → v0.7.4}/lib/async/src/main.js +0 -0
  293. /package/framework/{v0.7.3 → v0.7.4}/lib/audit/package.json +0 -0
  294. /package/framework/{v0.7.3 → v0.7.4}/lib/audit/src/main.js +0 -0
  295. /package/framework/{v0.7.3 → v0.7.4}/lib/audit-store.js +0 -0
  296. /package/framework/{v0.7.3 → v0.7.4}/lib/authn/package.json +0 -0
  297. /package/framework/{v0.7.3 → v0.7.4}/lib/authn/src/lockout.js +0 -0
  298. /package/framework/{v0.7.3 → v0.7.4}/lib/authn/src/main.js +0 -0
  299. /package/framework/{v0.7.3 → v0.7.4}/lib/authn/src/totp.js +0 -0
  300. /package/framework/{v0.7.3 → v0.7.4}/lib/authz-gate/package.json +0 -0
  301. /package/framework/{v0.7.3 → v0.7.4}/lib/authz-gate/src/main.js +0 -0
  302. /package/framework/{v0.7.3 → v0.7.4}/lib/cache/README.md +0 -0
  303. /package/framework/{v0.7.3 → v0.7.4}/lib/cache/build.json +0 -0
  304. /package/framework/{v0.7.3 → v0.7.4}/lib/cache/package.json +0 -0
  305. /package/framework/{v0.7.3 → v0.7.4}/lib/cache/src/main.js +0 -0
  306. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/aliases.json +0 -0
  307. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/audit/arguments.json +0 -0
  308. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/audit/help.txt +0 -0
  309. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/audit/verify.js +0 -0
  310. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/add.js +0 -0
  311. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/arguments.json +0 -0
  312. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/build.js +0 -0
  313. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/copy.js +0 -0
  314. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/cp.js +0 -0
  315. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/help.js +0 -0
  316. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/help.txt +0 -0
  317. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/inc/boot-lines.js +0 -0
  318. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/inc/name-rewrite.js +0 -0
  319. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/inc/name.js +0 -0
  320. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/list.js +0 -0
  321. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/man.js +0 -0
  322. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/mcp-start.js +0 -0
  323. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/mcp.js +0 -0
  324. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/oas.js +0 -0
  325. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/openapi.js +0 -0
  326. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/remove.js +0 -0
  327. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/rename.js +0 -0
  328. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/rm.js +0 -0
  329. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/status.js +0 -0
  330. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/stop.js +0 -0
  331. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/bundle/types.js +0 -0
  332. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/cache/arguments.json +0 -0
  333. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/cache/stats.js +0 -0
  334. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/add.js +0 -0
  335. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/arguments.json +0 -0
  336. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/help.js +0 -0
  337. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/help.txt +0 -0
  338. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/infer.js +0 -0
  339. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/list.js +0 -0
  340. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/migrate.js +0 -0
  341. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/models.js +0 -0
  342. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/remove.js +0 -0
  343. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/rm.js +0 -0
  344. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/connector/test.js +0 -0
  345. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/arguments.json +0 -0
  346. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/help.js +0 -0
  347. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/help.txt +0 -0
  348. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/man.js +0 -0
  349. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/ps.js +0 -0
  350. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/container/stop.js +0 -0
  351. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/add.js +0 -0
  352. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/arguments.json +0 -0
  353. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/help.txt +0 -0
  354. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/args.js +0 -0
  355. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/namespace.js +0 -0
  356. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/reference-rewrite.js +0 -0
  357. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/reference-scan.js +0 -0
  358. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/inc/scaffold.js +0 -0
  359. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/remove.js +0 -0
  360. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/rename.js +0 -0
  361. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/controller/rm.js +0 -0
  362. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/add.js +0 -0
  363. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/get.js +0 -0
  364. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/help.js +0 -0
  365. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/help.txt +0 -0
  366. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/inc/name.js +0 -0
  367. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/link-dev.js +0 -0
  368. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/list.js +0 -0
  369. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/remove.js +0 -0
  370. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/rm.js +0 -0
  371. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/set.js +0 -0
  372. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/unset.js +0 -0
  373. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/env/use.js +0 -0
  374. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/add.js +0 -0
  375. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/arguments.json +0 -0
  376. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/build.js +0 -0
  377. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/dot.js +0 -0
  378. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/get.js +0 -0
  379. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/help.js +0 -0
  380. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/help.txt +0 -0
  381. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/inc/listen-error.js +0 -0
  382. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/link-node-modules.js +0 -0
  383. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/link.js +0 -0
  384. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/list.js +0 -0
  385. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/man.js +0 -0
  386. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/msg.json +0 -0
  387. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/open.js +0 -0
  388. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/remove.js +0 -0
  389. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/reset.js +0 -0
  390. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/set.js +0 -0
  391. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/start.js +0 -0
  392. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/tail.js +0 -0
  393. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/update.js +0 -0
  394. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/framework/version.js +0 -0
  395. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/gina-dev.1.md +0 -0
  396. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/gina-framework.1.md +0 -0
  397. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/gina.1.md +0 -0
  398. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/add.js +0 -0
  399. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/arguments.json +0 -0
  400. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/export.js +0 -0
  401. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/help.js +0 -0
  402. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/help.txt +0 -0
  403. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/import.js +0 -0
  404. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/i18n/scan.js +0 -0
  405. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/_host.js +0 -0
  406. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/arguments.json +0 -0
  407. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/build.js +0 -0
  408. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/help.js +0 -0
  409. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/help.txt +0 -0
  410. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/list.js +0 -0
  411. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/man.js +0 -0
  412. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/image/rm.js +0 -0
  413. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/inspector/help.js +0 -0
  414. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/inspector/help.txt +0 -0
  415. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/inspector/open.js +0 -0
  416. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/man-render.js +0 -0
  417. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/arguments.json +0 -0
  418. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/help.js +0 -0
  419. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/help.txt +0 -0
  420. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/kill.js +0 -0
  421. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/minion/list.js +0 -0
  422. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/msg.json +0 -0
  423. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/help.js +0 -0
  424. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/help.txt +0 -0
  425. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/inc/scan.js +0 -0
  426. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/list.js +0 -0
  427. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/reset.js +0 -0
  428. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/port/set.js +0 -0
  429. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/add.js +0 -0
  430. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/arguments.json +0 -0
  431. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/backup.js +0 -0
  432. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/build.js +0 -0
  433. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/help.js +0 -0
  434. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/help.txt +0 -0
  435. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/import.js +0 -0
  436. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/inc/name.js +0 -0
  437. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/list.js +0 -0
  438. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/man.js +0 -0
  439. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/move.js +0 -0
  440. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/remove.js +0 -0
  441. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/rename.js +0 -0
  442. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/restart.js +0 -0
  443. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/restore.js +0 -0
  444. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/rm.js +0 -0
  445. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/start.js +0 -0
  446. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/status.js +0 -0
  447. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/project/stop.js +0 -0
  448. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/arguments.json +0 -0
  449. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/help.js +0 -0
  450. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/help.txt +0 -0
  451. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/list.js +0 -0
  452. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/remove.js +0 -0
  453. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/protocol/set.js +0 -0
  454. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/add.js +0 -0
  455. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/help.js +0 -0
  456. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/help.txt +0 -0
  457. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/inc/name.js +0 -0
  458. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/link-local.js +0 -0
  459. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/link-production.js +0 -0
  460. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/list.js +0 -0
  461. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/remove.js +0 -0
  462. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/rm.js +0 -0
  463. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/scope/use.js +0 -0
  464. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/arguments.json +0 -0
  465. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/check.js +0 -0
  466. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/help.js +0 -0
  467. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/help.txt +0 -0
  468. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/secrets/scan.js +0 -0
  469. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/help.js +0 -0
  470. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/help.txt +0 -0
  471. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/list.js +0 -0
  472. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/man.js +0 -0
  473. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/service/start.js +0 -0
  474. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/arguments.json +0 -0
  475. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/gc.js +0 -0
  476. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/help.txt +0 -0
  477. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/stats.js +0 -0
  478. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/storage/verify.js +0 -0
  479. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd/view/add.js +0 -0
  480. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd-status-format/package.json +0 -0
  481. /package/framework/{v0.7.3 → v0.7.4}/lib/cmd-status-format/src/main.js +0 -0
  482. /package/framework/{v0.7.3 → v0.7.4}/lib/collection/README.md +0 -0
  483. /package/framework/{v0.7.3 → v0.7.4}/lib/collection/build.json +0 -0
  484. /package/framework/{v0.7.3 → v0.7.4}/lib/collection/package.json +0 -0
  485. /package/framework/{v0.7.3 → v0.7.4}/lib/conf-view/package.json +0 -0
  486. /package/framework/{v0.7.3 → v0.7.4}/lib/conf-view/src/main.js +0 -0
  487. /package/framework/{v0.7.3 → v0.7.4}/lib/config.js +0 -0
  488. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-config/package.json +0 -0
  489. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-config/src/main.js +0 -0
  490. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-error/package.json +0 -0
  491. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-error/src/main.js +0 -0
  492. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-registry/package.json +0 -0
  493. /package/framework/{v0.7.3 → v0.7.4}/lib/connector-registry/src/main.js +0 -0
  494. /package/framework/{v0.7.3 → v0.7.4}/lib/cron/README.md +0 -0
  495. /package/framework/{v0.7.3 → v0.7.4}/lib/cron/package.json +0 -0
  496. /package/framework/{v0.7.3 → v0.7.4}/lib/cron/src/main.js +0 -0
  497. /package/framework/{v0.7.3 → v0.7.4}/lib/domain/LICENSE +0 -0
  498. /package/framework/{v0.7.3 → v0.7.4}/lib/domain/README.md +0 -0
  499. /package/framework/{v0.7.3 → v0.7.4}/lib/domain/package.json +0 -0
  500. /package/framework/{v0.7.3 → v0.7.4}/lib/domain/src/main.js +0 -0
  501. /package/framework/{v0.7.3 → v0.7.4}/lib/dto/package.json +0 -0
  502. /package/framework/{v0.7.3 → v0.7.4}/lib/dto/src/main.js +0 -0
  503. /package/framework/{v0.7.3 → v0.7.4}/lib/dto-pipe/package.json +0 -0
  504. /package/framework/{v0.7.3 → v0.7.4}/lib/dto-pipe/src/main.js +0 -0
  505. /package/framework/{v0.7.3 → v0.7.4}/lib/dto-types/package.json +0 -0
  506. /package/framework/{v0.7.3 → v0.7.4}/lib/dto-types/src/main.js +0 -0
  507. /package/framework/{v0.7.3 → v0.7.4}/lib/duration/package.json +0 -0
  508. /package/framework/{v0.7.3 → v0.7.4}/lib/duration/src/main.js +0 -0
  509. /package/framework/{v0.7.3 → v0.7.4}/lib/error-ref/package.json +0 -0
  510. /package/framework/{v0.7.3 → v0.7.4}/lib/error-ref/src/main.js +0 -0
  511. /package/framework/{v0.7.3 → v0.7.4}/lib/generator/index.js +0 -0
  512. /package/framework/{v0.7.3 → v0.7.4}/lib/i18n/package.json +0 -0
  513. /package/framework/{v0.7.3 → v0.7.4}/lib/i18n/src/main.js +0 -0
  514. /package/framework/{v0.7.3 → v0.7.4}/lib/idempotency/package.json +0 -0
  515. /package/framework/{v0.7.3 → v0.7.4}/lib/idempotency/src/main.js +0 -0
  516. /package/framework/{v0.7.3 → v0.7.4}/lib/image-build/package.json +0 -0
  517. /package/framework/{v0.7.3 → v0.7.4}/lib/image-build/src/main.js +0 -0
  518. /package/framework/{v0.7.3 → v0.7.4}/lib/index.js +0 -0
  519. /package/framework/{v0.7.3 → v0.7.4}/lib/inherits/LICENSE +0 -0
  520. /package/framework/{v0.7.3 → v0.7.4}/lib/inherits/README.md +0 -0
  521. /package/framework/{v0.7.3 → v0.7.4}/lib/inherits/package.json +0 -0
  522. /package/framework/{v0.7.3 → v0.7.4}/lib/inherits/src/main.js +0 -0
  523. /package/framework/{v0.7.3 → v0.7.4}/lib/inspector-events/package.json +0 -0
  524. /package/framework/{v0.7.3 → v0.7.4}/lib/inspector-events/src/main.js +0 -0
  525. /package/framework/{v0.7.3 → v0.7.4}/lib/inspector-redact/package.json +0 -0
  526. /package/framework/{v0.7.3 → v0.7.4}/lib/inspector-redact/src/main.js +0 -0
  527. /package/framework/{v0.7.3 → v0.7.4}/lib/instrument/package.json +0 -0
  528. /package/framework/{v0.7.3 → v0.7.4}/lib/instrument/src/main.js +0 -0
  529. /package/framework/{v0.7.3 → v0.7.4}/lib/job/package.json +0 -0
  530. /package/framework/{v0.7.3 → v0.7.4}/lib/job-store.js +0 -0
  531. /package/framework/{v0.7.3 → v0.7.4}/lib/json-config-header/package.json +0 -0
  532. /package/framework/{v0.7.3 → v0.7.4}/lib/json-config-header/src/main.js +0 -0
  533. /package/framework/{v0.7.3 → v0.7.4}/lib/kv/package.json +0 -0
  534. /package/framework/{v0.7.3 → v0.7.4}/lib/kv/src/main.js +0 -0
  535. /package/framework/{v0.7.3 → v0.7.4}/lib/kv-store.js +0 -0
  536. /package/framework/{v0.7.3 → v0.7.4}/lib/lane/package.json +0 -0
  537. /package/framework/{v0.7.3 → v0.7.4}/lib/loading-state/package.json +0 -0
  538. /package/framework/{v0.7.3 → v0.7.4}/lib/loading-state/src/main.js +0 -0
  539. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/README.md +0 -0
  540. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/package.json +0 -0
  541. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/default/index.js +0 -0
  542. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/file/index.js +0 -0
  543. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/mq/index.js +0 -0
  544. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/mq/listener.js +0 -0
  545. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/containers/mq/speaker.js +0 -0
  546. /package/framework/{v0.7.3 → v0.7.4}/lib/logger/src/helper.js +0 -0
  547. /package/framework/{v0.7.3 → v0.7.4}/lib/maintenance/package.json +0 -0
  548. /package/framework/{v0.7.3 → v0.7.4}/lib/maintenance/src/main.js +0 -0
  549. /package/framework/{v0.7.3 → v0.7.4}/lib/math/index.js +0 -0
  550. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-dispatch/package.json +0 -0
  551. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-dispatch/src/main.js +0 -0
  552. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-http/package.json +0 -0
  553. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-http/src/main.js +0 -0
  554. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-server/package.json +0 -0
  555. /package/framework/{v0.7.3 → v0.7.4}/lib/mcp-server/src/main.js +0 -0
  556. /package/framework/{v0.7.3 → v0.7.4}/lib/merge/README.md +0 -0
  557. /package/framework/{v0.7.3 → v0.7.4}/lib/merge/package.json +0 -0
  558. /package/framework/{v0.7.3 → v0.7.4}/lib/merge/src/main.js +0 -0
  559. /package/framework/{v0.7.3 → v0.7.4}/lib/message-validator/package.json +0 -0
  560. /package/framework/{v0.7.3 → v0.7.4}/lib/message-validator/src/main.js +0 -0
  561. /package/framework/{v0.7.3 → v0.7.4}/lib/metrics/package.json +0 -0
  562. /package/framework/{v0.7.3 → v0.7.4}/lib/metrics/src/main.js +0 -0
  563. /package/framework/{v0.7.3 → v0.7.4}/lib/model.js +0 -0
  564. /package/framework/{v0.7.3 → v0.7.4}/lib/money/package.json +0 -0
  565. /package/framework/{v0.7.3 → v0.7.4}/lib/money/src/main.js +0 -0
  566. /package/framework/{v0.7.3 → v0.7.4}/lib/multipart/package.json +0 -0
  567. /package/framework/{v0.7.3 → v0.7.4}/lib/multipart/src/main.js +0 -0
  568. /package/framework/{v0.7.3 → v0.7.4}/lib/net-locality/package.json +0 -0
  569. /package/framework/{v0.7.3 → v0.7.4}/lib/net-locality/src/main.js +0 -0
  570. /package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-filters/README.md +0 -0
  571. /package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-filters/package.json +0 -0
  572. /package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-resolver/package.json +0 -0
  573. /package/framework/{v0.7.3 → v0.7.4}/lib/nunjucks-resolver/src/main.js +0 -0
  574. /package/framework/{v0.7.3 → v0.7.4}/lib/priority/package.json +0 -0
  575. /package/framework/{v0.7.3 → v0.7.4}/lib/priority/src/main.js +0 -0
  576. /package/framework/{v0.7.3 → v0.7.4}/lib/push/package.json +0 -0
  577. /package/framework/{v0.7.3 → v0.7.4}/lib/push/src/main.js +0 -0
  578. /package/framework/{v0.7.3 → v0.7.4}/lib/rate-limit/package.json +0 -0
  579. /package/framework/{v0.7.3 → v0.7.4}/lib/rate-limit/src/main.js +0 -0
  580. /package/framework/{v0.7.3 → v0.7.4}/lib/release-watch/package.json +0 -0
  581. /package/framework/{v0.7.3 → v0.7.4}/lib/release-watch/src/main.js +0 -0
  582. /package/framework/{v0.7.3 → v0.7.4}/lib/render-cache/package.json +0 -0
  583. /package/framework/{v0.7.3 → v0.7.4}/lib/render-cache-store.js +0 -0
  584. /package/framework/{v0.7.3 → v0.7.4}/lib/routing/README.md +0 -0
  585. /package/framework/{v0.7.3 → v0.7.4}/lib/routing/build.json +0 -0
  586. /package/framework/{v0.7.3 → v0.7.4}/lib/routing/package.json +0 -0
  587. /package/framework/{v0.7.3 → v0.7.4}/lib/routing-introspect/package.json +0 -0
  588. /package/framework/{v0.7.3 → v0.7.4}/lib/routing-introspect/src/main.js +0 -0
  589. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/package.json +0 -0
  590. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/backends/env.js +0 -0
  591. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/backends/exec.js +0 -0
  592. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/backends/file.js +0 -0
  593. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/declaration.js +0 -0
  594. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/env-file.js +0 -0
  595. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/main.js +0 -0
  596. /package/framework/{v0.7.3 → v0.7.4}/lib/secrets/src/sources.js +0 -0
  597. /package/framework/{v0.7.3 → v0.7.4}/lib/security-headers-emitter/package.json +0 -0
  598. /package/framework/{v0.7.3 → v0.7.4}/lib/security-headers-emitter/src/main.js +0 -0
  599. /package/framework/{v0.7.3 → v0.7.4}/lib/session-lifetime/package.json +0 -0
  600. /package/framework/{v0.7.3 → v0.7.4}/lib/session-lifetime/src/main.js +0 -0
  601. /package/framework/{v0.7.3 → v0.7.4}/lib/session-store.js +0 -0
  602. /package/framework/{v0.7.3 → v0.7.4}/lib/shell.js +0 -0
  603. /package/framework/{v0.7.3 → v0.7.4}/lib/sri/package.json +0 -0
  604. /package/framework/{v0.7.3 → v0.7.4}/lib/sri/src/main.js +0 -0
  605. /package/framework/{v0.7.3 → v0.7.4}/lib/state.js +0 -0
  606. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/package.json +0 -0
  607. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/local-cas.js +0 -0
  608. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/local-stream.js +0 -0
  609. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/local.js +0 -0
  610. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/main.js +0 -0
  611. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/meta-store.js +0 -0
  612. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/s3.js +0 -0
  613. /package/framework/{v0.7.3 → v0.7.4}/lib/storage/src/util.js +0 -0
  614. /package/framework/{v0.7.3 → v0.7.4}/lib/storage-store.js +0 -0
  615. /package/framework/{v0.7.3 → v0.7.4}/lib/swig-filters/README.md +0 -0
  616. /package/framework/{v0.7.3 → v0.7.4}/lib/swig-filters/package.json +0 -0
  617. /package/framework/{v0.7.3 → v0.7.4}/lib/swig-resolver/package.json +0 -0
  618. /package/framework/{v0.7.3 → v0.7.4}/lib/swig-resolver/src/main.js +0 -0
  619. /package/framework/{v0.7.3 → v0.7.4}/lib/template-loaders/package.json +0 -0
  620. /package/framework/{v0.7.3 → v0.7.4}/lib/template-loaders/src/loaders/http.js +0 -0
  621. /package/framework/{v0.7.3 → v0.7.4}/lib/template-loaders/src/loaders/memory.js +0 -0
  622. /package/framework/{v0.7.3 → v0.7.4}/lib/template-loaders/src/main.js +0 -0
  623. /package/framework/{v0.7.3 → v0.7.4}/lib/url/README.md +0 -0
  624. /package/framework/{v0.7.3 → v0.7.4}/lib/url/index.js +0 -0
  625. /package/framework/{v0.7.3 → v0.7.4}/lib/url/routing.json +0 -0
  626. /package/framework/{v0.7.3 → v0.7.4}/lib/uuid/package.json +0 -0
  627. /package/framework/{v0.7.3 → v0.7.4}/lib/uuid/src/main.js +0 -0
  628. /package/framework/{v0.7.3 → v0.7.4}/lib/validator.js +0 -0
  629. /package/framework/{v0.7.3 → v0.7.4}/lib/watcher/package.json +0 -0
  630. /package/framework/{v0.7.3 → v0.7.4}/lib/watcher/src/main.js +0 -0
  631. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-framing/package.json +0 -0
  632. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-framing/src/main.js +0 -0
  633. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-query/package.json +0 -0
  634. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-query/src/main.js +0 -0
  635. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-session/package.json +0 -0
  636. /package/framework/{v0.7.3 → v0.7.4}/lib/ws-session/src/main.js +0 -0
@@ -3092,6 +3092,42 @@ function escapeForJsonString(value) {
3092
3092
  });
3093
3093
  }
3094
3094
 
3095
+ /**
3096
+ * #B830 (2026-10-09) — render the control characters of a value as visible escapes before
3097
+ * it is written into a log or error message, so a client-supplied value cannot forge a
3098
+ * physical log line (CWE-117). The escaped set: C0 (U+0000-U+001F), DEL and C1
3099
+ * (U+007F-U+009F), and the line separators U+2028 / U+2029 — every character a terminal or
3100
+ * a line-based reader can take for a line break or a control sequence. `\n`, `\r`, `\t`
3101
+ * become the two-character sequences; any other character of the set becomes `\uXXXX`;
3102
+ * every other character is left untouched, so a value holding none comes back unchanged.
3103
+ * Deliberately duplicated — in the logger, core/server.js, core/server.isaac.js,
3104
+ * core/controller/controller.js, controller.render-swig.js, helpers/context.js, lib/lane,
3105
+ * lib/routing and the validator — the way `escapeForJsonString` is (#B600): the logger is
3106
+ * server-side only and two of those files are in the browser bundle, so no single
3107
+ * requireable home serves them all without adding a public API surface.
3108
+ * `test/lib/log-escape-parity-b830.test.js` fails when a copy drifts. The log redaction
3109
+ * reads these escapes back (`lib/logger/src/redact.js`, `decodeView`): a change of the set
3110
+ * here is a change there. On the server path (`backendInit` -> `validate`) a
3111
+ * warning of a rule can print a value of the request body; in the browser the same line goes to the
3112
+ * console only, where the escape is harmless.
3113
+ *
3114
+ * @inner
3115
+ * @param {*} value - Coerced with `String()`.
3116
+ * @returns {string} The value with its control characters shown as escapes.
3117
+ * @example
3118
+ * escapeLogControlChars('a\nb'); // the four characters a \ n b, on one physical line
3119
+ */
3120
+ function escapeLogControlChars(value) {
3121
+ return String(value).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, function (c) {
3122
+ switch (c) {
3123
+ case '\n': return '\\n';
3124
+ case '\r': return '\\r';
3125
+ case '\t': return '\\t';
3126
+ default : return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4);
3127
+ }
3128
+ });
3129
+ }
3130
+
3095
3131
  /**
3096
3132
  * Restores the field values spliced into a `query` rule's request body (#B600).
3097
3133
  *
@@ -4599,7 +4635,10 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet, culture) {
4599
4635
  // and stays literal for the grammar to refuse — it used to splice `undefined`.
4600
4636
  var fieldNames = [];
4601
4637
  for (var fieldKey in self) {
4602
- if ( self.hasOwnProperty(fieldKey) && self[fieldKey] && typeof(self[fieldKey]) == 'object' && ('value' in self[fieldKey]) ) {
4638
+ // #B837 — the built-in own-key test: a field named `hasOwnProperty` is an own
4639
+ // field object on the instance, and calling it threw « not a function ».
4640
+ // was: if ( self.hasOwnProperty(fieldKey) && self[fieldKey] && typeof(self[fieldKey]) == 'object' && ('value' in self[fieldKey]) )
4641
+ if ( Object.prototype.hasOwnProperty.call(self, fieldKey) && self[fieldKey] && typeof(self[fieldKey]) == 'object' && ('value' in self[fieldKey]) ) {
4603
4642
  fieldNames.push(fieldKey);
4604
4643
  }
4605
4644
  }
@@ -4689,7 +4728,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet, culture) {
4689
4728
  // A genuine authoring typo stays visible via the warning
4690
4729
  // without killing live validation. Fail-closed: the field is
4691
4730
  // treated as invalid on both the client and the server.
4692
- console.warn('[FormValidator] Could not evaluate condition `' + compiledCondition + '` - treating field as invalid.\n(grammar: <operand><op><operand>; operand ∈ number | "string" | true | false | null | undefined; op ∈ === !== == != < > <= >=)');
4731
+ console.warn('[FormValidator] Could not evaluate condition `' + escapeLogControlChars(compiledCondition) + '` - treating field as invalid.\n(grammar: <operand><op><operand>; operand ∈ number | "string" | true | false | null | undefined; op ∈ === !== == != < > <= >=)');
4693
4732
  isValid = false;
4694
4733
  } else {
4695
4734
  var _scsParseOperand = function(s) {
@@ -4725,7 +4764,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet, culture) {
4725
4764
  // #B600 — an operand that cannot be read fails the FIELD, like a
4726
4765
  // grammar mismatch: a throw here would leave through the catch
4727
4766
  // below and abort the whole validity pass.
4728
- console.warn('[FormValidator] Could not read an operand of `' + compiledCondition + '` - treating field as invalid.\n(' + _scsOperandErr.message + ')');
4767
+ console.warn('[FormValidator] Could not read an operand of `' + escapeLogControlChars(compiledCondition) + '` - treating field as invalid.\n(' + escapeLogControlChars(_scsOperandErr.message) + ')');
4729
4768
  isValid = false;
4730
4769
  } else {
4731
4770
  var _scsOp = _scsBinMatch[2];
@@ -5711,7 +5750,7 @@ function FormValidatorUtil(data, $fields, xhrOptions, fieldsSet, culture) {
5711
5750
  // Default validation on livecheck & invalid init value
5712
5751
  if (!val || val == '' || /NaN|Invalid Date/i.test(val) ) {
5713
5752
  if ( /NaN|Invalid Date/i.test(val) ) {
5714
- console.warn('[FormValidator::isDate] Provided value for field `'+ this.name +'` is not allowed: `'+ val +'`');
5753
+ console.warn('[FormValidator::isDate] Provided value for field `'+ escapeLogControlChars(this.name) +'` is not allowed: `'+ escapeLogControlChars(val) +'`');
5715
5754
  errors['isDate'] = replace(this.error || local.errorLabels['isDate'], this, 'isDate');
5716
5755
 
5717
5756
  }
@@ -6392,6 +6431,33 @@ function Routing() {
6392
6431
  notFound: {}
6393
6432
  };
6394
6433
 
6434
+ /**
6435
+ * #B830 (2026-10-09) — render the control characters of a value (C0 U+0000-U+001F, DEL
6436
+ * and C1 U+007F-U+009F, the line separators U+2028 / U+2029) as visible escapes
6437
+ * (`\n`/`\r`/`\t`, else `\uXXXX`) before it is written into a log message, so a request
6438
+ * value substituted into a route URL cannot forge a physical log line (CWE-117).
6439
+ * Declared inside `Routing()`: this file is also in the browser bundle, where a
6440
+ * top-level function of the same name would meet the validator's copy.
6441
+ * `test/lib/log-escape-parity-b830.test.js` fails when a copy drifts.
6442
+ *
6443
+ * @inner
6444
+ * @private
6445
+ * @param {*} value - Coerced with `String()`.
6446
+ * @returns {string} The value with its control characters shown as escapes.
6447
+ * @example
6448
+ * escapeLogControlChars('/a\nb'); // the five characters / a \ n b, on one physical line
6449
+ */
6450
+ function escapeLogControlChars(value) {
6451
+ return String(value).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, function (c) {
6452
+ switch (c) {
6453
+ case '\n': return '\\n';
6454
+ case '\r': return '\\r';
6455
+ case '\t': return '\\t';
6456
+ default: return '\\u' + ('000' + c.charCodeAt(0).toString(16)).slice(-4);
6457
+ }
6458
+ });
6459
+ }
6460
+
6395
6461
  self.getInstance = function(params) {
6396
6462
  return Routing.instance;
6397
6463
  }
@@ -7039,11 +7105,22 @@ function Routing() {
7039
7105
  * This is for server side use only
7040
7106
  * http://en.wikipedia.org/wiki/Regular_expression
7041
7107
  *
7042
- * @param {string} urlVar
7043
- * @param {string} urlVal
7044
- * @param {object} params
7108
+ * Before the requirement test, writes `urlVal` in place of the `urlVar` placeholder in
7109
+ * `params.param.path`, `.namespace` and `.title`, verbatim: through a function replacer,
7110
+ * so `$`-patterns in the value are not expanded (#B688).
7111
+ *
7112
+ * @param {string} urlVar - the rule's URL segment, e.g. `:id`
7113
+ * @param {string} urlVal - the request's URL segment at the same position
7114
+ * @param {object} params - the per-request route description (its `param` is a per-request copy)
7115
+ * @param {object} request
7116
+ * @param {object} response
7117
+ * @param {function} next
7045
7118
  *
7046
- * @returns {boolean} true|false - `true` if it fits
7119
+ * @returns {Promise<boolean>} `true` if it fits
7120
+ *
7121
+ * @example
7122
+ * // rule url `/user/:id`, param `{ title: 'User :id' }`, request `/user/$%60`
7123
+ * await fitsWithRequirements(':id', '$`', params, req, res, next); // params.param.title === 'User $`'
7047
7124
  *
7048
7125
  * @private
7049
7126
  * */
@@ -7073,14 +7150,21 @@ function Routing() {
7073
7150
 
7074
7151
  if (!_param.length) return false;
7075
7152
 
7153
+ // #B688 — the path, namespace and title rewrites take the URL value through a FUNCTION
7154
+ // replacer. A string replacement expanded `$`-patterns found in the value (`` $` `` the
7155
+ // text before the placeholder, `$&` the placeholder, `$'` the text after it, `$$` a `$`):
7156
+ // a request to `/user/$%60` turned `"title": "User :id"` into `User User `. The value is
7157
+ // now written verbatim, as the URL and `param.file` already were.
7076
7158
  // if custom path, path rewrite
7077
7159
  if (params.param.path && regex.test(params.param.path)) {
7078
- params.param.path = params.param.path.replace(regex, urlVal);
7160
+ // was: params.param.path = params.param.path.replace(regex, urlVal);
7161
+ params.param.path = params.param.path.replace(regex, function () { return urlVal; });
7079
7162
  }
7080
7163
 
7081
7164
  // if custom namespace, namespace rewrite
7082
7165
  if (params.param.namespace && regex.test(params.param.namespace)) {
7083
- params.param.namespace = params.param.namespace.replace(regex, urlVal);
7166
+ // was: params.param.namespace = params.param.namespace.replace(regex, urlVal);
7167
+ params.param.namespace = params.param.namespace.replace(regex, function () { return urlVal; });
7084
7168
  }
7085
7169
 
7086
7170
  // if custom file, file rewrite
@@ -7095,9 +7179,10 @@ function Routing() {
7095
7179
  _regex = null;
7096
7180
  }
7097
7181
 
7098
- // if custom title, title rewrite
7182
+ // if custom title, title rewrite (#B688: a function replacer, as for the path above)
7099
7183
  if (params.param.title && regex.test(params.param.title)) {
7100
- params.param.title = params.param.title.replace(regex, urlVal);
7184
+ // was: params.param.title = params.param.title.replace(regex, urlVal);
7185
+ params.param.title = params.param.title.replace(regex, function () { return urlVal; });
7101
7186
  }
7102
7187
 
7103
7188
 
@@ -7369,16 +7454,69 @@ function Routing() {
7369
7454
  return false
7370
7455
  }
7371
7456
 
7457
+ /**
7458
+ * String.prototype.replace callback shared by the placeholder writers: returns
7459
+ * `replacement.variable`, plus the `/` the match consumed when the regex matched `:id/`.
7460
+ * A function replacer writes the value verbatim, where a string replacement would expand
7461
+ * `$`-patterns in it (#B688). Set `replacement.variable` right before each `.replace()`.
7462
+ *
7463
+ * @inner
7464
+ * @param {string} matched - the matched placeholder, `:id` or `:id/`
7465
+ * @returns {string|*} the value, with a trailing `/` when `matched` had one
7466
+ *
7467
+ * @example
7468
+ * replacement.variable = '42';
7469
+ * '/users/:id/edit'.replace(/(:id\/|:id$)/g, replacement); // '/users/42/edit'
7470
+ */
7372
7471
  var replacement = function(matched){
7373
7472
  return ( /\/$/.test(matched) ? replacement.variable+ '/': replacement.variable )
7374
7473
  };
7375
7474
 
7475
+ /**
7476
+ * #B833 — a route placeholder value coming from the REQUEST (checkRouteParams is fed
7477
+ * `request[method]`, which merges the query string and body) is substituted VERBATIM into
7478
+ * `param.file` / `param.path` / `param.namespace`, AFTER the route requirement was matched
7479
+ * against the URL segment. A query value of the same name therefore overrides a
7480
+ * requirement-validated URL segment and can carry `..` into the rendered template path
7481
+ * (CWE-22, the CVE-2023-25345 class the render delegates guard). This predicate flags a value
7482
+ * that would ESCAPE when used as a path component: a `..` path segment, or a leading path
7483
+ * separator (an absolute path, which `path.resolve` honours over the root). Developer-authored
7484
+ * static prefixes in `param.file` (e.g. `../shared/:template`, reaching a sibling namespace
7485
+ * directory) are NOT request values and are never tested here — only the substituted value is.
7486
+ *
7487
+ * @inner
7488
+ * @param {*} value - the request-supplied placeholder value
7489
+ * @returns {boolean} true when the value would escape as a path component
7490
+ *
7491
+ * @example
7492
+ * _isUnsafePathValue('../../etc/passwd'); // true (`..` segment)
7493
+ * _isUnsafePathValue('/etc/passwd'); // true (leading separator — absolute path)
7494
+ * _isUnsafePathValue('estimate-add'); // false
7495
+ * _isUnsafePathValue('foo/bar'); // false (stays within the root once prefixed)
7496
+ */
7497
+ var _isUnsafePathValue = function(value){
7498
+ var v = (typeof value === 'string') ? value : String(value);
7499
+ return /(^|[\/\\])\.\.([\/\\]|$)/.test(v) || /^[\/\\]/.test(v);
7500
+ };
7501
+
7376
7502
  /**
7377
7503
  * checkRouteParams
7378
7504
  *
7379
- * @param {object} route
7380
- * @param {object} params
7505
+ * Fills the route's `:placeholders` from `params`: for each `param` entry declared as a
7506
+ * placeholder (`"id": ":id"`), writes `params.id` into `param.path`, `.title`,
7507
+ * `.namespace`, `.file` and the url. Every value goes through `replacement`, so it is
7508
+ * written verbatim (`$`-patterns are not expanded) and the `/` after a `:id/` placeholder
7509
+ * is kept (#B688).
7510
+ *
7511
+ * @inner
7512
+ * @param {object} route - the route to fill: a copy (getRoute clones the rule, the
7513
+ * request path clones `param` per request)
7514
+ * @param {object} params - placeholder values, keyed by variable name
7381
7515
  * @return {object} route - updated route object
7516
+ *
7517
+ * @example
7518
+ * // param `{ id: ':id', path: '/users/:id/edit', title: 'User :id' }`
7519
+ * checkRouteParams(route, { id: '42' }); // param.path '/users/42/edit', param.title 'User 42'
7382
7520
  */
7383
7521
  var checkRouteParams = function(route, params) {
7384
7522
  var variable = null
@@ -7401,15 +7539,38 @@ function Routing() {
7401
7539
 
7402
7540
  regex = new RegExp('(:'+variable+'/|:'+variable+'$)', 'g');
7403
7541
 
7542
+ // #B833 — fail closed BEFORE substituting: a request value that would escape as
7543
+ // a path component must never fill a filesystem-path param (`file`/`path`/
7544
+ // `namespace`). Only guard when THIS variable actually fills one of those (a `..`
7545
+ // in a value that fills only `title`/`url` is harmless). A traversal attempt
7546
+ // throws the same CVE-2023-25345 block the render delegates raise.
7547
+ if ( _isUnsafePathValue(params[variable]) ) {
7548
+ var _b833Ph = new RegExp(':' + variable.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + '(?:/|$)');
7549
+ if (
7550
+ ( typeof(route.param.file) != 'undefined' && _b833Ph.test(route.param.file) )
7551
+ || ( typeof(route.param.path) != 'undefined' && _b833Ph.test(route.param.path) )
7552
+ || ( typeof(route.param.namespace) != 'undefined' && _b833Ph.test(route.param.namespace) )
7553
+ ) {
7554
+ throw new Error('[CVE-2023-25345] Path traversal attempt blocked in route param `' + variable + '`');
7555
+ }
7556
+ }
7404
7557
 
7558
+ // #B688 — path, title and namespace go through `replacement`, as `file` and the
7559
+ // URL below already did. A string replacement expanded `$`-patterns found in the
7560
+ // value (`` $` `` `$&` `$'` `$$`) and dropped the `/` this regex consumes:
7561
+ // `/users/:id/edit` gave `/users/42edit`.
7562
+ replacement.variable = params[variable];
7405
7563
  if ( typeof(route.param.path) != 'undefined' && /\:/.test(route.param.path) ) {
7406
- route.param.path = route.param.path.replace( regex, params[variable]);
7564
+ // was: route.param.path = route.param.path.replace( regex, params[variable]);
7565
+ route.param.path = route.param.path.replace( regex, replacement );
7407
7566
  }
7408
7567
  if (typeof (route.param.title) != 'undefined' && /\:/.test(route.param.title)) {
7409
- route.param.title = route.param.title.replace( regex, params[variable]);
7568
+ // was: route.param.title = route.param.title.replace( regex, params[variable]);
7569
+ route.param.title = route.param.title.replace( regex, replacement );
7410
7570
  }
7411
7571
  if (typeof (route.param.namespace) != 'undefined' && /\:/.test(route.param.namespace)) {
7412
- route.param.namespace = route.param.namespace.replace( regex, params[variable]);
7572
+ // was: route.param.namespace = route.param.namespace.replace( regex, params[variable]);
7573
+ route.param.namespace = route.param.namespace.replace( regex, replacement );
7413
7574
  }
7414
7575
  // file is handle like url replacement (path is like pathname)
7415
7576
  if (typeof (route.param.file) != 'undefined' && /\:/.test(route.param.file)) {
@@ -7882,7 +8043,11 @@ function Routing() {
7882
8043
  var paramList = route.url
7883
8044
  .match(/(\:(.*)\/|\:(.*)$)/g)
7884
8045
  .map(function(el){ return el.replace(/\//g, ''); }).join(', ');
7885
- msg = '[ RoutingHelper::getRoute(rule[, bundle, method]) ] : route [ %r ] param placeholder not defined: `' + route.url + '` !\n Check your route description to compare requirements against param variables [ '+ paramList +']';
8046
+ // #B830 — `route.url` holds the request values already written into it, and the
8047
+ // list below is cut out of it: both are written with their control characters as
8048
+ // visible escapes, so neither can start a line of its own in the log
8049
+ // was: … param placeholder not defined: `' + route.url + '` !\n Check … [ '+ paramList +']';
8050
+ msg = '[ RoutingHelper::getRoute(rule[, bundle, method]) ] : route [ %r ] param placeholder not defined: `' + escapeLogControlChars(route.url) + '` !\n Check your route description to compare requirements against param variables [ '+ escapeLogControlChars(paramList) +']';
7886
8051
  msg = msg.replace(/\%r/, rule);
7887
8052
  var err = new Error(msg);
7888
8053
  console.warn( err );
@@ -8694,10 +8859,21 @@ function mergeEventProps(evt, proxiedEvent) {
8694
8859
  /**
8695
8860
  * addListener
8696
8861
  *
8862
+ * Attaches `callback` on `element` for `name` (a name ending in `.` is suffixed with the
8863
+ * element id; an array attaches one listener per name, or one per element) and records the
8864
+ * NAME in `gina.events` as the element's id — a name-to-id registry, which holds no callback.
8865
+ * Returns the callback, so a caller can ledger what it attached and detach it by reference
8866
+ * later (the validator's `$form.boundListeners`, #B585).
8867
+ *
8697
8868
  * @param {object} target
8698
- * @param {object} element
8869
+ * @param {object|array} element
8699
8870
  * @param {string|array} name
8700
8871
  * @param {callback} callback
8872
+ *
8873
+ * @returns {callback} callback - the attached callback
8874
+ *
8875
+ * @example
8876
+ * $form.boundListeners.push({ el: $el, evt: 'change', fn: addListener(gina, $el, 'change', onChange) });
8701
8877
  */
8702
8878
  function addListener(target, element, name, callback) {
8703
8879
 
@@ -8740,6 +8916,7 @@ function addListener(target, element, name, callback) {
8740
8916
  }
8741
8917
  }
8742
8918
 
8919
+ return callback;
8743
8920
  }
8744
8921
  /**
8745
8922
  * triggerEvent
@@ -9463,6 +9640,24 @@ function handleXhr(xhr, $el, options, require) {
9463
9640
  //return xhr;
9464
9641
  }
9465
9642
 
9643
+ /**
9644
+ * removeListener
9645
+ *
9646
+ * Hands `callback` to `element.removeEventListener(name, callback)` and deletes the
9647
+ * `gina.events[name]` registry key. Two facts of this contract bite (#B303, #B585):
9648
+ * - with no 4th argument NOTHING is detached (`removeEventListener(name, undefined)` is a
9649
+ * no-op) — only the registry key goes; and the key is deleted whatever element was given,
9650
+ * the registry being keyed by name alone;
9651
+ * - the 4th argument is a COMPLETION CALLBACK as much as a handler: it is invoked once, with
9652
+ * no arguments, after the removal. Never hand it a DOM handler expecting an event.
9653
+ * To detach what a plugin attached, keep the reference `addListener` returns and remove it
9654
+ * directly, as the validator's `unbindForm` ledger drain does.
9655
+ *
9656
+ * @param {object} target
9657
+ * @param {object|array} element
9658
+ * @param {string} name
9659
+ * @param {callback} [callback] - the completion callback, also handed to the DOM removal
9660
+ */
9466
9661
  function removeListener(target, element, name, callback) {
9467
9662
  if (typeof(target.event) != 'undefined' && target.event.isTouchSupported && /^(click|mouseout|mouseover)/.test(name) && target.event[name].indexOf(element) != -1) {
9468
9663
  target.event[name].splice(target.event[name].indexOf(element), 1)
@@ -9534,6 +9729,23 @@ function removeListener(target, element, name, callback) {
9534
9729
 
9535
9730
 
9536
9731
 
9732
+ /**
9733
+ * on
9734
+ *
9735
+ * Registers a consumer handler for a plugin event under `<event>.<id>` on the handle's target,
9736
+ * once per name (a second registration under a name already in `gina.events` is dropped). The
9737
+ * attached wrapper is recorded on the handle (`this.consumerListeners`, #B585) so the plugin can
9738
+ * detach it when the handle is destroyed — the validator's `destroy()` does; its `reBind()`
9739
+ * leaves these handlers in place.
9740
+ *
9741
+ * @param {string} event - the event name (`success`, `error`, `submit`, `ready`, …)
9742
+ * @param {callback} cb - `function (event, data)`
9743
+ *
9744
+ * @returns {object} this - chainable
9745
+ *
9746
+ * @example
9747
+ * gina.validator.$forms['signup'].on('success', function (e, data) { … });
9748
+ */
9537
9749
  function on(event, cb) {
9538
9750
 
9539
9751
  if (!this.plugin) throw new Error('No `plugin` reference found for this event: `'+ event);
@@ -9570,6 +9782,8 @@ function on(event, cb) {
9570
9782
 
9571
9783
  if (!gina.events[event]) {
9572
9784
 
9785
+ if ( !Array.isArray(this.consumerListeners) ) { this.consumerListeners = []; }
9786
+ this.consumerListeners.push({ el: $target, evt: event, fn:
9573
9787
  addListener(gina, $target, event, function(e) {
9574
9788
 
9575
9789
  //if ( typeof(e.defaultPrevented) != 'undefined' && e.defaultPrevented)
@@ -9598,7 +9812,7 @@ function on(event, cb) {
9598
9812
  cb(e, data);
9599
9813
 
9600
9814
  //triggerEvent(gina, e.currentTarget, e.type);
9601
- });
9815
+ }) });
9602
9816
 
9603
9817
  if (this.initialized && !this.isReady)
9604
9818
  triggerEvent(gina, $target, 'init.' + id);
@@ -10087,6 +10301,26 @@ function PrototypesHelper(instance) {
10087
10301
  }
10088
10302
 
10089
10303
  if ( typeof(Object.count) == 'undefined' ) {
10304
+ /**
10305
+ * Object.prototype.count — the number of the receiver's own enumerable properties:
10306
+ * the keys of an object, the indices of an array. Installed here only when no
10307
+ * `count` exists yet: in a bundle process `utils/prototypes.js` has installed its
10308
+ * own copy first, so this is the copy the browser bundle carries.
10309
+ *
10310
+ * Each key is tested with the built-in `Object.prototype.hasOwnProperty`, reached
10311
+ * through `.call` (#B837). `this.hasOwnProperty(prop)` was an ordinary property
10312
+ * lookup: an own key of that name that is not a function (a form field named
10313
+ * `hasOwnProperty`) made the call throw on the first key, as did an object with
10314
+ * no prototype (`Object.create(null)`), and the catch returned the count so far, 0.
10315
+ *
10316
+ * Changes made here must be reflected in:
10317
+ * - gina/utils/prototypes.js (the copy a bundle process installs)
10318
+ *
10319
+ * @returns {number} The number of own enumerable properties.
10320
+ * @example
10321
+ * ({ a: 1, b: 2 }).count(); // → 2
10322
+ * Object.prototype.count.call({ hasOwnProperty: 'x', a: 1 }); // → 2
10323
+ */
10090
10324
  Object.defineProperty( Object.prototype, 'count', {
10091
10325
  writable: true,
10092
10326
  enumerable: false,
@@ -10098,8 +10332,10 @@ function PrototypesHelper(instance) {
10098
10332
  var self = this;
10099
10333
  if (this instanceof String) self = JSON.parse(this);
10100
10334
 
10335
+ // #B837 — the built-in own-key test, which no own key of the receiver can shadow
10336
+ // was: for (var prop in this) if (this.hasOwnProperty(prop)) ++i;
10101
10337
  for (var prop in this)
10102
- if (this.hasOwnProperty(prop)) ++i;
10338
+ if (Object.prototype.hasOwnProperty.call(this, prop)) ++i;
10103
10339
 
10104
10340
  return i;
10105
10341
  } catch (err) {
@@ -12840,7 +13076,16 @@ function DataHelper(){
12840
13076
  let _key = key[k];
12841
13077
  if (i == k) {
12842
13078
  // Array or Object ?
12843
- if ( typeof(obj[ key[k] ]) == 'undefined' || typeof(obj[ key[k] ]) == 'string' ) {
13079
+ // #B792 — was: if ( typeof(obj[ key[k] ]) == 'undefined' || typeof(obj[ key[k] ]) == 'string' ) {
13080
+ // A slot an earlier pair set to `null` (a JSON value like `a=[null]`, or a planted
13081
+ // array/object element) cannot hold children; descending into it below dereferenced
13082
+ // `null` and threw `Cannot read properties of null`. On the GET/HEAD `inheritedData`
13083
+ // path that throw had no try/catch and exited the bundle process (the #B591 SIGTERM
13084
+ // class — #B591 removed a DIFFERENT null seed and left this one). Treat a null slot
13085
+ // like a string one: replace it with a fresh container (last-write-wins) and descend
13086
+ // safely. A non-null primitive (number/boolean) still boxes and no-ops as before, so
13087
+ // only the crashing null case changes. The validator client twin carries the same guard.
13088
+ if ( obj[ key[k] ] === null || typeof(obj[ key[k] ]) == 'undefined' || typeof(obj[ key[k] ]) == 'string' ) {
12844
13089
  if ( Array.isArray(obj) ) {
12845
13090
  // index
12846
13091
  // _key = obj.length;
@@ -15841,7 +16086,12 @@ function ValidatorPlugin(rules, data, formId, culture) {
15841
16086
  let _key = key[k];
15842
16087
  if (i == k) {
15843
16088
  // Array or Object ?
15844
- if ( typeof(obj[ key[k] ]) == 'undefined' || typeof(obj[ key[k] ]) == 'string' ) {
16089
+ // #B792 — was: if ( typeof(obj[ key[k] ]) == 'undefined' || typeof(obj[ key[k] ]) == 'string' ) {
16090
+ // Byte-parity twin of the server helper `helpers/data parseLocalObj`: a slot an
16091
+ // earlier segment set to `null` cannot hold children, so descending into it threw.
16092
+ // Treat null like a string slot — replace with a fresh container and descend. Pinned
16093
+ // identical to the server by test/core/validator-send-formdata-nesting.test.js.
16094
+ if ( obj[ key[k] ] === null || typeof(obj[ key[k] ]) == 'undefined' || typeof(obj[ key[k] ]) == 'string' ) {
15845
16095
  if ( Array.isArray(obj) ) {
15846
16096
  // index
15847
16097
  _key = ~~key[k];
@@ -18178,10 +18428,23 @@ function ValidatorPlugin(rules, data, formId, culture) {
18178
18428
  , maxWidth = null
18179
18429
  , ratio = null
18180
18430
  ;
18431
+ // #B859 — the staging answer, by file index, on the file input: a reset names the files
18432
+ // it removes from these entries (`originalFilename`, and the preview's own when there is
18433
+ // one), so a file that got no preview <img> — not an image, no `preview` — is removed too.
18434
+ if ( $uploadTriger ) {
18435
+ $uploadTriger.stagedFiles = files;
18436
+ }
18181
18437
  for (var f = 0, fLen = files.length; f<fLen; ++f) {
18182
18438
 
18183
18439
  // creating reset link
18184
- let resetLinkId = $previewContainer.id.replace(/\-preview/, '-'+f+'-reset-trigger');
18440
+ // #B861 — the id is `<file input id>-<f>-reset-trigger`, the one that
18441
+ // `bindUploadResetOrDeleteTrigger` binds. It was derived from the preview container's
18442
+ // id by replacing `-preview`, which gives that id only for the default container
18443
+ // `<input id>-preview`: with a custom `data-gina-form-upload-preview` id the result was
18444
+ // the container's own id, so the container was taken for the reset link (« Reset »
18445
+ // written inside it, its classes changed) and no reset control was bound.
18446
+ // was: let resetLinkId = $previewContainer.id.replace(/\-preview/, '-'+f+'-reset-trigger');
18447
+ let resetLinkId = $uploadTriger.id + '-' + f + '-reset-trigger';
18185
18448
  let resetLinkNeedToBeAdded = false;
18186
18449
  let $resetLink = document.getElementById(resetLinkId);
18187
18450
  let defaultClassNameArr = ['reset','js-upload-reset'];
@@ -18285,10 +18548,28 @@ function ValidatorPlugin(rules, data, formId, culture) {
18285
18548
  || key == 'preview' && typeof(files[f][key]) == 'undefined'
18286
18549
  || /(height|width)/i.test(key) && !/^image/.test(files[f].mime)
18287
18550
  ) {
18551
+ // #B791 — the preview slot is a sub-field MAP, not a flat input (since #B459):
18552
+ // it has no `.tagName`, so the getElementById(.id) removal was a silent no-op
18553
+ // on it, and on an EDIT form the declared [preview][*] inputs kept the REPLACED
18554
+ // file's values and were posted with the new file. Detect the slot by SHAPE (an
18555
+ // element has a tagName; the map does not), NOT by the key name — this keeps the
18556
+ // branch a structural sibling of the flat removal and leaves #B459's name-keyed
18557
+ // source/dist pins untouched. For the map, CLEAR every declared sub-field — the
18558
+ // documented "left empty" contract (file-uploads.md § Persisting the preview);
18559
+ // for a flat input (height/width), keep the original removal.
18288
18560
  if ( /(preview|height|width)/i.test(key) ) {
18289
- $elIgnored = document.getElementById(fieldsObjectList[key].id);
18290
- if ( $elIgnored )
18291
- $elIgnored.parentNode.removeChild($elIgnored);
18561
+ if ( fieldsObjectList[key] && !fieldsObjectList[key].tagName ) {
18562
+ for (var subFieldToClear in fieldsObjectList[key]) {
18563
+ if ( fieldsObjectList[key][subFieldToClear]
18564
+ && typeof(fieldsObjectList[key][subFieldToClear].value) != 'undefined' ) {
18565
+ fieldsObjectList[key][subFieldToClear].value = '';
18566
+ }
18567
+ }
18568
+ } else {
18569
+ $elIgnored = document.getElementById(fieldsObjectList[key].id);
18570
+ if ( $elIgnored )
18571
+ $elIgnored.parentNode.removeChild($elIgnored);
18572
+ }
18292
18573
  }
18293
18574
  continue;
18294
18575
  }
@@ -18304,6 +18585,18 @@ function ValidatorPlugin(rules, data, formId, culture) {
18304
18585
  // handle preview
18305
18586
  if ( key == 'preview' ) {
18306
18587
 
18588
+ // #B791 — clear every DECLARED sub-field the response's preview does NOT
18589
+ // carry, so a PARTIAL preview on an edit form cannot leave a replaced file's
18590
+ // stale value behind (the "left empty" contract); the loop below then fills
18591
+ // the ones it does carry.
18592
+ for (var previewKeyToReset in fieldsObjectList[key]) {
18593
+ if ( fieldsObjectList[key][previewKeyToReset]
18594
+ && typeof(fieldsObjectList[key][previewKeyToReset].value) != 'undefined'
18595
+ && typeof(files[f][key][previewKeyToReset]) == 'undefined' ) {
18596
+ fieldsObjectList[key][previewKeyToReset].value = '';
18597
+ }
18598
+ }
18599
+
18307
18600
  for (var previewKey in files[f][key]) {
18308
18601
  if ( typeof(files[f][key][previewKey]) != 'undefined' && typeof(fieldsObjectList[key][previewKey]) != 'undefined' ) {
18309
18602
  fieldsObjectList[key][previewKey].value = files[f][key][previewKey];
@@ -18403,6 +18696,330 @@ function ValidatorPlugin(rules, data, formId, culture) {
18403
18696
  }
18404
18697
  }
18405
18698
 
18699
+ /**
18700
+ * getUploadFieldPrefix — the prefix of the hidden `<prefix>[i][…]` fields a file input's
18701
+ * staged files write into its form: `data-gina-form-upload-prefix`, else the input's name,
18702
+ * else `files`. The one rule for building those fields and for removing them.
18703
+ *
18704
+ * @inner
18705
+ * @private
18706
+ * @param {HTMLInputElement} $input - the file input
18707
+ * @returns {string} the field prefix
18708
+ *
18709
+ * @example
18710
+ * getUploadFieldPrefix(document.getElementById('avatar')); // 'avatar'
18711
+ */
18712
+ var getUploadFieldPrefix = function($input) {
18713
+ return $input.getAttribute('data-gina-form-upload-prefix') || $input.name || $input.getAttribute('name') || 'files';
18714
+ };
18715
+
18716
+ /**
18717
+ * getUploadFileNodes — the file nodes of an upload preview container, in document order.
18718
+ *
18719
+ * A file node is an element carrying `data-upload-original-filename` (gina writes it on the
18720
+ * previews it renders, and a page marks its own node for a file shown without an image with
18721
+ * it), or an `<img>` that is a child of the container or of one of its `<li>` children (the
18722
+ * `<li>` gina wraps each preview in when the container is a `<ul>`). A node inside a file node
18723
+ * belongs to it and is not a file of its own.
18724
+ *
18725
+ * @inner
18726
+ * @private
18727
+ * @param {HTMLElement|null} $container - the preview container
18728
+ * @returns {Array<HTMLElement>} a static list, safe to walk while its nodes are removed
18729
+ *
18730
+ * @example
18731
+ * getUploadFileNodes(document.getElementById('avatar-preview')); // [ <img>, <a data-upload-original-filename="cv.pdf"> ]
18732
+ */
18733
+ var getUploadFileNodes = function($container) {
18734
+ var fileNodes = [];
18735
+ if ( !$container || typeof($container.querySelectorAll) != 'function' ) {
18736
+ return fileNodes;
18737
+ }
18738
+ var $nodes = $container.querySelectorAll('*'), $node = null, $parent = null, isFileNode = false, k = 0;
18739
+ for (var n = 0, nLen = $nodes.length; n < nLen; ++n) {
18740
+ $node = $nodes[n];
18741
+ $parent = $node.parentNode;
18742
+ isFileNode = $node.hasAttribute('data-upload-original-filename')
18743
+ || /^img$/i.test($node.tagName)
18744
+ && ( $parent === $container || $parent && /^li$/i.test($parent.tagName) && $parent.parentNode === $container );
18745
+ if ( !isFileNode ) {
18746
+ continue;
18747
+ }
18748
+ for (k = 0; k < fileNodes.length; ++k) {
18749
+ if ( fileNodes[k].contains($node) ) {
18750
+ break;
18751
+ }
18752
+ }
18753
+ if ( k == fileNodes.length ) {
18754
+ fileNodes.push($node);
18755
+ }
18756
+ }
18757
+ return fileNodes;
18758
+ };
18759
+
18760
+ /**
18761
+ * removeUploadEntryFields — #B858/#B862: removes from a file input's form the controls of one
18762
+ * of its files, `<prefix>[index]…` (except those marked `data-gina-form-upload-is-locked`), and
18763
+ * keeps them on the input so that the next selection puts them back
18764
+ * (see restoreRemovedUploadFields): a page's declared fields — `[preview][*]` sub-fields, a
18765
+ * caption — are part of the form, not of the file.
18766
+ *
18767
+ * @inner
18768
+ * @private
18769
+ * @param {HTMLInputElement} $uploadTrigger - the file input
18770
+ * @param {string} fieldPrefix - see getUploadFieldPrefix
18771
+ * @param {number} index - the file's index in the input's selection
18772
+ * @returns {number} the count of removed controls
18773
+ *
18774
+ * @example
18775
+ * removeUploadEntryFields($input, 'avatar', 0); // 10 — avatar[0][name] … avatar[0][mime]
18776
+ */
18777
+ var removeUploadEntryFields = function($uploadTrigger, fieldPrefix, index) {
18778
+ var $form = $uploadTrigger.form || null;
18779
+ if ( !$form ) {
18780
+ return 0;
18781
+ }
18782
+ var re = new RegExp('^'+ (fieldPrefix +'['+ index +']').replace(/[.*+?^${}()|[\]\\\-]/g, '\\$&'))
18783
+ , removed = 0
18784
+ , $field = null
18785
+ , isLocked = null
18786
+ ;
18787
+ if ( !$uploadTrigger.removedUploadFields ) {
18788
+ $uploadTrigger.removedUploadFields = {};
18789
+ }
18790
+ for (var d = 0, dLen = $form.length; d < dLen; d++) {
18791
+ $field = $form[d];
18792
+ // data-gina-form-upload-is-locked
18793
+ // this exception prevent `tagged datas` to be deleted on image delete
18794
+ isLocked = ( $field.dataset ) ? $field.dataset.ginaFormUploadIsLocked || false : false;
18795
+ if ( re.test($field.name) && !/true/i.test(isLocked) ) {
18796
+ if ( !$uploadTrigger.removedUploadFields[index] ) {
18797
+ $uploadTrigger.removedUploadFields[index] = [];
18798
+ }
18799
+ $uploadTrigger.removedUploadFields[index].push({ $field: $field, $parent: $field.parentNode, $next: $field.nextSibling });
18800
+ if ( /^hidden$/i.test($field.type) ) {
18801
+ $field.value = '';
18802
+ }
18803
+ $field.remove();
18804
+ removed++;
18805
+ dLen--;
18806
+ d--;
18807
+ }
18808
+ }
18809
+ return removed;
18810
+ };
18811
+
18812
+ /**
18813
+ * restoreRemovedUploadFields — #B858: puts back into a file input's form the controls of file
18814
+ * `index` that a reset or a delete removed (see removeUploadEntryFields), where they were and
18815
+ * in their order, a hidden one emptied. A control the page has meanwhile put back under the
18816
+ * same name is kept instead.
18817
+ *
18818
+ * @inner
18819
+ * @private
18820
+ * @param {HTMLInputElement} $el - the file input
18821
+ * @param {number} index - the file's index in the new selection
18822
+ * @returns {number} the count of restored controls
18823
+ *
18824
+ * @example
18825
+ * restoreRemovedUploadFields($input, 0); // 4 — the declared avatar[0][preview][…] inputs
18826
+ */
18827
+ var restoreRemovedUploadFields = function($el, index) {
18828
+ var stash = ( $el.removedUploadFields ) ? $el.removedUploadFields[index] : null;
18829
+ if ( !stash || !$el.form ) {
18830
+ return 0;
18831
+ }
18832
+ delete $el.removedUploadFields[index];
18833
+ var $form = $el.form, restored = 0, entry = null, isTaken = false;
18834
+ // last removed first: each control then goes back before a sibling already in place
18835
+ for (var s = stash.length - 1; s >= 0; --s) {
18836
+ entry = stash[s];
18837
+ isTaken = false;
18838
+ for (var c = 0, cLen = $form.length; c < cLen; ++c) {
18839
+ if ( $form[c].name == entry.$field.name ) {
18840
+ isTaken = true;
18841
+ break;
18842
+ }
18843
+ }
18844
+ if ( isTaken ) {
18845
+ continue;
18846
+ }
18847
+ if ( /^hidden$/i.test(entry.$field.type) ) {
18848
+ entry.$field.value = '';
18849
+ }
18850
+ if ( entry.$parent && entry.$parent.isConnected ) {
18851
+ entry.$parent.insertBefore(entry.$field, ( entry.$next && entry.$next.parentNode === entry.$parent ) ? entry.$next : null);
18852
+ } else {
18853
+ $form.appendChild(entry.$field);
18854
+ }
18855
+ restored++;
18856
+ }
18857
+ return restored;
18858
+ };
18859
+
18860
+ /**
18861
+ * buildUploadHiddenFields — #B858: the hidden `<prefix>[i][…]` fields of a file input's
18862
+ * selection, in its form, by file index: the inputs the form holds are reused (declared by the
18863
+ * page, or written by an earlier selection), the ones a reset removed come back, and the
18864
+ * missing mandatory ones are created, empty, for the staging answer to fill. Run on EVERY
18865
+ * selection: building them only with the input's virtual upload form left a selection made
18866
+ * after a reset with no field in the form, and one with more files than the first with none for
18867
+ * its new files.
18868
+ *
18869
+ * @inner
18870
+ * @private
18871
+ * @param {HTMLInputElement} $el - the file input
18872
+ * @param {string} fieldPrefix - see getUploadFieldPrefix
18873
+ * @param {number} filesLength - the count of files selected
18874
+ * @param {Array<string>} mandatoryFields - the metadata keys every file gets an input for
18875
+ * @param {boolean} bindResetTriggers - binds each file's reset trigger when it is already in
18876
+ * the page (the selection that creates the virtual upload form)
18877
+ * @returns {Array<object>} by file index, the field map the staging answer fills
18878
+ *
18879
+ * @example
18880
+ * buildUploadHiddenFields($input, 'avatar', 1, mandatoryFields, true)[0].location; // <input name="avatar[0][location]">
18881
+ */
18882
+ var buildUploadHiddenFields = function($el, fieldPrefix, filesLength, mandatoryFields, bindResetTriggers) {
18883
+ var hiddenFields = []
18884
+ , formInputsFields = $el.form.getElementsByTagName('INPUT')
18885
+ , fieldType = null
18886
+ , hiddenField = null
18887
+ , _userName = null
18888
+ , _name = null
18889
+ , _nameRe = null
18890
+ , subPrefix = null
18891
+ , $newVirtualField = null
18892
+ ;
18893
+ for (var _f = 0, _fLen = filesLength; _f < _fLen; ++_f) { // for each file
18894
+ // binding upload reset trigger
18895
+ if ( bindResetTriggers ) {
18896
+ bindUploadResetOrDeleteTrigger('reset', $el, _f);
18897
+ }
18898
+ hiddenFields[_f] = null;
18899
+ // the fields a reset or a delete took out of the form come back for this file
18900
+ restoreRemovedUploadFields($el, _f);
18901
+ subPrefix = fieldPrefix + '['+ _f +']';
18902
+ _nameRe = new RegExp('^'+subPrefix.replace(/\[/g, '\\[').replace(/\]/g, '\\]'));
18903
+ // collecting existing DOM fields
18904
+ for (var h = 0, hLen = formInputsFields.length; h < hLen; ++h) {
18905
+ fieldType = formInputsFields[h].getAttribute('type');
18906
+ hiddenField = null;
18907
+ _name = null, _userName = null;
18908
+ // #B731 — read once from the file input, above
18909
+ // was: errorField= formInputsFields[h].getAttribute('data-gina-form-upload-error') || fieldId + '-error' || null;
18910
+
18911
+ if (fieldType && /hidden/i.test(fieldType) ) {
18912
+ hiddenField = formInputsFields[h];
18913
+
18914
+ _name = ( /\[\w+\]$/i.test(hiddenField.name) )
18915
+ ? hiddenField.name.match(/\[\w+\]$/)[0].replace(/\[|\]/g, '')
18916
+ : hiddenField.name;
18917
+ _userName = ( /\[\w+\]$/i.test(hiddenField.name) )
18918
+ ? hiddenField.name.match(/\[\w+\]$/)[0].replace(/\[|\]/g, '')
18919
+ : hiddenField.name;
18920
+
18921
+ // mandatory informations
18922
+ if (
18923
+ hiddenField
18924
+ && typeof(_name) != 'undefiend'
18925
+ && mandatoryFields.indexOf( _name ) > -1
18926
+ && _nameRe.test( hiddenField.name )
18927
+ ) {
18928
+
18929
+ if (!hiddenFields[_f] )
18930
+ hiddenFields[_f] = {};
18931
+
18932
+ if ( /\[preview\]/i.test(hiddenField.name) ) {
18933
+ if ( typeof(hiddenFields[_f].preview) == 'undefined' )
18934
+ hiddenFields[_f].preview = {};
18935
+
18936
+ hiddenFields[_f].preview[_name] = hiddenField;
18937
+ } else {
18938
+ hiddenFields[_f][_name] = hiddenField;
18939
+ }
18940
+ } else if (
18941
+ hiddenField
18942
+ && typeof(_name) != 'undefiend'
18943
+ && mandatoryFields.indexOf( _name ) < 0
18944
+ && _nameRe.test( hiddenField.name )
18945
+ ) { // defined by user
18946
+ if (!hiddenFields[_f] )
18947
+ hiddenFields[_f] = {};
18948
+
18949
+ if ( /\[preview\]/i.test(hiddenField.name) ) {
18950
+ if ( typeof(hiddenFields[_f].preview) == 'undefined' )
18951
+ hiddenFields[_f].preview = {};
18952
+
18953
+ hiddenFields[_f].preview[_userName] = hiddenField;
18954
+ } else {
18955
+ hiddenFields[_f][_userName] = hiddenField;
18956
+ }
18957
+ }
18958
+ }
18959
+ }
18960
+
18961
+ // completing by adding non-declared mandatoring fields in the DOM: all but preview
18962
+ for (var m = 0, mLen = mandatoryFields.length; m < mLen; ++m) {
18963
+ // optional, must be set by user
18964
+ // needs recheck
18965
+ if (!hiddenFields[_f] )
18966
+ hiddenFields[_f] = {};
18967
+
18968
+ if ( typeof(hiddenFields[_f][ mandatoryFields[m] ]) == 'undefined' ) {
18969
+ // #B459 — `preview` is the one slot that is never a flat input:
18970
+ // its value is an OBJECT (`{location, uri, tmpUri, width, height}`),
18971
+ // which an input's `.value` can only hold as "[object Object]".
18972
+ // A form that declares no `[preview][...]` sub-fields gets an
18973
+ // EMPTY sub-field map instead, so the fill loop still visits the
18974
+ // key (the nested thumbnail is rendered from there) and posts
18975
+ // nothing for it — the documented field set. Declaring the
18976
+ // sub-fields stays the opt-in for persisting the preview.
18977
+ if ( mandatoryFields[m] == 'preview' ) {
18978
+ hiddenFields[_f].preview = {};
18979
+ continue;
18980
+ }
18981
+
18982
+ _name = fieldPrefix +'['+ _f +']['+ mandatoryFields[m] +']';
18983
+ // create input & add it to the form
18984
+ $newVirtualField = document.createElement('input');
18985
+ $newVirtualField.type = 'hidden';
18986
+ $newVirtualField.id = 'input.' + uuid();
18987
+ $newVirtualField.name = _name;
18988
+ $newVirtualField.value = '';
18989
+
18990
+ $el.form.appendChild($newVirtualField);
18991
+ hiddenFields[_f][ mandatoryFields[m] ] = $el.form[$el.form.length-1];// last added
18992
+ }
18993
+
18994
+ }
18995
+
18996
+ } // EO for files
18997
+ return hiddenFields;
18998
+ };
18999
+
19000
+ /**
19001
+ * dropEmptyUploadPreviewItem — removes the `<li>` a reset or a delete left empty in a `<ul>`
19002
+ * preview container (gina wraps each preview, and each reset link it renders, in one).
19003
+ *
19004
+ * @inner
19005
+ * @private
19006
+ * @param {HTMLElement|null} $item - the parent of the node just removed
19007
+ * @param {HTMLElement|null} $container - the preview container
19008
+ * @returns {void}
19009
+ */
19010
+ var dropEmptyUploadPreviewItem = function($item, $container) {
19011
+ if (
19012
+ $item
19013
+ && $container
19014
+ && $item !== $container
19015
+ && $item.parentNode === $container
19016
+ && /^li$/i.test($item.tagName)
19017
+ && !$item.children.length
19018
+ ) {
19019
+ $item.remove();
19020
+ }
19021
+ };
19022
+
18406
19023
  /**
18407
19024
  * restoreUploadAffordance
18408
19025
  *
@@ -18440,210 +19057,241 @@ function ValidatorPlugin(rules, data, formId, culture) {
18440
19057
  /**
18441
19058
  * onUploadResetOrDelete
18442
19059
  *
18443
- * Removes the previewed file(s): notifies the server first (the removal
18444
- * XHR is sent BEFORE any DOM removal — the preview DOM feeds the payload),
18445
- * then removes the preview image and its reset/delete link from the DOM,
18446
- * restores the upload input's add-affordance (see restoreUploadAffordance)
18447
- * and, when defined, invokes the `data-gina-form-upload-on-reset` /
18448
- * `data-gina-form-upload-on-delete` callback — a bare identifier
18449
- * registered on `window` — once per action with
18450
- * `{ $upload, bindingType, files }`.
18451
- *
18452
- * @param {object} $uploadTrigger
19060
+ * Removes the input's file(s): the staged ones (`reset`: its selection) or the stored ones
19061
+ * (`delete`: the entries the bind-time scan recorded). Each file is reached by its index — its
19062
+ * reset or delete link, its preview node(s) (see getUploadFileNodes) and its hidden
19063
+ * `<prefix>[index]…` fields (see removeUploadEntryFields) — and not by walking the preview's
19064
+ * `<img>` children, so a file shown without an image is removed too (#B859). The server is
19065
+ * notified first, in ONE request naming every removed file (the removal XHR is sent BEFORE any
19066
+ * DOM removal), then the link, the preview node(s) and the fields go, the upload input's
19067
+ * add-affordance comes back (see restoreUploadAffordance) and, when defined, the
19068
+ * `data-gina-form-upload-on-reset` / `data-gina-form-upload-on-delete` callback — a bare
19069
+ * identifier registered on `window` — runs once per action with `{ $upload, bindingType, files }`.
19070
+ *
19071
+ * @param {object} $uploadTrigger - the file input
18453
19072
  * @param {string} bindingType - `reset` or `delete`
18454
- * @returns
19073
+ * @returns {void}
18455
19074
  */
18456
19075
  var onUploadResetOrDelete = function($uploadTrigger, bindingType) {
18457
19076
  console.debug(bindingType + ' input files');
18458
19077
  var isOnResetMode = ( /reset/i.test(bindingType) ) ? true : false
18459
- , uploadPreviewId = $uploadTrigger.id +'-preview'
19078
+ // #B861 — the container the input names, resolved as a selection resolves it. It was
19079
+ // always `<input id>-preview`, so with a custom `data-gina-form-upload-preview` id it was
19080
+ // null, and reading its children threw.
19081
+ // was: , uploadPreviewId = $uploadTrigger.id +'-preview'
19082
+ , uploadPreviewId = $uploadTrigger.getAttribute('data-gina-form-upload-preview') || $uploadTrigger.id +'-preview'
18460
19083
  , $uploadPreview = document.getElementById(uploadPreviewId);
18461
19084
 
18462
19085
  var childNodeFile = null
18463
19086
  , childNodeFilePreview = null
18464
- // static snapshot of the preview images: nodes are removed from
18465
- // the DOM mid-loop, so a live NodeList would shift under the
18466
- // iteration (out-of-range reads on multi-file passes)
18467
- , childNodes = Array.prototype.filter.call($uploadPreview.childNodes, function (node) {
18468
- return /img/i.test(node.tagName);
18469
- })
19087
+ // #B859 — a static snapshot of the container's FILE nodes (see getUploadFileNodes): the
19088
+ // <img> a `<ul>` container wraps in an <li> counts, and so does the node a page marks for
19089
+ // a file shown without an image. It held the container's direct <img> children only, so
19090
+ // the reset of a `<ul>` container removed nothing.
19091
+ , childNodes = getUploadFileNodes($uploadPreview)
18470
19092
  , $resetLink = null
18471
- , files = $uploadTrigger.customFiles
19093
+ , files = $uploadTrigger.customFiles || []
19094
+ , stagedFiles = $uploadTrigger.stagedFiles || []
19095
+ , fieldPrefix = getUploadFieldPrefix($uploadTrigger)
19096
+ , entries = []
19097
+ , remainingFiles = []
18472
19098
  , filesToBeRemoved = []
18473
19099
  , onRemoveCbName = $uploadTrigger.getAttribute('data-gina-form-upload-on-' + bindingType)
18474
19100
  , uploadHiddenClass = $uploadTrigger.getAttribute('data-gina-form-upload-hidden-class')
18475
19101
  , removedCount = 0
18476
19102
  ;
18477
19103
 
18478
- for (let i = 0, len = childNodes.length; i < len; i++) {
18479
- // only look for IMG tags
18480
- if ( /img/i.test(childNodes[i].tagName) ) {
19104
+ // #B859 — the pass walks the input's FILES, by index (its selection when resetting, the
19105
+ // stored entries when deleting), not the preview's <img> children: a file shown without an
19106
+ // image has no <img>, so its fields and its staged copy were left behind.
19107
+ // #B860 — every file of the input goes, each under its own index, in one pass: the
19108
+ // per-<img> pass re-read the index after each removal and kept the next file's fields, and
19109
+ // on a multi-file reset it threw when it set the input's value to the files still listed.
19110
+ for (let f = 0, fLen = files.length; f < fLen; f++) {
19111
+ // a staged file is reset, not deleted: a delete link left on the page belongs to the
19112
+ // stored file the selection replaced
19113
+ if ( !isOnResetMode && !files[f].deleteLinkId ) {
19114
+ remainingFiles.push(files[f]);
19115
+ continue;
19116
+ }
19117
+ let entry = { index: f, $link: null, nodes: [], names: [] };
19118
+ if (isOnResetMode) {
19119
+ let linkId = $uploadTrigger.id +'-'+ f +'-reset-trigger';
19120
+ entry.$link = document.getElementById(linkId);
19121
+ for (let n = 0, nLen = childNodes.length; n < nLen; n++) {
19122
+ if ( childNodes[n].getAttribute('data-upload-reset-link-id') == linkId ) {
19123
+ entry.nodes.push(childNodes[n]);
19124
+ }
19125
+ }
19126
+ // the names the staging answer gave — the ones its <img> preview carries
19127
+ childNodeFile = ( stagedFiles[f] && stagedFiles[f].originalFilename )
19128
+ ? stagedFiles[f].originalFilename
19129
+ : ( entry.nodes.length ) ? entry.nodes[0].getAttribute('data-upload-original-filename') : files[f].name;
19130
+ childNodeFilePreview = ( stagedFiles[f] && stagedFiles[f].preview && stagedFiles[f].preview.originalFilename )
19131
+ ? stagedFiles[f].preview.originalFilename
19132
+ : ( entry.nodes.length ) ? entry.nodes[0].getAttribute('data-upload-preview-original-filename') : null;
19133
+ } else {
19134
+ entry.$link = document.getElementById( files[f].deleteLinkId );
19135
+ if ( childNodes[f] ) {
19136
+ entry.nodes.push(childNodes[f]);
19137
+ }
19138
+ childNodeFile = files[f].name;
19139
+ childNodeFilePreview = null;
19140
+ }
19141
+ if (childNodeFile) {
19142
+ entry.names.push(childNodeFile);
19143
+ filesToBeRemoved.push(childNodeFile);
19144
+ }
19145
+ if (childNodeFilePreview) {
19146
+ entry.names.push(childNodeFilePreview);
19147
+ filesToBeRemoved.push(childNodeFilePreview);
19148
+ }
19149
+ entries.push(entry);
19150
+ } // EO for
19151
+
19152
+ if ( entries.length > 0 ) {
19153
+ // remove file from the server - filesToBeRemoved
19154
+ let url = $uploadTrigger.getAttribute('data-gina-form-upload-'+ bindingType +'-action');
19155
+ if ( !url || typeof(url) == 'undefined' || url == '' || /404/.test(url) ) {
19156
+ throw new Error('input file `'+ $uploadTrigger.id +'` error: `data-gina-form-upload-'+bindingType+'-action` is required. You need to provide a valide url.');
19157
+ }
19158
+ let method = $uploadTrigger.getAttribute('data-gina-form-upload-'+ bindingType +'-method');
19159
+ if ( !method || typeof(method) == 'undefined' || method == '') {
18481
19160
  if (isOnResetMode) {
18482
- childNodeFile = childNodes[i].getAttribute('data-upload-original-filename');
18483
- filesToBeRemoved.push(childNodeFile);
18484
- childNodeFilePreview = childNodes[i].getAttribute('data-upload-preview-original-filename');
18485
- if (childNodeFilePreview) {
18486
- filesToBeRemoved.push(childNodeFilePreview);
18487
- }
19161
+ method = 'POST';
18488
19162
  } else {
18489
- let file = childNodes[i].src.substring(childNodes[i].src.lastIndexOf('/')+1);
18490
- childNodeFile = file;
18491
- filesToBeRemoved.push(childNodeFile);
19163
+ method = (filesToBeRemoved.length > 1) ? 'POST': 'DELETE';
19164
+ console.warn('`data-gina-form-upload-'+ bindingType +'-method` was not defined. Switching to `'+ method +'` by default.');
18492
19165
  }
19166
+ } else {
19167
+ method = method.toUpperCase();
19168
+ }
19169
+ let isSynchrone = $uploadTrigger.getAttribute('data-gina-form-upload-'+ bindingType +'-is-synchrone');
19170
+ if ( /null/i.test(isSynchrone) || typeof(method) == 'undefined' || method == '' ) {
19171
+ isSynchrone = true;
19172
+ }
18493
19173
 
18494
- // remove file from input.files
18495
- for (let f = 0, fLen = files.length; f < fLen; f++) {
18496
- if (files[f].name == childNodeFile) {
18497
- // get resetLink element
18498
- if (isOnResetMode) {
18499
- $resetLink = document.getElementById( childNodes[i].getAttribute('data-upload-'+ bindingType +'-link-id') );
18500
- } else {
18501
- $resetLink = document.getElementById( files[f].deleteLinkId );
18502
- }
18503
-
18504
- // hide reset or delete link & image
18505
- $resetLink.style.display = 'none';
18506
- childNodes[i].style.display = 'none';
18507
-
18508
- // remove file from input.files
18509
- files.splice(f, 1);
18510
- removedCount++;
18511
- // Since `$uploadTrigger.files` isFrozen & isSealed
18512
- $uploadTrigger.customFiles = files;
18513
- if (isOnResetMode) {
18514
- $uploadTrigger.value = files.join(', C:\\fakepath\\');
18515
- }
18516
-
18517
- // update form files for validation & submit/send
18518
- let re = new RegExp('^'+($uploadTrigger.name+'['+f+']').replace(/\-|\[|\]|\./g, '\\$&'));
18519
- for ( let d = 0, dLen = $uploadTrigger.form.length; d < dLen; d++) {
18520
- // data-gina-form-upload-is-locked
18521
- // this exception prevent `tagged datas` to be deleted on image delete
18522
- let isLocked = $uploadTrigger.form[d].dataset.ginaFormUploadIsLocked || false;
18523
- if ( re.test($uploadTrigger.form[d].name) && !/true/i.test(isLocked) ) {
18524
- $uploadTrigger.form[d].remove();
18525
- dLen--;
18526
- d--;
18527
- //update toolbar
18528
- if (gina && envIsDev && isGFFCtx && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar ) {
18529
- try {
18530
- // update toolbar
18531
- window.ginaToolbar.update('data-xhr', {files: files});
18532
- } catch (err) {
18533
- throw err
18534
- }
18535
- }
18536
- }
18537
- }
18538
- // remove file from the server - filesToBeRemoved
18539
- let url = $uploadTrigger.getAttribute('data-gina-form-upload-'+ bindingType +'-action');
18540
- if ( !url || typeof(url) == 'undefined' || url == '' || /404/.test(url) ) {
18541
- throw new Error('input file `'+ $uploadTrigger.id +'` error: `data-gina-form-upload-'+bindingType+'-action` is required. You need to provide a valide url.');
18542
- }
18543
- let method = $uploadTrigger.getAttribute('data-gina-form-upload-'+ bindingType +'-method');
18544
- if ( !method || typeof(method) == 'undefined' || method == '') {
18545
- if (isOnResetMode) {
18546
- method = 'POST';
18547
- } else {
18548
- method = (filesToBeRemoved.length > 1) ? 'POST': 'DELETE';
18549
- console.warn('`data-gina-form-upload-'+ bindingType +'-method` was not defined. Switching to `'+ method +'` by default.');
18550
- }
18551
- } else {
18552
- method = method.toUpperCase();
18553
- }
18554
- let isSynchrone = $uploadTrigger.getAttribute('data-gina-form-upload-'+ bindingType +'-is-synchrone');
18555
- if ( /null/i.test(isSynchrone) || typeof(method) == 'undefined' || method == '' ) {
18556
- isSynchrone = true;
18557
- }
18558
-
18559
- let xhrOptions = {
18560
- url: url,
18561
- method: method,
18562
- isSynchrone: isSynchrone,
18563
- headers : {
18564
- // #FORMCT — the body sent below is JSON (JSON.stringify({ files })).
18565
- // Send application/json — NOT the urlencoded default — or the server
18566
- // url-decodes the JSON body ('+' -> space, decodeURIComponent) and
18567
- // corrupts '+'/'%' in removed-file keys.
18568
- 'Content-Type': 'application/json; charset=UTF-8',
18569
- // cross domain is enabled by default, but you need to setup `Access-Control-Allow-Origin`
18570
- 'X-Requested-With': 'XMLHttpRequest' // in case of cross domain origin
18571
- }
18572
- };
18573
- // #CSRF2 follow-up — inject X-Gina-CSRF-Token on mutating methods (file remove → DELETE/POST)
18574
- if ( isMutatingMethod(method) ) {
18575
- let csrfToken = readCsrfCookie();
18576
- if (csrfToken) {
18577
- xhrOptions.headers['X-Gina-CSRF-Token'] = csrfToken;
18578
- }
19174
+ let xhrOptions = {
19175
+ url: url,
19176
+ method: method,
19177
+ isSynchrone: isSynchrone,
19178
+ headers : {
19179
+ // #FORMCT — the body sent below is JSON (JSON.stringify({ files })).
19180
+ // Send application/json — NOT the urlencoded default — or the server
19181
+ // url-decodes the JSON body ('+' -> space, decodeURIComponent) and
19182
+ // corrupts '+'/'%' in removed-file keys.
19183
+ 'Content-Type': 'application/json; charset=UTF-8',
19184
+ // cross domain is enabled by default, but you need to setup `Access-Control-Allow-Origin`
19185
+ 'X-Requested-With': 'XMLHttpRequest' // in case of cross domain origin
19186
+ }
19187
+ };
19188
+ // #CSRF2 follow-up — inject X-Gina-CSRF-Token on mutating methods (file remove → DELETE/POST)
19189
+ if ( isMutatingMethod(method) ) {
19190
+ let csrfToken = readCsrfCookie();
19191
+ if (csrfToken) {
19192
+ xhrOptions.headers['X-Gina-CSRF-Token'] = csrfToken;
19193
+ }
19194
+ }
19195
+ let xhr = setupXhr(xhrOptions);
19196
+ //handleXhr(xhr);
19197
+ if ( /GET|DELETE/i.test(method) ) {
19198
+ xhr.send();
19199
+ } else {
19200
+ xhr.send(JSON.stringify({ files: filesToBeRemoved }));
19201
+ }
19202
+
19203
+ // when there is no more files to preview, restore input file visibility
19204
+ // display upload input
19205
+ restoreUploadAffordance($uploadTrigger, uploadHiddenClass);
19206
+
19207
+ for (let e = 0, eLen = entries.length; e < eLen; e++) {
19208
+ $resetLink = entries[e].$link;
19209
+ childNodeFile = entries[e].names[0] || null;
19210
+
19211
+ // update form files for validation & submit/send: the file's fields leave the form,
19212
+ // kept on the input for the next selection (#B858). They are `<prefix>[index]…`, the
19213
+ // prefix they were built with (#B862: it was the input's name, so with a custom
19214
+ // `data-gina-form-upload-prefix` they stayed while the server was told to drop the file).
19215
+ removeUploadEntryFields($uploadTrigger, fieldPrefix, entries[e].index);
19216
+
19217
+ if ( $resetLink ) {
19218
+ // #A11Y7/U5 — the control about to be removed is the one the user
19219
+ // just activated, so it holds focus; removing a focused element
19220
+ // drops focus to <body> and the user loses their place with no
19221
+ // signal. Move focus first, onto the file input that owns the
19222
+ // staged files — which `restoreUploadAffordance` just made visible
19223
+ // again. Guarded on it actually holding focus, so a programmatic
19224
+ // reset never yanks focus away from wherever the user really is.
19225
+ if ( document.activeElement === $resetLink || $resetLink.contains(document.activeElement) ) {
19226
+ if ( typeof($uploadTrigger.focus) == 'function' ) {
19227
+ $uploadTrigger.focus();
18579
19228
  }
18580
- let xhr = setupXhr(xhrOptions);
18581
- //handleXhr(xhr);
18582
- if ( /GET|DELETE/i.test(method) ) {
18583
- xhr.send();
18584
- } else {
18585
- xhr.send(JSON.stringify({ files: filesToBeRemoved }));
19229
+ // #A11Y5's lesson, applied: `typeof focus == 'function'` is true
19230
+ // for EVERY HTMLElement, and focus() is a silent no-op on one
19231
+ // that cannot take focus (hidden, disabled, detached) — so
19232
+ // confirm the move instead of assuming it. Signal-only: there is
19233
+ // no better fallback than the document, and failing loudly here
19234
+ // would break a removal that otherwise succeeded.
19235
+ if ( document.activeElement !== $uploadTrigger ) {
19236
+ console.debug('[FormValidator][upload]['+ ($uploadTrigger.id || '?') +'] '+ bindingType +': could not move focus to the file input before removing the '+ bindingType +' control; focus falls back to the document.');
18586
19237
  }
19238
+ }
19239
+ }
19240
+ // Announce the removal. `aria-live="polite"` queues rather than
19241
+ // interrupts, so this lands after the focus move above has been
19242
+ // announced instead of racing it. Function replacer, not a string:
19243
+ // a file name may contain `$`, and a string replacement would expand
19244
+ // `$&` / `$1` patterns inside it.
19245
+ if ( $uploadTrigger.form && childNodeFile ) {
19246
+ announceA11yStatus(
19247
+ $uploadTrigger.form,
19248
+ a11yLabel('fileRemoved').replace('%s', function () { return childNodeFile; })
19249
+ );
19250
+ }
18587
19251
 
18588
- // when there is no more files to preview, restore input file visibility
18589
- // display upload input
18590
- restoreUploadAffordance($uploadTrigger, uploadHiddenClass);
18591
-
18592
- // #A11Y7/U5 — the control about to be removed is the one the user
18593
- // just activated, so it holds focus; removing a focused element
18594
- // drops focus to <body> and the user loses their place with no
18595
- // signal. Move focus first, onto the file input that owns the
18596
- // staged files — which `restoreUploadAffordance` just made visible
18597
- // again. Guarded on it actually holding focus, so a programmatic
18598
- // reset never yanks focus away from wherever the user really is.
18599
- if ( document.activeElement === $resetLink || $resetLink.contains(document.activeElement) ) {
18600
- if ( typeof($uploadTrigger.focus) == 'function' ) {
18601
- $uploadTrigger.focus();
18602
- }
18603
- // #A11Y5's lesson, applied: `typeof focus == 'function'` is true
18604
- // for EVERY HTMLElement, and focus() is a silent no-op on one
18605
- // that cannot take focus (hidden, disabled, detached) — so
18606
- // confirm the move instead of assuming it. Signal-only: there is
18607
- // no better fallback than the document, and failing loudly here
18608
- // would break a removal that otherwise succeeded.
18609
- if ( document.activeElement !== $uploadTrigger ) {
18610
- console.debug('[FormValidator][upload]['+ ($uploadTrigger.id || '?') +'] '+ bindingType +': could not move focus to the file input before removing the '+ bindingType +' control; focus falls back to the document.');
18611
- }
18612
- }
18613
- // Announce the removal. `aria-live="polite"` queues rather than
18614
- // interrupts, so this lands after the focus move above has been
18615
- // announced instead of racing it. Function replacer, not a string:
18616
- // a file name may contain `$`, and a string replacement would expand
18617
- // `$&` / `$1` patterns inside it.
18618
- if ( $uploadTrigger.form && childNodeFile ) {
18619
- announceA11yStatus(
18620
- $uploadTrigger.form,
18621
- a11yLabel('fileRemoved').replace('%s', function () { return childNodeFile; })
18622
- );
18623
- }
19252
+ // remove link & preview node(s) - must be done last
19253
+ // (the reset/delete link's own click listener dies with the node)
19254
+ if ( $resetLink ) {
19255
+ let $linkItem = $resetLink.parentNode;
19256
+ $resetLink.remove();
19257
+ dropEmptyUploadPreviewItem($linkItem, $uploadPreview);
19258
+ }
19259
+ for (let i = 0, iLen = entries[e].nodes.length; i < iLen; i++) {
19260
+ let $nodeItem = entries[e].nodes[i].parentNode;
19261
+ entries[e].nodes[i].remove();
19262
+ dropEmptyUploadPreviewItem($nodeItem, $uploadPreview);
19263
+ }
19264
+ removedCount++;
19265
+ } // EO for
18624
19266
 
18625
- // remove link & image - must be done last
18626
- // (the reset/delete link's own click listener dies with the node)
18627
- $resetLink.remove();
18628
- childNodes[i].remove();
18629
- break;
18630
- }
18631
- } // EO for
19267
+ // Since `$uploadTrigger.files` isFrozen & isSealed
19268
+ $uploadTrigger.customFiles = remainingFiles;
19269
+ if (isOnResetMode) {
19270
+ // every staged file is gone; a file input's value can only be emptied
19271
+ // was: $uploadTrigger.value = files.join(', C:\\fakepath\\');
19272
+ $uploadTrigger.value = '';
19273
+ $uploadTrigger.stagedFiles = [];
19274
+ }
19275
+ //update toolbar
19276
+ if (gina && envIsDev && isGFFCtx && typeof(window.ginaToolbar) != 'undefined' && window.ginaToolbar ) {
19277
+ try {
19278
+ // update toolbar
19279
+ window.ginaToolbar.update('data-xhr', {files: remainingFiles});
19280
+ } catch (err) {
19281
+ throw err
19282
+ }
18632
19283
  }
18633
19284
  }
18634
19285
 
18635
- // #B150 — the removal loop matched zero previews against the input's
18636
- // customFiles, so NOTHING was removed: the tmp-delete XHR, the #R8
18637
- // indicator strip, and the removal callback below are all `removedCount>0`
18638
- // -gated and are about to be skipped, silently, leaving any staged tmp
18639
- // files on the server. That is expected when there was nothing to remove
18640
- // (an empty preview set), but a NON-EMPTY preview set that matched nothing
18641
- // is a state desync (e.g. a runtime-injected bind whose customFiles names
18642
- // do not line up with the rendered `data-upload-original-filename`s) —
18643
- // signal it so the otherwise-invisible skip is diagnosable. Signal-only:
18644
- // the `removedCount>0` gates STAY (no removal => no removal callback, #B94).
19286
+ // #B150 — the input held no file to remove while its preview container shows file nodes,
19287
+ // so NOTHING was removed: the tmp-delete XHR, the #R8 indicator strip, and the removal
19288
+ // callback below are all skipped, silently, leaving any staged tmp files on the server.
19289
+ // That is expected when there was nothing to remove (an empty preview set), but a
19290
+ // NON-EMPTY preview set with no file to remove is a state desync (e.g. a runtime-injected
19291
+ // bind that recorded no file) — signal it so the otherwise-invisible skip is diagnosable.
19292
+ // Signal-only: the `removedCount>0` gates STAY (no removal => no removal callback, #B94).
18645
19293
  if (removedCount === 0 && childNodes.length > 0) {
18646
- console.warn('[FormValidator][upload]['+ ($uploadTrigger.id || '?') +'] '+ bindingType +': '+ childNodes.length +' preview(s) present but none matched the staged input files — nothing removed, cleanup skipped. Ensure each preview\'s `data-upload-original-filename` matches a current input file name.');
19294
+ console.warn('[FormValidator][upload]['+ ($uploadTrigger.id || '?') +'] '+ bindingType +': '+ childNodes.length +' preview(s) present but none matched the staged input files — nothing removed, cleanup skipped. The input holds no file to '+ bindingType +'.');
18647
19295
  }
18648
19296
 
18649
19297
  // #R8 — at least one staged file the indicator reported is gone:
@@ -18997,6 +19645,27 @@ function ValidatorPlugin(rules, data, formId, culture) {
18997
19645
  }
18998
19646
 
18999
19647
 
19648
+ /**
19649
+ * destroy
19650
+ *
19651
+ * Unbinds a form and forgets its record. Fires `destroy.<id>` on the form (a `.on('destroy')`
19652
+ * handler runs), then — since #B585 — detaches the handlers consumers registered through
19653
+ * `.on()` as well, so a same-id form bound afterwards starts clean and a fresh `.on()` on it
19654
+ * registers. Only while the form is still in the document: a form destroyed AFTER it left the
19655
+ * document (a popin's content being replaced or cleared) keeps those handlers — they die with
19656
+ * the element, and an answer still on its way to it reaches them (the popin branch of the
19657
+ * send dispatches `success.<id>` on the old form after `loadContent()` has torn it down). Its
19658
+ * registry keys are released either way, so the same-id successor registers its own. A form
19659
+ * taken out of the document, destroyed, put back and bound again therefore keeps its old
19660
+ * `.on()` handlers: destroy it before detaching it when it is meant to come back.
19661
+ *
19662
+ * @param {string|object} [formId] - the form id (`#` tolerated), or an object carrying `.form`;
19663
+ * omitted when called on a form record
19664
+ *
19665
+ * @example
19666
+ * gina.validator.$forms['signup'].destroy();
19667
+ * gina.validator.validateFormById('signup'); // the same element, bound again, once
19668
+ */
19000
19669
  var destroy = function(formId) {
19001
19670
  var $form = null, _id = formId;
19002
19671
 
@@ -19032,21 +19701,55 @@ function ValidatorPlugin(rules, data, formId, culture) {
19032
19701
 
19033
19702
  if ($form) {
19034
19703
 
19035
- addListener(gina, $form.target, 'destroy.' + _id, function(event) {
19704
+ // #B585 — named, so it can detach itself by reference once it has run
19705
+ var onDestroyed = function(event) {
19036
19706
 
19037
19707
  cancelEvent(event);
19038
19708
 
19039
19709
  delete instance['$forms'][_id];
19040
- removeListener(gina, event.currentTarget, event.type);
19041
- removeListener(gina, event.currentTarget,'destroy');
19042
- });
19710
+ event.currentTarget.removeEventListener(event.type, onDestroyed, false);
19711
+ if ( typeof(gina.events[event.type]) != 'undefined' ) {
19712
+ delete gina.events[event.type];
19713
+ }
19714
+ };
19715
+ addListener(gina, $form.target, 'destroy.' + _id, onDestroyed);
19043
19716
 
19044
- // remove existing listeners
19717
+ // remove the binding's own listeners
19045
19718
  $form = unbindForm($form);
19046
19719
 
19047
19720
  //triggerEvent(gina, instance['$forms'][_id].target, 'destroy.' + _id);
19048
19721
  triggerEvent(gina, $form.target, 'destroy.' + _id);
19049
19722
 
19723
+ // #B585 — then the handlers consumers registered through `.on()` (the declarative
19724
+ // `.hform` hooks included): they outlive a reBind(), not a destroy(). After the
19725
+ // destroy event, so a `.on('destroy')` handler has run first.
19726
+ // Detached by reference only while the form is still in the document — a form
19727
+ // destroyed after it left it (the popin teardown runs after the content was
19728
+ // replaced or cleared) keeps them: they die with the element, and the popin
19729
+ // branch of the send still dispatches `success.<id>` on that old form after
19730
+ // `loadContent()`, so the declared callback reaches it (regression measured on
19731
+ // the first cut: five e2e arms lost their success callback). The keys are
19732
+ // released either way, so the same-id successor registers its own.
19733
+ var isFormDetached = ( typeof($form.target.isConnected) == 'boolean' && !$form.target.isConnected );
19734
+ if ( Array.isArray($form.consumerListeners) ) {
19735
+ for (let i = 0, len = $form.consumerListeners.length; i < len; i++) {
19736
+ let entry = $form.consumerListeners[i];
19737
+ if ( !entry || !entry.el || typeof(entry.fn) != 'function' ) continue;
19738
+ if ( isFormDetached ) {
19739
+ // kept on the element that is going away
19740
+ } else if ( entry.el.removeEventListener ) {
19741
+ entry.el.removeEventListener(entry.evt, entry.fn, false);
19742
+ } else if ( entry.el.detachEvent ) {
19743
+ entry.el.detachEvent('on' + entry.evt, entry.fn);
19744
+ }
19745
+ let eId = ( typeof(entry.el.id) != 'undefined' && typeof(entry.el.id) != 'object' ) ? entry.el.id : ( entry.el.getAttribute ? entry.el.getAttribute('id') : null );
19746
+ if ( typeof(gina.events[entry.evt]) != 'undefined' && gina.events[entry.evt] == eId ) {
19747
+ delete gina.events[entry.evt];
19748
+ }
19749
+ }
19750
+ $form.consumerListeners = [];
19751
+ }
19752
+
19050
19753
  } else {
19051
19754
  throw new Error('[ FormValidator::destroy(formId) ] `'+_id+'` not found');
19052
19755
  }
@@ -19908,6 +20611,9 @@ function ValidatorPlugin(rules, data, formId, culture) {
19908
20611
  isOtherTagAllowed = false;
19909
20612
  }
19910
20613
  var rules = $form.rules;
20614
+ // #B585 — the ledger of listeners this binding attaches (created here too, for a record
20615
+ // handed in by a caller that did not go through bindForm)
20616
+ if ( !Array.isArray($form.boundListeners) ) { $form.boundListeners = []; }
19911
20617
  var $formInstance = instance.$forms[$el.form.getAttribute('id')];
19912
20618
  var isDisabled = ( /^true$/i.test($el.disabled) ) ? true : false;
19913
20619
  if (
@@ -19935,10 +20641,10 @@ function ValidatorPlugin(rules, data, formId, culture) {
19935
20641
 
19936
20642
  var eventsList = [], _evt = null, _e = 0;
19937
20643
  if ( !/^(radio|checkbox)$/i.test($el.type) ) {
19938
- addEventListener(gina, $el, 'focusout.'+$el.id, function(event) {
19939
- event.preventDefault();
19940
- clearTimeout(liveCheckTimer);
19941
- });
20644
+ // #B585 — a call to the browser's own addEventListener (with gina's 4-argument
20645
+ // shape) stood here: it registered nothing useful on `window` and kept every
20646
+ // live-checked field alive there. The `focusout.<id>` handler registered below
20647
+ // clears the live-check timer.
19942
20648
 
19943
20649
  // BO Livecheck local events
19944
20650
  _evt = 'change.'+$el.id;
@@ -19995,6 +20701,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
19995
20701
 
19996
20702
  if (eventsList.length > 0) {
19997
20703
  var once = false;
20704
+ $form.boundListeners.push({ el: $el, evt: eventsList, fn:
19998
20705
  addListener(gina, $el, eventsList, function(event) {
19999
20706
  event.preventDefault();
20000
20707
  clearTimeout(liveCheckTimer);
@@ -20278,7 +20985,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
20278
20985
  console.debug(' change .... '+$el.id);
20279
20986
  processEvent();
20280
20987
  }
20281
- });
20988
+ }) });
20282
20989
  }
20283
20990
  }
20284
20991
  }
@@ -20419,6 +21126,14 @@ function ValidatorPlugin(rules, data, formId, culture) {
20419
21126
  var handleAutoComplete = function($el, liveCheckTimer) {
20420
21127
 
20421
21128
  $el.setAttribute('readonly', 'readonly');
21129
+ // #B585 — the form that owns the field carries the ledger unbindForm drains; resolved
21130
+ // tolerantly, so a harness that hands the handler a bare element still runs it
21131
+ var $ownerForm = ( $el.form && typeof(instance) != 'undefined' && instance && instance.$forms )
21132
+ ? ( instance.$forms[$el.form.getAttribute('id')] || null )
21133
+ : null;
21134
+ if ( $ownerForm && !Array.isArray($ownerForm.boundListeners) ) { $ownerForm.boundListeners = []; }
21135
+ var ledger = ( $ownerForm ) ? $ownerForm.boundListeners : [];
21136
+ ledger.push({ el: $el, evt: 'focusout.'+ $el.id, fn:
20422
21137
  addListener(gina, $el, 'focusout.'+ $el.id, function(event) {
20423
21138
  event.preventDefault();
20424
21139
  clearTimeout(liveCheckTimer);
@@ -20426,14 +21141,22 @@ function ValidatorPlugin(rules, data, formId, culture) {
20426
21141
  var $_el = event.currentTarget;
20427
21142
  triggerEvent(gina, $_el, 'change.'+ $_el.id);
20428
21143
  $_el.setAttribute('readonly', 'readonly');
20429
- });
21144
+ }) });
21145
+ ledger.push({ el: $el, evt: 'focusin.'+ $el.id, fn:
20430
21146
  addListener(gina, $el, 'focusin.'+ $el.id, function(event) {
20431
21147
  event.preventDefault();
20432
21148
  event.currentTarget.removeAttribute('readonly');
20433
21149
 
20434
21150
  var evtName = 'keydown.'+ event.currentTarget.id;
20435
- // add once
20436
- if ( typeof(gina.events[evtName]) == 'undefined' ) {
21151
+ // add once — judged by what is ATTACHED (the ledger) when the owner form is known:
21152
+ // unbind detaches the handler, and a consumer belt restoring the registry key must
21153
+ // not leave the field without its interception (#B585)
21154
+ var isKeydownBound = false;
21155
+ for (let _b = 0, _bLen = ledger.length; _b < _bLen; _b++) {
21156
+ if ( ledger[_b].el === event.currentTarget && ledger[_b].evt === evtName ) { isKeydownBound = true; break; }
21157
+ }
21158
+ if ( ( $ownerForm ) ? !isKeydownBound : typeof(gina.events[evtName]) == 'undefined' ) {
21159
+ ledger.push({ el: event.currentTarget, evt: evtName, fn:
20437
21160
  addListener(gina, event.currentTarget, evtName, function(e) {
20438
21161
  // #B134 — modifier chords are NOT intercepted: return before
20439
21162
  // preventDefault so the native select-all/copy/paste/cut/undo
@@ -20658,10 +21381,10 @@ function ValidatorPlugin(rules, data, formId, culture) {
20658
21381
  queueCaretRestore($_el);
20659
21382
  break;
20660
21383
  } //EO Switch
20661
- });
21384
+ }) });
20662
21385
  }
20663
21386
 
20664
- });
21387
+ }) });
20665
21388
 
20666
21389
  }
20667
21390
 
@@ -20844,6 +21567,11 @@ function ValidatorPlugin(rules, data, formId, culture) {
20844
21567
  * reBindForm
20845
21568
  * Allows form rebinding: it is like reseting validation
20846
21569
  *
21570
+ * Since #B585 the unbind half detaches exactly what the previous bind attached (by
21571
+ * reference, through the per-form ledger) and the bind half attaches it again, so a
21572
+ * reBind() never stacks a listener. Handlers registered through `.on()` — and the
21573
+ * declarative `data-gina-form-event-on-*` hooks — survive it; `destroy()` removes them.
21574
+ *
20847
21575
  * E.g.:
20848
21576
  * $validator
20849
21577
  * .getFormById('my-form-id')
@@ -20972,6 +21700,27 @@ function ValidatorPlugin(rules, data, formId, culture) {
20972
21700
  return bound;
20973
21701
  }
20974
21702
 
21703
+ /**
21704
+ * unbindForm
21705
+ *
21706
+ * Detaches what the form's current binding attached and marks the record unbound. Since
21707
+ * #B585 this is the exact inverse of `bindForm`: the per-form ledger (`$form.boundListeners`)
21708
+ * and the reassociated-control side-table are drained by reference, the registry keys the
21709
+ * binding wrote are released, the live-check registration flags are cleared, and the submit
21710
+ * trigger's marks (`data-gina-form-submit-trigger-for`, the `__ginaSubmitBoundFor` expando)
21711
+ * are released with the record's `submitTrigger` claim, so the next bind — on this record,
21712
+ * or on a fresh same-id record after `destroy()` — claims and binds the trigger again.
21713
+ * Handlers registered through `.on()` (the declarative `data-gina-form-event-on-*` hooks
21714
+ * included) are left in place — they belong to the form, and `destroy()` removes them.
21715
+ *
21716
+ * @param {object} $target - the `<form>` element, or the form record (`$forms[id]`)
21717
+ *
21718
+ * @returns {object} $form - the record, `binded` false
21719
+ *
21720
+ * @example
21721
+ * gina.validator.$forms['signup'].unbind();
21722
+ * gina.validator.$forms['signup'].bind(); // attaches everything again, once
21723
+ */
20975
21724
  var unbindForm = function($target) {
20976
21725
  var $form = null
20977
21726
  , _id = null
@@ -21000,161 +21749,64 @@ function ValidatorPlugin(rules, data, formId, culture) {
21000
21749
  return $form
21001
21750
  }
21002
21751
 
21003
- // form events
21004
- removeListener(gina, $form, 'success.' + _id);
21005
- removeListener(gina, $form, 'error.' + _id);
21006
-
21007
- if ($form.target.getAttribute('data-gina-form-event-on-submit-success'))
21008
- removeListener(gina, $form, 'success.' + _id + '.hform');
21009
-
21010
- if ($form.target.getAttribute('data-gina-form-event-on-submit-error'))
21011
- removeListener(gina, $form, 'error.' + _id + '.hform');
21012
-
21013
- if ($form.target.getAttribute('data-gina-form-event-on-swap'))
21014
- removeListener(gina, $form, 'afterswap.' + _id + '.hform');
21015
-
21016
- removeListener(gina, $form, 'validate.' + _id);
21017
- removeListener(gina, $form, 'validated.' + _id);
21018
- removeListener(gina, $form, 'submit.' + _id);
21019
- removeListener(gina, $form, 'reset.' + _id);
21020
-
21021
-
21022
-
21023
- // binded elements
21024
- var $el = null
21025
- //, evt = null
21026
- , $els = []
21027
- , $elTMP = [];
21028
-
21029
- // submit buttons
21030
- $elTMP = $form.target.getElementsByTagName('button');
21031
- if ( $elTMP.length > 0 ) {
21032
- for (let i = 0, len = $elTMP.length; i < len; ++i) {
21033
- // if button is != type="submit", you will need to provide : data-gina-form-submit
21034
- // TODO - On button binding, you can then provide data-gina-form-action & data-gina-form-method
21035
- $els.push($elTMP[i])
21036
- }
21037
- }
21038
-
21039
- // submit links
21040
- $elTMP = $form.target.getElementsByTagName('a');
21041
- if ( $elTMP.length > 0 ) {
21042
- for (let i = 0, len = $elTMP.length; i < len; ++i) {
21043
- $els.push($elTMP[i])
21044
- }
21045
- }
21046
-
21047
- // checkbox, radio, file, text, number, hidden, date .. ALL BUT hidden
21048
- $elTMP = $form.target.getElementsByTagName('input');
21049
- if ( $elTMP.length > 0 ) {
21050
- for (let i = 0, len = $elTMP.length; i < len; ++i) {
21051
-
21052
- if ( !/^(hidden)$/i.test($elTMP[i].type) )
21053
- $els.push( $elTMP[i] );
21054
-
21055
-
21056
- if (/^(file)$/i.test($elTMP[i].type)) {
21057
- // special case
21058
- // vForm has to be handle here, it does not exist in the document context
21059
- let vFormId = $elTMP[i].getAttribute('data-gina-form-virtual');
21060
- if ( vFormId ) {
21061
- let $vForm = getFormById(vFormId).target;
21062
- if ($vForm) {
21063
- $els.push( $vForm );
21064
- // `events` is defined on top of this file
21065
- // It is the list of allowed events
21066
- for (let e = 0, eLen = events.length; e < eLen; e++) {
21067
- let evt = events[e];
21068
- if ( typeof(gina.events[ evt +'.'+ vFormId + '.hform' ]) != 'undefined' && gina.events[ evt +'.'+ vFormId + '.hform' ] == vFormId ) {
21069
- removeListener(gina, $vForm, evt +'.'+ vFormId + '.hform')
21070
- }
21071
- }
21072
- }
21073
- }
21074
- } else { // other types
21075
- // `events` is defined on top of this file
21076
- // It is the list of allowed events
21077
- for (let e = 0, eLen = events.length; e < eLen; e++) {
21078
- let evt = events[e] +'.'+ $elTMP[i].id;
21079
- if ( typeof(gina.events[ evt ]) != 'undefined' && gina.events[ evt ] == $elTMP[i].id ) {
21080
- removeListener(gina, $elTMP[i], evt);
21081
- }
21082
- evt = events[e];
21083
- if ( typeof(gina.events[ evt ]) != 'undefined' && gina.events[ evt ] == $elTMP[i].id ) {
21084
- removeListener(gina, $elTMP[i], evt);
21085
- }
21086
- evt = $elTMP[i].id;
21087
- if ( typeof(gina.events[ evt ]) != 'undefined' && gina.events[ evt ] == $elTMP[i].id ) {
21088
- removeListener(gina, $elTMP[i], evt);
21089
- }
21090
- }
21091
- }
21092
- }
21093
- }
21094
-
21095
- // textarea
21096
- $elTMP = $form.target.getElementsByTagName('textarea');
21097
- if ( $elTMP.length > 0 ) {
21098
- for (let i = 0, len = $elTMP.length; i < len; ++i) {
21099
- $els.push( $elTMP[i] )
21752
+ // #B585 — detach exactly what bindForm attached, by reference. The ledger holds every
21753
+ // form-level proxy, the validate/reset/submit listeners, the live-check, autocomplete,
21754
+ // select, file, checkbox and radio handlers and the submit trigger's own listeners.
21755
+ // Handlers a consumer registered through `.on()` — the declarative `.hform` hooks
21756
+ // included, registered the same way at send time — belong to the form, not to one
21757
+ // binding: they stay attached across a reBind(); destroy() removes them.
21758
+ if ( Array.isArray($form.boundListeners) ) {
21759
+ for (let i = 0, len = $form.boundListeners.length; i < len; i++) {
21760
+ let entry = $form.boundListeners[i];
21761
+ if ( !entry || !entry.el || typeof(entry.fn) != 'function' ) continue;
21762
+ let evts = ( Array.isArray(entry.evt) ) ? entry.evt : [ entry.evt ];
21763
+ let eId = ( typeof(entry.el.id) != 'undefined' && typeof(entry.el.id) != 'object' ) ? entry.el.id : ( entry.el.getAttribute ? entry.el.getAttribute('id') : null );
21764
+ for (let e = 0, eLen = evts.length; e < eLen; e++) {
21765
+ if ( entry.el.removeEventListener ) {
21766
+ entry.el.removeEventListener(evts[e], entry.fn, false);
21767
+ } else if ( entry.el.detachEvent ) {
21768
+ entry.el.detachEvent('on' + evts[e], entry.fn);
21769
+ }
21770
+ // release the registry key this binding wrote: `gina.events` maps a NAME to the
21771
+ // id of the LAST element that registered it, so a bare native name another
21772
+ // element wrote last is left to that element
21773
+ if ( typeof(gina.events[evts[e]]) != 'undefined' && gina.events[evts[e]] == eId ) {
21774
+ delete gina.events[evts[e]];
21775
+ }
21776
+ }
21777
+ // the submit trigger's marks: bindForm claims the trigger for the record and stamps
21778
+ // the element with `data-gina-form-submit-trigger-for` as a bind-once guard, and
21779
+ // bindSubmitEl stamps the `__ginaSubmitBoundFor` expando (#B294). Neither was
21780
+ // released, so a record bound again after destroy() — a NEW record, the element
21781
+ // still stamped — never claimed its trigger: its state was never updated and its
21782
+ // click was refused as gated (measured on the first cut of #B585, once the stale
21783
+ // listeners of the destroyed binding no longer answered the click). Released with
21784
+ // the record's claim below, so the next bind claims and binds the trigger exactly
21785
+ // as a first bind does.
21786
+ if ( entry.el.dataset && entry.el.dataset.ginaFormSubmitTriggerFor == _id ) {
21787
+ delete entry.el.dataset.ginaFormSubmitTriggerFor;
21788
+ }
21789
+ if ( typeof(entry.el.__ginaSubmitBoundFor) != 'undefined' ) {
21790
+ delete entry.el.__ginaSubmitBoundFor;
21791
+ }
21792
+ }
21793
+ $form.boundListeners = [];
21794
+ }
21795
+ if ( typeof($form.submitTrigger) != 'undefined' ) {
21796
+ delete $form.submitTrigger;
21797
+ }
21798
+
21799
+ // the live-check registration flags (`registerForLiveChecking` is add-once per control),
21800
+ // so the next bind registers every owned control again — reassociated controls and
21801
+ // form-associated custom elements included, through the owner-aware `elements`
21802
+ var $owned = ( $form.target && $form.target.elements ) ? $form.target.elements : [];
21803
+ for (let i = 0, len = $owned.length; i < len; i++) {
21804
+ let ownedId = ( typeof($owned[i].id) == 'string' && $owned[i].id ) ? $owned[i].id : ( $owned[i].getAttribute ? $owned[i].getAttribute('id') : null );
21805
+ if ( ownedId && typeof(gina.events['registered.' + ownedId]) != 'undefined' ) {
21806
+ delete gina.events['registered.' + ownedId];
21100
21807
  }
21101
21808
  }
21102
21809
 
21103
-
21104
- // forms inside main form
21105
- $elTMP = $form.target.getElementsByTagName('form');
21106
- if ( $elTMP.length > 0 ) {
21107
- for (let i = 0, len = $elTMP.length; i < len; ++i) {
21108
- $els.push( $elTMP[i] )
21109
- }
21110
- }
21111
- // main form
21112
- $els.push( $form.target );
21113
- for (let i = 0, len = $els.length; i < len; ++i) {
21114
-
21115
- $el = $els[i];
21116
- let eId = $el.getAttribute('id');
21117
- for (let e = 0, eLen = events.length; e < eLen; e++) {
21118
- let evt = events[e];
21119
- let eventName = evt;
21120
- // remove proxy
21121
- // if ( typeof(gina.events[ evt ]) != 'undefined' ) {
21122
- // removeListener(gina, $el, evt);
21123
- // }
21124
-
21125
- if ( typeof(gina.events[ eventName ]) != 'undefined' && gina.events[ eventName ] == eId ) {
21126
- removeListener(gina, $el, eventName);
21127
- }
21128
-
21129
- // eventName = evt +'._case_'+ $el.name;
21130
- // if ( typeof(gina.events[ eventName ]) != 'undefined') {
21131
- // removeListener(gina, $el, eventName);
21132
- // }
21133
-
21134
- eventName = eId;
21135
- if ( typeof(gina.events[ eventName ]) != 'undefined' && gina.events[ eventName ] == eId ) {
21136
- removeListener(gina, $el, eventName);
21137
- }
21138
-
21139
- eventName = evt +'.'+ eId;
21140
- if ( typeof(gina.events[ eventName ]) != 'undefined' && gina.events[ eventName ] == eId ) {
21141
- removeListener(gina, $el, eventName);
21142
- }
21143
-
21144
- eventName = evt +'.'+ eId;
21145
- if ( typeof(gina.events[ eventName ]) != 'undefined' && gina.events[ eventName ] == eventName ) {
21146
- removeListener(gina, $el, eventName);
21147
- }
21148
-
21149
- eventName = evt +'.'+ eId + '.hform';
21150
- if ( typeof(gina.events[ eventName ]) != 'undefined' && gina.events[ eventName ] == eId ) {
21151
- removeListener(gina, $el, eventName);
21152
- }
21153
- }// EO for events
21154
- } //EO for $els
21155
-
21156
- $els = null; $el = null; $elTMP = null; evt = null;
21157
-
21158
21810
  // [HTML5 form-reassociation support] Drain per-control listeners attached to
21159
21811
  // reassociated controls during bindForm. The element-by-tagName loops above
21160
21812
  // walk $form.target's descendant tree only, so reassociated controls (which
@@ -21383,6 +22035,11 @@ function ValidatorPlugin(rules, data, formId, culture) {
21383
22035
  if (!Array.isArray($form.reassociatedListeners))
21384
22036
  $form.reassociatedListeners = [];
21385
22037
 
22038
+ // #B585 — the ledger of every listener THIS binding attaches, drained by reference in
22039
+ // unbindForm (the side-table above is its older sibling for out-of-tree controls)
22040
+ if (!Array.isArray($form.boundListeners))
22041
+ $form.boundListeners = [];
22042
+
21386
22043
  // Helper: collect controls owned by $form, including HTML5 form-reassociated
21387
22044
  // controls (those carrying `form="X"` outside the form's DOM subtree). Walks
21388
22045
  // $form.elements (HTMLFormControlsCollection — owner-aware) for the primary set,
@@ -21750,36 +22407,26 @@ function ValidatorPlugin(rules, data, formId, culture) {
21750
22407
  console.debug('preview is visible ...');
21751
22408
  $uploadTrigger.customFiles = [];
21752
22409
  $uploadTrigger.form = $target;
21753
- var $els = $previewContainer.childNodes;
22410
+ // #B859 — the stored files are the container's FILE nodes (see getUploadFileNodes):
22411
+ // an <img> (its file named by its src's last segment, as before) — also inside the
22412
+ // <li> of a `<ul>` container — or a node the page marks with
22413
+ // `data-upload-original-filename` for a file it shows without an image (the
22414
+ // attribute names the file). Only the container's direct <img> children counted,
22415
+ // so the delete link of a file shown without an image was bound to nothing; the
22416
+ // `<ul>` branch that stood here never ran (it read the `length` of an element).
22417
+ var $els = getUploadFileNodes($previewContainer), deleteLinkId = null;
21754
22418
  for (let i = 0, len = $els.length; i < len; i++) {
21755
- let $img = null;
21756
- if ( /ul/i.test($els[i].tagName) ) {
21757
- for (let e = 0, eLen = $els[i].length; e < eLen; e++) {
21758
- //let $li = new DOMParser().parseFromString($els[i].innerHTML, 'text/html');
21759
- let $li = $$els[i];
21760
- for (let l = 0, lLen = $li.length; l < lLen; l++) {
21761
- if ( /img/i.test($li[l]) ) {
21762
- $img = $li[l];
21763
- $img.setAttribute('');
21764
-
21765
- index++;
21766
- }
21767
- }
21768
-
21769
- }
21770
- } else if ( /img/i.test($els[i].tagName) ) {
21771
- $img = $els[i];
21772
- deleteLinkId = uploadTriggerId + '-'+index+'-delete-trigger';
21773
- let file = $img.src.substring($img.src.lastIndexOf('/')+1);
21774
- $uploadTrigger.customFiles.push({
21775
- name: file,
21776
- deleteLinkId: deleteLinkId
21777
- });
21778
- // bind reset trigger
21779
- bindUploadResetOrDeleteTrigger(bindingType, $uploadTrigger, index);
22419
+ let $img = $els[i];
22420
+ deleteLinkId = uploadTriggerId + '-'+index+'-delete-trigger';
22421
+ let file = $img.getAttribute('data-upload-original-filename') || ( ($img.src) ? $img.src.substring($img.src.lastIndexOf('/')+1) : '' );
22422
+ $uploadTrigger.customFiles.push({
22423
+ name: file,
22424
+ deleteLinkId: deleteLinkId
22425
+ });
22426
+ // bind reset trigger
22427
+ bindUploadResetOrDeleteTrigger(bindingType, $uploadTrigger, index);
21780
22428
 
21781
- index++;
21782
- }
22429
+ index++;
21783
22430
  }
21784
22431
  }
21785
22432
 
@@ -21811,6 +22458,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
21811
22458
  // setTimeout(() => {
21812
22459
  // removeListner(gina, $inputs[f], 'change');
21813
22460
  // }, 0);
22461
+ $form.boundListeners.push({ el: $inputs[f], evt: 'change', fn:
21814
22462
  addListener(gina, $inputs[f], 'change', function(event) {
21815
22463
  event.preventDefault();
21816
22464
  var $el = event.currentTarget;
@@ -21924,8 +22572,8 @@ function ValidatorPlugin(rules, data, formId, culture) {
21924
22572
  if ( typeof($el.form) != 'undefined' ) {
21925
22573
 
21926
22574
  // adding virtual fields
21927
- var fieldPrefix = 'files'; // by default
21928
- var fieldName = $el.getAttribute('data-gina-form-upload-prefix') || $el.name || $el.getAttribute('name');
22575
+ // #B862 — the prefix rule the reset removes the fields by (see getUploadFieldPrefix)
22576
+ var fieldPrefix = getUploadFieldPrefix($el);
21929
22577
  var fieldId = $el.id || $el.getAttribute('id');
21930
22578
 
21931
22579
  var hasPreviewContainer = false;
@@ -21951,12 +22599,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
21951
22599
  hasPreviewContainer = true;
21952
22600
  }
21953
22601
 
21954
- if (fieldName) {
21955
- fieldPrefix = fieldName
21956
- }
21957
-
21958
22602
  var hiddenFields = []
21959
- , hiddenFieldObject = null
21960
22603
  , mandatoryFields = [
21961
22604
  'name'
21962
22605
  , 'group'
@@ -21970,117 +22613,10 @@ function ValidatorPlugin(rules, data, formId, culture) {
21970
22613
  , 'mime'
21971
22614
  , 'preview'
21972
22615
  ]
21973
- , formInputsFields = $el.form.getElementsByTagName('INPUT')
21974
- , fieldType = null
21975
- , hiddenField = null
21976
- , _userName = null
21977
- , _altId = null
21978
- , _name = null
21979
- , _nameRe = null
21980
- , subPrefix = null
21981
- , uploadFields = {}
21982
22616
  ;
21983
22617
 
21984
- for (var _f = 0, _fLen = files.length; _f < _fLen; ++_f) { // for each file
21985
- // binding upload reset trigger
21986
- bindUploadResetOrDeleteTrigger('reset', $el, _f);
21987
- hiddenFields[_f] = null;
21988
- subPrefix = fieldPrefix + '['+ _f +']';
21989
- _nameRe = new RegExp('^'+subPrefix.replace(/\[/g, '\\[').replace(/\]/g, '\\]'));
21990
- // collecting existing DOM fields
21991
- for (var h = 0, hLen = formInputsFields.length; h < hLen; ++h) {
21992
- fieldType = formInputsFields[h].getAttribute('type');
21993
- hiddenField = null;
21994
- _name = null, _userName = null;
21995
- // #B731 — read once from the file input, above
21996
- // was: errorField= formInputsFields[h].getAttribute('data-gina-form-upload-error') || fieldId + '-error' || null;
21997
-
21998
- if (fieldType && /hidden/i.test(fieldType) ) {
21999
- hiddenField = formInputsFields[h];
22000
-
22001
- _name = ( /\[\w+\]$/i.test(hiddenField.name) )
22002
- ? hiddenField.name.match(/\[\w+\]$/)[0].replace(/\[|\]/g, '')
22003
- : hiddenField.name;
22004
- _userName = ( /\[\w+\]$/i.test(hiddenField.name) )
22005
- ? hiddenField.name.match(/\[\w+\]$/)[0].replace(/\[|\]/g, '')
22006
- : hiddenField.name;
22007
-
22008
- // mandatory informations
22009
- if (
22010
- hiddenField
22011
- && typeof(_name) != 'undefiend'
22012
- && mandatoryFields.indexOf( _name ) > -1
22013
- && _nameRe.test( hiddenField.name )
22014
- ) {
22015
-
22016
- if (!hiddenFields[_f] )
22017
- hiddenFields[_f] = {};
22018
-
22019
- if ( /\[preview\]/i.test(hiddenField.name) ) {
22020
- if ( typeof(hiddenFields[_f].preview) == 'undefined' )
22021
- hiddenFields[_f].preview = {};
22022
-
22023
- hiddenFields[_f].preview[_name] = hiddenField;
22024
- } else {
22025
- hiddenFields[_f][_name] = hiddenField;
22026
- }
22027
- } else if (
22028
- hiddenField
22029
- && typeof(_name) != 'undefiend'
22030
- && mandatoryFields.indexOf( _name ) < 0
22031
- && _nameRe.test( hiddenField.name )
22032
- ) { // defined by user
22033
- if (!hiddenFields[_f] )
22034
- hiddenFields[_f] = {};
22035
-
22036
- if ( /\[preview\]/i.test(hiddenField.name) ) {
22037
- if ( typeof(hiddenFields[_f].preview) == 'undefined' )
22038
- hiddenFields[_f].preview = {};
22039
-
22040
- hiddenFields[_f].preview[_userName] = hiddenField;
22041
- } else {
22042
- hiddenFields[_f][_userName] = hiddenField;
22043
- }
22044
- }
22045
- }
22046
- }
22047
-
22048
- // completing by adding non-declared mandatoring fields in the DOM: all but preview
22049
- for (var m = 0, mLen = mandatoryFields.length; m < mLen; ++m) {
22050
- // optional, must be set by user
22051
- // needs recheck
22052
- if (!hiddenFields[_f] )
22053
- hiddenFields[_f] = {};
22054
-
22055
- if ( typeof(hiddenFields[_f][ mandatoryFields[m] ]) == 'undefined' ) {
22056
- // #B459 — `preview` is the one slot that is never a flat input:
22057
- // its value is an OBJECT (`{location, uri, tmpUri, width, height}`),
22058
- // which an input's `.value` can only hold as "[object Object]".
22059
- // A form that declares no `[preview][...]` sub-fields gets an
22060
- // EMPTY sub-field map instead, so the fill loop still visits the
22061
- // key (the nested thumbnail is rendered from there) and posts
22062
- // nothing for it — the documented field set. Declaring the
22063
- // sub-fields stays the opt-in for persisting the preview.
22064
- if ( mandatoryFields[m] == 'preview' ) {
22065
- hiddenFields[_f].preview = {};
22066
- continue;
22067
- }
22068
-
22069
- _name = fieldPrefix +'['+ _f +']['+ mandatoryFields[m] +']';
22070
- // create input & add it to the form
22071
- $newVirtualField = document.createElement('input');
22072
- $newVirtualField.type = 'hidden';
22073
- $newVirtualField.id = 'input.' + uuid();
22074
- $newVirtualField.name = _name;
22075
- $newVirtualField.value = '';
22076
-
22077
- $el.form.appendChild($newVirtualField);
22078
- hiddenFields[_f][ mandatoryFields[m] ] = $el.form[$el.form.length-1];// last added
22079
- }
22080
-
22081
- }
22082
-
22083
- } // EO for files
22618
+ // #B858 — built again on every selection (see buildUploadHiddenFields)
22619
+ hiddenFields = buildUploadHiddenFields($el, fieldPrefix, files.length, mandatoryFields, true);
22084
22620
 
22085
22621
  $uploadForm.uploadProperties = {
22086
22622
  id : $el.form.id || $el.getAttribute('id'),
@@ -22133,6 +22669,18 @@ function ValidatorPlugin(rules, data, formId, culture) {
22133
22669
  } else {
22134
22670
  document.body.appendChild($uploadForm)
22135
22671
  }
22672
+ } else {
22673
+ // #B858 — a selection that finds the input's virtual upload form builds its
22674
+ // own hidden fields: they were built only with that form, so after a reset
22675
+ // (which takes them out of the real form) the next selection filled inputs
22676
+ // no longer in it and the save posted no file, and a selection with more
22677
+ // files than the first had none for its new files. In a popin the lookup
22678
+ // above reads a parsed COPY of the popin, without the upload's properties:
22679
+ // they are on the document's element.
22680
+ $uploadForm = document.getElementById(uploadFormId) || $uploadForm;
22681
+ if ( $el.form && $uploadForm.uploadProperties ) {
22682
+ $uploadForm.uploadProperties.uploadFields = buildUploadHiddenFields($el, getUploadFieldPrefix($el), files.length, $uploadForm.uploadProperties.mandatoryFields, false);
22683
+ }
22136
22684
  }
22137
22685
 
22138
22686
  // #R8 — upload-progress kickoff: show activity from selection
@@ -22239,12 +22787,23 @@ function ValidatorPlugin(rules, data, formId, culture) {
22239
22787
  throw formErr;
22240
22788
  }
22241
22789
  }
22242
- });
22790
+ }) });
22243
22791
 
22244
22792
 
22245
22793
  }
22246
22794
  }// EO Binding input
22247
22795
 
22796
+ /**
22797
+ * Live-checks a <select> after its `change`: validates the select alone, then, in that
22798
+ * pass's callback, the whole form, and displays each pass's error for this select only.
22799
+ * The element is always `$el`, never the global `event` (#B781).
22800
+ *
22801
+ * @inner
22802
+ * @private
22803
+ * @param {HTMLSelectElement} $el - The select that changed
22804
+ * @param {object} $form - The form's validator record (`target`, `rules`)
22805
+ * @returns {void}
22806
+ */
22248
22807
  var updateSelect = function($el, $form) {
22249
22808
  $el.setAttribute('data-value', $el.value);
22250
22809
  // If Live check enabled, proceed to silent validation
@@ -22264,20 +22823,27 @@ function ValidatorPlugin(rules, data, formId, culture) {
22264
22823
  // && typeof($form.isBeingReseted) == 'undefined'
22265
22824
  ) {
22266
22825
  var localField = {}, $localField = {}, $localForm = null;
22267
- $localForm = $el.form;//event.target.form
22268
- localField[event.target.name] = event.target.value;
22269
- $localField[event.target.name] = event.target;
22826
+ // #B781 — the select is read from `$el`, the element this function is given. It
22827
+ // was read from the global `event` (`window.event`), which is the `change` only
22828
+ // while that dispatch runs: validate() calls back inside its own `validated.<id>`
22829
+ // dispatch on the node it validated, so in the whole-form pass below the target
22830
+ // was the FORM, the touched field's name became the form's own `name`, and the
22831
+ // select's error from the whole-form check was never displayed.
22832
+ // was: localField[event.target.name] = event.target.value; (and each event.target below)
22833
+ $localForm = $el.form;
22834
+ localField[$el.name] = $el.value;
22835
+ $localField[$el.name] = $el;
22270
22836
 
22271
22837
  instance.$forms[$localForm.getAttribute('id')].isValidating = true;
22272
- validate(event.target, localField, $localField, $form.rules, function onLiveValidation(result){
22838
+ validate($el, localField, $localField, $form.rules, function onLiveValidation(result){
22273
22839
  instance.$forms[$localForm.getAttribute('id')].isValidating = false;
22274
22840
  var isFormValid = result.isValid();
22275
22841
  //console.debug('onSilentPreGlobalLiveValidation: '+ isFormValid, result);
22276
22842
  if (isFormValid) {
22277
22843
  //resetting error display
22278
- handleErrorsDisplay($localForm, {}, result.data, event.target.name);
22844
+ handleErrorsDisplay($localForm, {}, result.data, $el.name);
22279
22845
  } else {
22280
- handleErrorsDisplay($localForm, result.error, result.data, event.target.name);
22846
+ handleErrorsDisplay($localForm, result.error, result.data, $el.name);
22281
22847
  }
22282
22848
  //updateSubmitTriggerState( $localForm, isFormValid );
22283
22849
  // data-gina-form-required-before-submit
@@ -22300,7 +22866,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
22300
22866
  if (!isFormValid) {
22301
22867
  instance.$forms[formId].errors = gResult.error;
22302
22868
  // Fixed on 2026-04-09 - only display errors for the touched field
22303
- var _touchedField = event.target.name;
22869
+ var _touchedField = $el.name;
22304
22870
  if ( typeof(gResult.error[_touchedField]) != 'undefined' ) {
22305
22871
  handleErrorsDisplay($gForm, gResult.error, gResult.data, _touchedField);
22306
22872
  }
@@ -22352,13 +22918,14 @@ function ValidatorPlugin(rules, data, formId, culture) {
22352
22918
  };
22353
22919
  }
22354
22920
 
22921
+ $form.boundListeners.push({ el: $select[s], evt: 'change', fn:
22355
22922
  addListener(gina, $select[s], 'change', function(event) {
22356
22923
  var $el = event.target;
22357
22924
 
22358
22925
  if (/select/i.test($el.type) ) {
22359
22926
  updateSelect($el, $form);
22360
22927
  }
22361
- });
22928
+ }) });
22362
22929
 
22363
22930
 
22364
22931
  if ($select[s].options && !$form.fieldsSet[ elId ]) {
@@ -22775,11 +23342,12 @@ function ValidatorPlugin(rules, data, formId, culture) {
22775
23342
  proceed = function ($el, evt) {
22776
23343
 
22777
23344
  // recover default state only on value === true || false
23345
+ $form.boundListeners.push({ el: $el, evt: evt, fn:
22778
23346
  addListener(gina, $el, evt, function(event) {
22779
23347
  updateCheckBox(event.target);
22780
23348
 
22781
23349
  triggerEvent(gina, event.target, 'changed.'+ event.target.id);
22782
- });
23350
+ }) });
22783
23351
 
22784
23352
  // default state recovery
22785
23353
  updateCheckBox($el, true);
@@ -22803,12 +23371,13 @@ function ValidatorPlugin(rules, data, formId, culture) {
22803
23371
 
22804
23372
  proceed = function ($el, evt) {
22805
23373
  // recover default state
23374
+ $form.boundListeners.push({ el: $el, evt: evt, fn:
22806
23375
  addListener(gina, $el, evt, function(event) {
22807
23376
  //cancelEvent(event);
22808
23377
  updateRadio(event.target);
22809
23378
 
22810
23379
  triggerEvent(gina, event.target, 'changed.'+ event.target.id);
22811
- });
23380
+ }) });
22812
23381
 
22813
23382
  // default state recovery
22814
23383
  updateRadio($el, true);
@@ -23230,6 +23799,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
23230
23799
  // handle form reset
23231
23800
  subEvent = 'reset.'+$target.id;
23232
23801
  if ( typeof(gina.events[subEvent]) == 'undefined' ) {
23802
+ $form.boundListeners.push({ el: $target, evt: subEvent, fn:
23233
23803
  addListener(gina, $target, subEvent, function(e) {
23234
23804
  e.preventDefault();
23235
23805
 
@@ -23251,17 +23821,25 @@ function ValidatorPlugin(rules, data, formId, culture) {
23251
23821
  updateSubmitTriggerState( $form.target , isFormValid );
23252
23822
  $form.target.dataset.ginaFormIsResetting = false;
23253
23823
  });
23254
- })
23824
+ }) })
23255
23825
  }
23256
23826
  // Form-level proxies: capture bubbled events from in-tree controls.
23257
- addListener(gina, $target, 'reset', resetProxyHandler);
23258
- addListener(gina, $target, 'keydown', keydownProxyHandler);
23259
- addListener(gina, $target, 'keyup', keyupProxyHandler);
23260
- addListener(gina, $target, 'focusin', focusinProxyHandler);
23261
- addListener(gina, $target, 'focusout', focusoutProxyHandler);
23262
- addListener(gina, $target, 'change', changeProxyHandler);
23263
- addListener(gina, $target, 'click', clickProxyHandler);
23264
- addListener(gina, $target, 'animationstart', autofillProxyHandler); // #B478
23827
+ $form.boundListeners.push({ el: $target, evt: 'reset', fn:
23828
+ addListener(gina, $target, 'reset', resetProxyHandler) });
23829
+ $form.boundListeners.push({ el: $target, evt: 'keydown', fn:
23830
+ addListener(gina, $target, 'keydown', keydownProxyHandler) });
23831
+ $form.boundListeners.push({ el: $target, evt: 'keyup', fn:
23832
+ addListener(gina, $target, 'keyup', keyupProxyHandler) });
23833
+ $form.boundListeners.push({ el: $target, evt: 'focusin', fn:
23834
+ addListener(gina, $target, 'focusin', focusinProxyHandler) });
23835
+ $form.boundListeners.push({ el: $target, evt: 'focusout', fn:
23836
+ addListener(gina, $target, 'focusout', focusoutProxyHandler) });
23837
+ $form.boundListeners.push({ el: $target, evt: 'change', fn:
23838
+ addListener(gina, $target, 'change', changeProxyHandler) });
23839
+ $form.boundListeners.push({ el: $target, evt: 'click', fn:
23840
+ addListener(gina, $target, 'click', clickProxyHandler) });
23841
+ $form.boundListeners.push({ el: $target, evt: 'animationstart', fn:
23842
+ addListener(gina, $target, 'animationstart', autofillProxyHandler) }); // #B478
23265
23843
  }
23266
23844
 
23267
23845
  proceed();
@@ -23306,6 +23884,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
23306
23884
  evt = 'validate.' + _id;
23307
23885
  proceed = function () {
23308
23886
  // attach form submit event
23887
+ $form.boundListeners.push({ el: $target, evt: evt, fn:
23309
23888
  addListener(gina, $target, evt, function(event) {
23310
23889
  cancelEvent(event);
23311
23890
 
@@ -23399,13 +23978,8 @@ function ValidatorPlugin(rules, data, formId, culture) {
23399
23978
  }
23400
23979
  }
23401
23980
  }
23402
- })
23403
- }
23404
- // cannot be binded twice
23405
- if ( typeof(gina.events[evt]) != 'undefined' && gina.events[evt] == 'validate.' + _id ) {
23406
- removeListener(gina, $form, evt, proceed)
23981
+ }) })
23407
23982
  }
23408
-
23409
23983
  proceed();
23410
23984
 
23411
23985
  var bindSubmitEl = function (evt, $submit) {
@@ -23424,6 +23998,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
23424
23998
  // same string `clickProxyHandler` compares against. Read at the :8037
23425
23999
  // dispatch gate.
23426
24000
  $submit.__ginaSubmitBoundFor = evt;
24001
+ $form.boundListeners.push({ el: $submit, evt: evt, fn:
23427
24002
  addListener(gina, $submit, evt, function(event) {
23428
24003
  // start validation
23429
24004
  cancelEvent(event);
@@ -23501,7 +24076,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
23501
24076
  triggerEvent(gina, $target, 'validate.' + _id, result)
23502
24077
  })
23503
24078
  }
23504
- });
24079
+ }) });
23505
24080
  } // EO bindSubmitEl
23506
24081
 
23507
24082
 
@@ -23602,7 +24177,8 @@ function ValidatorPlugin(rules, data, formId, culture) {
23602
24177
  // policies). A preventDefault-only listener sets event.defaultPrevented exactly
23603
24178
  // as the inline handler did, so the form-level clickProxyHandler's
23604
24179
  // `if (event.defaultPrevented) return` guard still short-circuits identically.
23605
- addListener(gina, $submit, 'click', function(e) { e.preventDefault(); });
24180
+ $form.boundListeners.push({ el: $submit, evt: 'click', fn:
24181
+ addListener(gina, $submit, 'click', function(e) { e.preventDefault(); }) });
23606
24182
  }
23607
24183
  // (an existing onclick is left untouched, as before; the dead else-if append
23608
24184
  // branch — it only mutated a local, never written back — was removed.)
@@ -23638,6 +24214,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
23638
24214
  evt = 'submit';
23639
24215
 
23640
24216
  // submit proxy
24217
+ $form.boundListeners.push({ el: $target, evt: evt, fn:
23641
24218
  addListener(gina, $target, evt, function(e) {
23642
24219
 
23643
24220
  var $target = e.target
@@ -23891,7 +24468,7 @@ function ValidatorPlugin(rules, data, formId, culture) {
23891
24468
  // }
23892
24469
  })
23893
24470
  }
23894
- });
24471
+ }) });
23895
24472
 
23896
24473
 
23897
24474
 
@@ -26469,8 +27046,15 @@ define('gina/popin', [ 'require', 'lib/domain', 'lib/loading-state', 'lib/merge'
26469
27046
 
26470
27047
  var registeredPopins = [];
26471
27048
 
26472
- // Cached regex — avoids repeated RegExp construction in click handlers
26473
- var _rePopinClick = new RegExp('^popin\\.click\\.gina-popin-' + instance.id);
27049
+ // Cached regex — avoids repeated RegExp construction in click handlers.
27050
+ // #B876: the `-` after the instance id is load-bearing. Instance ids are
27051
+ // `'gina-popins-' + _nextId()` (`gina-popins-gp-1`, `gina-popins-gp-14`, … from one shared
27052
+ // counter) and every engine-built click trigger id is
27053
+ // `popin.click.gina-popin-<instance.id>-<_nextId()>-<name>`, so without the delimiter the
27054
+ // regex of `gina-popins-gp-1` also matched the triggers of `gina-popins-gp-14`: one click
27055
+ // fired two proxies, the popin loaded twice, and the second load replaced the bound form
27056
+ // before it was submitted.
27057
+ var _rePopinClick = new RegExp('^popin\\.click\\.gina-popin-' + instance.id + '-');
26474
27058
 
26475
27059
 
26476
27060
  /**
@@ -31237,6 +31821,29 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
31237
31821
  * defined). An explicitly empty `{}` filter is legal and matches every
31238
31822
  * record; `null` is a legal needle comparing strictly against stored values.
31239
31823
  *
31824
+ * A key holding a dot is a property path (`'address.city'`), also inside an
31825
+ * array of objects (`'reviews[*].ratings.score'`). A dotted key that is not a
31826
+ * property path matches nothing.
31827
+ *
31828
+ * Query results (`find`, `orderBy`, `limit`, `notIn`, …) are Arrays carrying
31829
+ * these methods, so calls chain. Their `filter` takes either a function, which
31830
+ * filters like `Array.prototype.filter` and returns a chainable result, or a
31831
+ * field name or a list of field names, which projects each row onto those
31832
+ * fields and returns a plain array.
31833
+ *
31834
+ * Search options. `setSearchOption(field, 'isCaseSensitive', false)` makes the
31835
+ * next search compare `field` without regard to case. It applies to that one
31836
+ * call (`find`, `findOne`, `update`, `replace`, `delete`, …) and is then
31837
+ * cleared. The value is matched as TEXT, whole: a dot, a parenthesis or any
31838
+ * other character means itself.
31839
+ *
31840
+ * Two things read a value as something other than text, with or without a
31841
+ * search option: a value holding `<`, `>` or `=` is a comparison (`'>= 1'`),
31842
+ * and the value `not null`, in any case, matches every defined, non-null
31843
+ * value. `{ searchOptionRules: { skipEval: true } }`, passed to the
31844
+ * constructor, turns the comparison off for the plain (non-dotted) keys of
31845
+ * that Collection; it changes neither `not null` nor a dotted key.
31846
+ *
31240
31847
  * @class Collection
31241
31848
  * @constructor
31242
31849
  * @this {Collection}
@@ -31245,6 +31852,7 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
31245
31852
  * @param {object} [options] - Options
31246
31853
  * @param {boolean} [options.useLocalStorage=false] - Persist to `localStorage` (browser only)
31247
31854
  * @param {string} [options.locale='en'] - Locale used for string comparison
31855
+ * @param {object} [options.searchOptionRules] - Overrides of the search-option rule table: `skipEval` (boolean, default `false`), and the `re` template and `modifiers` flags of an `isCaseSensitive` entry (`false` or `true`). In a template `%s` stands for the filter value, which is always matched as text: `{ isCaseSensitive: { false: { re: '^%s', modifiers: 'i' } } }` makes the case-insensitive search a prefix search
31248
31856
  * @returns {object} Collection instance (the enriched `content` array)
31249
31857
  * @throws {Error} When `content` is not an Array
31250
31858
  *
@@ -31269,6 +31877,14 @@ if ( ( typeof(module) !== 'undefined' ) && module.exports ) {
31269
31877
  * col.delete({ id: 2 });
31270
31878
  * col.orderBy({ name: 'asc' });
31271
31879
  * col.toRaw(); // strip _uuid/_hasItsOwnUuid
31880
+ * col.find({}).filter(function (r) { return r.id > 1; }); // chainable: .toRaw(), .orderBy(), …
31881
+ * col.find({}).filter(['id', 'name']); // projection: [{ id, name }, …]
31882
+ *
31883
+ * // search option — the next search ignores the case of `name`; the value is text
31884
+ * col.setSearchOption('name', 'isCaseSensitive', false).findOne({ name: 'ALICE' }); // { id:1, name:'Alice' }
31885
+ * col.setSearchOption('name', 'isCaseSensitive', false).find({ name: 'a.' }); // [] — the dot is a dot
31886
+ * // the same option as one object, keyed by field
31887
+ * col.setSearchOption({ name: { isCaseSensitive: false } }).findOne({ name: 'BOB' }); // { id:2, name:'Bob' }
31272
31888
  */
31273
31889
  function Collection(content, options) {
31274
31890
 
@@ -31349,6 +31965,35 @@ function Collection(content, options) {
31349
31965
  if (/^"(?:\\.|[^"\\])*"$/.test(right)) { right = JSON.parse(right); }
31350
31966
  return JSON.stringify(String(left)) + op + JSON.stringify(right);
31351
31967
  };
31968
+ // #B818 — every character a RegExp reads as syntax outside a character class.
31969
+ var REGEXP_SYNTAX_RE = /[\\^$.*+?()[\]{}|]/g;
31970
+ /**
31971
+ * Build the RegExp of one search-option rule for one filter value (#B818, #B819).
31972
+ *
31973
+ * The rule's `re` is a template in which `%s` stands for the value. The
31974
+ * template is the pattern; the value is TEXT: every character a RegExp reads
31975
+ * as syntax is escaped before the value takes the place of `%s`, and a
31976
+ * function replacer puts it there, so a `$` sequence in the value (`$&`,
31977
+ * `$$`, …) is not expanded. The pattern is built in a local and the rule
31978
+ * entry is only read: the next value — on this instance, or on another one
31979
+ * sharing the caller's rule table — starts from the same template.
31980
+ *
31981
+ * @inner
31982
+ * @private
31983
+ * @param {object} ruleDef - A rule entry of the search-option rule table
31984
+ * @param {string} ruleDef.re - The template, e.g. `'^%s$'`
31985
+ * @param {string} [ruleDef.modifiers] - RegExp flags, e.g. `'i'`
31986
+ * @param {*} value - The filter value; read as a string
31987
+ * @returns {RegExp} the expression matching `value` as text inside the template
31988
+ *
31989
+ * @example
31990
+ * buildSearchOptionRegExp({ re: '^%s$', modifiers: 'i' }, 'a.b'); // /^a\.b$/i
31991
+ */
31992
+ var buildSearchOptionRegExp = function(ruleDef, value) {
31993
+ var text = String(value).replace(REGEXP_SYNTAX_RE, '\\$&');
31994
+ var pattern = ruleDef.re.replace(/\%s/, function onValue() { return text; });
31995
+ return (ruleDef.modifiers) ? new RegExp(pattern, ruleDef.modifiers) : new RegExp(pattern);
31996
+ };
31352
31997
  var tryEval = function(condition) {
31353
31998
  var m = (typeof(condition) == 'string') ? condition.match(CONDITION_RE) : null;
31354
31999
  if (!m) {
@@ -31414,28 +32059,40 @@ function Collection(content, options) {
31414
32059
  /**
31415
32060
  * Set local search option for the current collection method call
31416
32061
  *
31417
- * eg.:
31418
- * var recCollection = new Collection(arrayCollection);
31419
- * var rec = recCollection
31420
- * .setSearchOption('city', 'isCaseSensitive', false)
31421
- * .find({ city: 'cap Town' });
31422
- *
31423
- * eg.:
31424
- * var recCollection = new Collection(arrayCollection);
31425
- * var searchOptions = {
31426
- * city: {
31427
- * isCaseSensitive: false
31428
- * }
31429
- * };
31430
- * var rec = recCollection
31431
- * .setSearchOption(searchOptions)
31432
- * .find({ city: 'cap Town' }); *
31433
- *
31434
- * @param {object|string} searchOptionObject or searchOptionTargetedProperty
31435
- * @param {string} [searchRule]
31436
- * @param {boolean} [searchRuleValue] - true to enable, false to disabled
32062
+ * The option applies to the next search only (`find`, `findOne`, `update`,
32063
+ * `replace`, `delete`, …) and is then cleared. The value of that search is
32064
+ * matched as text: a pattern character in it means itself (#B818).
32065
+ *
32066
+ * Two forms. Three arguments set one rule on one field and ADD to what an
32067
+ * earlier call set, so calls chain per field. One object, keyed by field,
32068
+ * REPLACES what was set: `{ <field>: { <rule>: <value> } }` (#B820). The
32069
+ * object is copied: it is neither kept nor changed. The only rule is
32070
+ * `isCaseSensitive` (`true` or `false`; the texts `'true'` / `'false'` are
32071
+ * read as booleans). `skipEval` is a constructor option
32072
+ * (`options.searchOptionRules`): as a top-level key of the object it is
32073
+ * accepted and has no effect.
32074
+ *
32075
+ * @param {object|string} searchOptionObject or searchOptionTargetedProperty - the options keyed by field, or the field name
32076
+ * @param {string} [searchRule] - the rule name (three-argument form)
32077
+ * @param {boolean} [searchRuleValue] - the rule's value: `false` ignores the case, `true` keeps it
31437
32078
  *
31438
32079
  * @returns {object} instance with local search options
32080
+ * @throws {Error} on zero, two or more than three arguments
32081
+ * @throws {Error} when a single argument is not an object
32082
+ * @throws {Error} `<rule> is not an allowed searchOption !` on an unknown rule name
32083
+ * @throws {Error} when a field's entry in the object form is not an object of rules
32084
+ *
32085
+ * @example
32086
+ * // three arguments: one rule on one field
32087
+ * var rec = new Collection(rows)
32088
+ * .setSearchOption('city', 'isCaseSensitive', false)
32089
+ * .find({ city: 'cap Town' });
32090
+ *
32091
+ * @example
32092
+ * // one object, keyed by field
32093
+ * var rec = new Collection(rows)
32094
+ * .setSearchOption({ city: { isCaseSensitive: false }, country: { isCaseSensitive: false } })
32095
+ * .find({ city: 'cap Town', country: 'south africa' });
31439
32096
  */
31440
32097
  instance['setSearchOption'] = function() {
31441
32098
 
@@ -31453,12 +32110,41 @@ function Collection(content, options) {
31453
32110
  if ( typeof(arguments[0]) != 'object' )
31454
32111
  throw new Error('searchOption must be an object');
31455
32112
 
31456
- for (var prop in arguments[0]) {
31457
- if ( typeof(searchOptionRules[prop]) == 'undefined' )
31458
- throw new Error(arguments[1] + ' is not an allowed searchOption !');
32113
+ // #B820 — the object form is keyed by FIELD: { <field>: { <rule>: <value> } }.
32114
+ // The loop below tested each top-level key — a field name — against the
32115
+ // rule table, so the documented shape threw, with a message read from the
32116
+ // second argument, which this form does not have. Each field's rule names
32117
+ // are now tested instead, and the options are COPIED: the caller's object
32118
+ // is neither kept nor changed by the search. A top-level key that names a
32119
+ // rule is accepted and has no effect, as before.
32120
+ // for (var prop in arguments[0]) {
32121
+ // if ( typeof(searchOptionRules[prop]) == 'undefined' )
32122
+ // throw new Error(arguments[1] + ' is not an allowed searchOption !');
32123
+ // }
32124
+ //
32125
+ // localSearchOptions = arguments[0];
32126
+ var given = arguments[0], normalized = {};
32127
+ for (var prop in given) {
32128
+ if ( typeof(searchOptionRules[prop]) != 'undefined' )
32129
+ continue;
32130
+
32131
+ if ( !given[prop] || typeof(given[prop]) != 'object' || Array.isArray(given[prop]) )
32132
+ throw new Error('searchOption `' + prop + '` must be an object of rules, e.g. { isCaseSensitive: false }');
32133
+
32134
+ normalized[prop] = {};
32135
+ for (var ruleName in given[prop]) {
32136
+ if ( typeof(searchOptionRules[ruleName]) == 'undefined' )
32137
+ throw new Error(ruleName + ' is not an allowed searchOption !');
32138
+
32139
+ if ( /true|false/i.test(given[prop][ruleName]) ) {
32140
+ normalized[prop][ruleName] = /true/i.test(given[prop][ruleName]) ? true : false
32141
+ } else {
32142
+ normalized[prop][ruleName] = given[prop][ruleName]
32143
+ }
32144
+ }
31459
32145
  }
31460
32146
 
31461
- localSearchOptions = arguments[0];
32147
+ localSearchOptions = normalized;
31462
32148
  } else {
31463
32149
 
31464
32150
  if ( !localSearchOptions )
@@ -31487,7 +32173,8 @@ function Collection(content, options) {
31487
32173
  * find
31488
32174
  *
31489
32175
  * Filters the collection content with one or more filter objects.
31490
- * Passing more than one filter object acts as an OR clause.
32176
+ * Passing more than one filter object acts as an OR clause: a row is listed
32177
+ * once, in collection order, whatever the number of filters it matches (#B827).
31491
32178
  *
31492
32179
  * Every filter value must be DEFINED. A key whose value is `undefined`
31493
32180
  * makes the whole call throw an Error naming the offending key: the JSON
@@ -31501,6 +32188,11 @@ function Collection(content, options) {
31501
32188
  * @param {boolean} [withOrClause] - trailing boolean, forces OR mode
31502
32189
  * @throws {Error} when any filter key's value is `undefined`
31503
32190
  * @returns {array} result - decorated result set (chainable)
32191
+ *
32192
+ * @example
32193
+ * var col = new Collection([{ name: 'a', g: 'x' }, { name: 'b', g: 'x' }, { name: 'c', g: 'y' }]);
32194
+ * col.find({ g: 'x' }); // rows `a` and `b`
32195
+ * col.find({ name: 'a' }, { g: 'x' }); // rows `a` and `b` too: `a` matches both filters and is listed once
31504
32196
  */
31505
32197
  instance['find'] = function() {
31506
32198
  // reset
@@ -31675,13 +32367,22 @@ function Collection(content, options) {
31675
32367
  continue
31676
32368
  }
31677
32369
 
31678
- searchOptionRules[rule][searchOptions[field][rule]].re = searchOptionRules[rule][searchOptions[field][rule]].re.replace(/\%s/, filter);
31679
-
31680
- if (searchOptionRules[rule][searchOptions[field][rule]].modifiers) {
31681
- re = new RegExp(searchOptionRules[rule][searchOptions[field][rule]].re, searchOptionRules[rule][searchOptions[field][rule]].modifiers);
31682
- } else {
31683
- re = new RegExp(searchOptionRules[rule][searchOptions[field][rule]].re);
31684
- }
32370
+ // #B818 / #B819 — the value is matched as TEXT and the rule table is
32371
+ // only read. The statements below spliced the raw value into the
32372
+ // rule's template with a string replacer and ASSIGNED the result to
32373
+ // the rule entry: a value holding a pattern character was compiled
32374
+ // as a pattern (it threw out of the search, or matched other rows),
32375
+ // a `$` sequence in a value was expanded, and the entry kept the
32376
+ // FIRST value, so every later option search on the instance — or on
32377
+ // any instance sharing the caller's rule table — matched that value.
32378
+ // searchOptionRules[rule][searchOptions[field][rule]].re = searchOptionRules[rule][searchOptions[field][rule]].re.replace(/\%s/, filter);
32379
+ //
32380
+ // if (searchOptionRules[rule][searchOptions[field][rule]].modifiers) {
32381
+ // re = new RegExp(searchOptionRules[rule][searchOptions[field][rule]].re, searchOptionRules[rule][searchOptions[field][rule]].modifiers);
32382
+ // } else {
32383
+ // re = new RegExp(searchOptionRules[rule][searchOptions[field][rule]].re);
32384
+ // }
32385
+ re = buildSearchOptionRegExp(searchOptionRules[rule][searchOptions[field][rule]], filter);
31685
32386
 
31686
32387
  if ( re.test(_content) ) {
31687
32388
  ++reValidCount
@@ -31698,11 +32399,33 @@ function Collection(content, options) {
31698
32399
  };
31699
32400
  }
31700
32401
 
32402
+ /**
32403
+ * Search on a dotted key: walk `f` as a property path of `_content`
32404
+ * and compare the value found there with `filter`.
32405
+ *
32406
+ * `f` must be a property path (`a.b.c`, identifiers separated by
32407
+ * dots). Any other dotted key matches nothing: the path check below
32408
+ * refuses it and no value is read.
32409
+ *
32410
+ * @inner
32411
+ * @private
32412
+ * @param {*} filter - The filter value, or a comparison (`'>= 4'`)
32413
+ * @param {string} f - The dotted key
32414
+ * @param {object} _content - The row, or the element of a `[*]` array
32415
+ * @param {number} matched - The conditions matched so far
32416
+ * @returns {{matched: number}} `matched`, plus one when the value matches
32417
+ */
31701
32418
  var searchThroughProp = function(filter, f, _content, matched) {
31702
32419
 
31703
- var field = f.split(/\./g);
31704
- field = field[field.length - 1];
31705
- re = new RegExp('("' + field + '":\\w+)');
32420
+ // #B821 — dead code that could only throw. The expression was built
32421
+ // from the last segment of the filter KEY and never read (the only
32422
+ // read of `re` follows its own assignment, in the search-option
32423
+ // branch above), so a key holding `(`, `)` or `[` threw a
32424
+ // SyntaxError out of the search, before the path check below could
32425
+ // refuse the key like any other dotted key that is not a path.
32426
+ // var field = f.split(/\./g);
32427
+ // field = field[field.length - 1];
32428
+ // re = new RegExp('("' + field + '":\\w+)');
31706
32429
 
31707
32430
  var value = null;
31708
32431
 
@@ -31874,29 +32597,14 @@ function Collection(content, options) {
31874
32597
  }
31875
32598
 
31876
32599
  if (matched == condition ) { // all conditions must be fulfilled to match
31877
- // `this` {Array} is the result of the previous search or the current content
31878
- // TODO - Add a switch
31879
- if (
31880
- withOrClause
31881
- && notInSearchModeEnabled
31882
- && searchIndex.indexOf(tmpContent[o]._uuid) < 0
31883
- || notInSearchModeEnabled
31884
- || !withOrClause
31885
- ) {
31886
- //console.debug('searchIndex ', searchIndex);
31887
- if (!withOrClause || withOrClause && result.indexOf(tmpContent[o]._uuid) < 0 || notInSearchModeEnabled) {
31888
- result[i] = tmpContent[o];
31889
- ++i;
31890
- }
31891
- } else if (
31892
- withOrClause
31893
- && !notInSearchModeEnabled
31894
- ) {
31895
- if (result.indexOf(tmpContent[o]._uuid) < 0) {
31896
- result[i] = tmpContent[o];
31897
- ++i;
31898
- }
31899
- }
32600
+ // #B827 — a row is listed ONCE, whatever the number of filter objects
32601
+ // it matches; the remaining filters are not read for it. The guards that
32602
+ // stood here looked a `_uuid` STRING up in an array of ROWS, so they
32603
+ // never skipped anything: a row matching two filters of an OR call was
32604
+ // listed twice, and a limited result then lost a real row.
32605
+ result[i] = tmpContent[o];
32606
+ ++i;
32607
+ break;
31900
32608
  }
31901
32609
 
31902
32610
  }
@@ -32062,10 +32770,24 @@ function Collection(content, options) {
32062
32770
  * of the resultset :
32063
32771
  * .notIn(filter, false) where false must be a real boolean
32064
32772
  *
32065
- *
32773
+ * #B826 — with a filter object the found rows ARE rows of the searched
32774
+ * array. When no `key` is named and every found row is one, each is taken
32775
+ * out as itself and no comparison key is read: rows carrying neither a
32776
+ * `_uuid` nor an `id` (after `toRaw()` or `update()`) are no longer refused,
32777
+ * and rows sharing an `id` no longer lose the wrong one. A named `key`, and
32778
+ * rows that come from elsewhere (the array form), are compared by key as
32779
+ * before: such rows must carry the named key, a `_uuid` or an `id`.
32066
32780
  *
32067
32781
  * @param {object|array} filters|arrayToFilter - works like find filterss
32068
32782
  * @param {string} [key] - unique id for comparison; faster when provided
32783
+ * @returns {array} result - a copy of the searched rows without the rows found (chainable)
32784
+ * @throws {Error} when rows from elsewhere share no usable comparison key
32785
+ *
32786
+ * @example
32787
+ * var col = new Collection([{ name: 'a' }, { name: 'b' }]);
32788
+ * col.toRaw(); // strips the internal `_uuid` of the rows
32789
+ * col.notIn({ name: 'b' }); // [{ name: 'a' }]
32790
+ * col.notIn([{ name: 'b' }], 'name'); // rows from elsewhere: compared by the named key
32069
32791
  */
32070
32792
  instance['notIn'] = function(){
32071
32793
 
@@ -32109,8 +32831,36 @@ function Collection(content, options) {
32109
32831
  notInSearchModeEnabled = false;
32110
32832
  }
32111
32833
 
32834
+ // #B826 — identity first. With a filter object the found rows ARE rows of
32835
+ // the searched array, so each one is taken out of the clone at its own
32836
+ // place and no comparison key is read: rows carrying neither `_uuid` nor
32837
+ // `id` no longer throw, and rows sharing an `id` no longer lose the wrong
32838
+ // one. A key the caller named, and rows that come from elsewhere, keep
32839
+ // the key comparison below.
32840
+ var source = ( Array.isArray(this) ) ? this : content
32841
+ , byIdentity = false
32842
+ , s = 0
32843
+ , sLen = foundResults.length
32844
+ ;
32845
+ if ( !key && sLen > 0 ) {
32846
+ byIdentity = true;
32847
+ for (; s < sLen; ++s) {
32848
+ if ( source.indexOf(foundResults[s]) < 0 ) {
32849
+ byIdentity = false;
32850
+ break;
32851
+ }
32852
+ }
32853
+ }
32112
32854
 
32113
- if (foundResults.length > 0) {
32855
+ if (byIdentity) {
32856
+ // `currentResult` is the clone of `source`, row for row: going
32857
+ // backwards keeps the places still to visit aligned
32858
+ for (s = source.length - 1; s > -1; --s) {
32859
+ if ( foundResults.indexOf(source[s]) > -1 ) {
32860
+ currentResult.splice(s, 1);
32861
+ }
32862
+ }
32863
+ } else if (foundResults.length > 0) {
32114
32864
 
32115
32865
  // check key
32116
32866
  if (
@@ -32255,15 +33005,42 @@ function Collection(content, options) {
32255
33005
  }
32256
33006
 
32257
33007
  /**
32258
- * update
33008
+ * Merges `set` into every entry `filter` matches, then writes each merged
33009
+ * entry back over the entry it came from. Unlike `.replace()`, the entry's
33010
+ * other fields are kept: `set` wins on the fields it names.
33011
+ *
33012
+ * Each matched entry goes back to its own place: the stored entry itself
33013
+ * when the matched entry is one (the collection, and a chained result,
33014
+ * hand `update()` their own entries), otherwise the stored entry that
33015
+ * shares a key with it — `key` when given, else the internal `_uuid` when
33016
+ * both carry one, else `id` when both do. A key that one of the two lacks
33017
+ * never matches. An entry matched by two filter objects is written once.
33018
+ *
33019
+ * N.B. an updated entry loses the internal `_uuid` the collection gave it,
33020
+ * while the entries left alone keep theirs. Persist `.toRaw()` rather than
33021
+ * the chained array if the data is going to be re-loaded into a new
33022
+ * Collection later.
33023
+ *
33024
+ * @param {object|Array} filter - Entry selector, as `.find()` — or an already-found result
33025
+ * @param {object} set - The fields to merge into each matched entry
33026
+ * @param {string} [key] - Comparison key for a matched entry that is not a stored one; compared as given
33027
+ * @returns {Array} the chainable result set
32259
33028
  *
32260
- * @param {object} filter
32261
- * @param {object} set
33029
+ * @throws {Error} when `filter` or `set` is missing, or a filter value is `undefined`
32262
33030
  *
32263
- * @returns {objet} instance
33031
+ * @example
33032
+ * // every matched entry, each in its own place
33033
+ * col.update({ status: 'draft' }, { status: 'sent' });
33034
+ *
33035
+ * @example
33036
+ * // on a chained result
33037
+ * col.find({ type: 'invoice' }).update({ status: 'draft' }, { status: 'sent' }).toRaw();
32264
33038
  */
32265
33039
  instance['update'] = function() {
32266
33040
  var key = '_uuid' // comparison key is _uuid by default
33041
+ // #B822 — whether the caller named the comparison key. A named key is
33042
+ // compared as given: it is never replaced by `id`.
33043
+ , keyExplicit = false
32267
33044
  , result = null
32268
33045
  , filters = null
32269
33046
  , set = null
@@ -32273,6 +33050,7 @@ function Collection(content, options) {
32273
33050
  // comparison key : _uuid by default, but can be set to id
32274
33051
  if ( typeof(arguments[arguments.length-1]) == 'string' ) {
32275
33052
  key = arguments[arguments.length - 1];
33053
+ keyExplicit = true;
32276
33054
  delete arguments[arguments.length - 1];
32277
33055
  --arguments.length;
32278
33056
  }
@@ -32312,20 +33090,84 @@ function Collection(content, options) {
32312
33090
 
32313
33091
  result = Array.isArray(this) ? this : JSON.clone(content);
32314
33092
  if (foundResults.length > 0 ) {
32315
- var arr = foundResults.toRaw();
33093
+ // #B822 — each matched row is written back over the row it came from.
33094
+ //
33095
+ // The place used to be found by comparing a key on each stored row
33096
+ // with the same key on the merged row:
33097
+ //
33098
+ // if ( typeof(result[r][key]) == 'undefined' && key == '_uuid' && typeof(result[r]['id']) != 'undefined' ) {
33099
+ // key = 'id';
33100
+ // }
33101
+ // if ( result[r][key] == arr[a][key] ) {
33102
+ // result[r] = arr[a];
33103
+ // break;
33104
+ // }
33105
+ //
33106
+ // On a collection and on a chained result the matched rows ARE stored
33107
+ // rows, and `toRaw()` below strips their `_uuid` in place. Rows with
33108
+ // no `id` then compared `undefined == undefined`: every matched row
33109
+ // went over the FIRST stripped row (a row lost, another written
33110
+ // twice, the rest not updated), and so did a single row once an
33111
+ // earlier update() or toRaw() had stripped a row before it. `key`,
33112
+ // once switched to `id`, stayed `id` for every later row, and a row
33113
+ // found through another collection matched nothing.
33114
+ //
33115
+ // The place is now the stored row itself when the matched row is one
33116
+ // (identity); otherwise the stored row that shares a key with it —
33117
+ // `key` when the caller named one, else `_uuid` when both rows carry
33118
+ // one, else `id` when both do — never a key one of the two lacks. A
33119
+ // place this call already wrote is not written again, and a row
33120
+ // matched twice (by two filter objects) is written once.
33121
+ var found = Array.prototype.slice.call(foundResults) // the matched rows themselves, before any place is written
33122
+ , written = [] // the places this call has written
33123
+ , arr = foundResults.toRaw()
33124
+ , slot = -1
33125
+ , cmpKey = null
33126
+ ;
32316
33127
  for (var a = 0, aLen = arr.length; a < aLen; ++a) {
33128
+ if ( found.indexOf(found[a]) < a ) continue; // matched twice: written once
33129
+
32317
33130
  arr[a] = merge(JSON.clone(set), arr[a]);
32318
33131
  // arr[a] = merge(set, arr[a]);
33132
+
33133
+ slot = -1;
32319
33134
  for (var r = 0, rLen = result.length; r < rLen; ++r) {
32320
- if ( typeof(result[r][key]) == 'undefined' && key == '_uuid' && typeof(result[r]['id']) != 'undefined' ) {
32321
- key = 'id';
33135
+ if ( result[r] === found[a] ) {
33136
+ slot = r;
33137
+ break;
32322
33138
  }
33139
+ }
32323
33140
 
32324
- if ( result[r][key] == arr[a][key] ) {
32325
- result[r] = arr[a];
32326
- break;
33141
+ if ( slot < 0 ) {
33142
+ for (r = 0; r < rLen; ++r) {
33143
+ if ( written.indexOf(r) > -1 ) continue;
33144
+
33145
+ cmpKey = key;
33146
+ if (
33147
+ !keyExplicit
33148
+ && (
33149
+ typeof(result[r][cmpKey]) == 'undefined'
33150
+ || typeof(found[a][cmpKey]) == 'undefined'
33151
+ )
33152
+ ) {
33153
+ cmpKey = 'id';
33154
+ }
33155
+
33156
+ if (
33157
+ typeof(result[r][cmpKey]) != 'undefined'
33158
+ && typeof(found[a][cmpKey]) != 'undefined'
33159
+ && result[r][cmpKey] == found[a][cmpKey]
33160
+ ) {
33161
+ slot = r;
33162
+ break;
33163
+ }
32327
33164
  }
32328
33165
  }
33166
+
33167
+ if ( slot > -1 ) {
33168
+ result[slot] = arr[a];
33169
+ written.push(slot);
33170
+ }
32329
33171
  }
32330
33172
  }
32331
33173
 
@@ -32523,7 +33365,10 @@ function Collection(content, options) {
32523
33365
  * .delete({ car: 'toyota', color: red }, { car: 'ford' } ) // will delete all `toyota red cars` & all `ford cars`
32524
33366
  *
32525
33367
  * N.B.: will not affect current result - just returning the DIFF
32526
- * If you
33368
+ *
33369
+ * Delegates to `notIn()`: the rows found are taken out as themselves when
33370
+ * no key is named, so a row needs neither a `_uuid` nor an `id` (#B826).
33371
+ *
32527
33372
  * @param {object} filter - same as `.find(filter)`
32528
33373
  * @param {string|boolean} [ uuid | disabled ] - by default, Collection is using its internal _uuid
32529
33374
  * If you want to delete without key comparison, disable `uuid` search mode
@@ -32881,19 +33726,57 @@ function Collection(content, options) {
32881
33726
 
32882
33727
  /**
32883
33728
  * filter
32884
- * Reduce record propName
32885
- * @param {string|array} filter
33729
+ * With a FUNCTION, filters like `Array.prototype.filter`: the callback gets
33730
+ * `(row, index, array)` and `thisArg` as its `this`, and the result is a
33731
+ * `find()`-style result: the matching rows (the same objects) with the methods
33732
+ * `find()` attaches, so `.toRaw()` and the chain keep working.
33733
+ * With a field name or a list of field names, projects each row onto those
33734
+ * fields and returns a plain, deep-cloned array.
33735
+ *
33736
+ * #B517 — a function used to be read as a field name, so `rows.filter(fn)`
33737
+ * matched nothing and returned `[]` with no error.
33738
+ *
33739
+ * @param {function|string|array} filter - a predicate, a field name, or a list of field names
33740
+ * e.g: function (row) { return row.active; }
32886
33741
  * e.g: 'id'
32887
33742
  * e.g: ['id', 'name']
33743
+ * @param {*} [thisArg] - `this` for the predicate (function form only)
33744
+ *
33745
+ * @returns {array} the matching rows (function form), or rawFilteredResult (projection)
33746
+ * @throws {Error} when `filter` is undefined
32888
33747
  *
32889
- * @returns {array} rawFilteredResult
33748
+ * @example
33749
+ * var col = new Collection([{ id: 1, active: true }, { id: 2, active: false }]);
33750
+ * col.find({}).filter(function (row) { return row.active; }).toRaw(); // [{ id: 1, active: true }]
33751
+ * col.find({}).filter('id'); // [{ id: 1 }, { id: 2 }]
32890
33752
  * */
32891
- instance['filter'] = function(filter) {
33753
+ instance['filter'] = function(filter, thisArg) {
32892
33754
 
32893
33755
  if ( typeof(filter) == 'undefined' ) {
32894
- throw new Error('`filter` parametter must be a string or an array.');
33756
+ // was: throw new Error('`filter` parametter must be a string or an array.');
33757
+ throw new Error('`filter` parameter must be a function, a string or an array.');
32895
33758
  }
32896
33759
  var result = ( Array.isArray(this) ) ? this : content;
33760
+
33761
+ // #B517 — a function filters like Array.prototype.filter. The projection below
33762
+ // read it as a field name, matched nothing and returned [] with no error. The
33763
+ // result gets the methods find() attaches, so .toRaw() and the chain keep working.
33764
+ if ( typeof(filter) == 'function' ) {
33765
+ var filtered = Array.prototype.filter.call(result, filter, thisArg);
33766
+ filtered.notIn = instance.notIn;
33767
+ filtered.find = instance.find;
33768
+ filtered.update = instance.update;
33769
+ filtered.replace = instance.replace;
33770
+ filtered.or = instance.or;
33771
+ filtered.findOne = instance.findOne;
33772
+ filtered.limit = instance.limit;
33773
+ filtered.orderBy = instance.orderBy;
33774
+ filtered.delete = instance.delete;
33775
+ filtered.toRaw = instance.toRaw;
33776
+ filtered.filter = instance.filter;
33777
+
33778
+ return filtered
33779
+ }
32897
33780
  if ( !result.length ) {
32898
33781
  return []
32899
33782
  }