json-rest-api 1.0.22 → 1.0.23

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 (260) hide show
  1. package/CLAUDE.md +1 -2
  2. package/JSKIT_BACKEND_MIGRATION_TRACKER.txt +180 -0
  3. package/SINGLE_VALIDATION_CONTRACT_TODO.txt +172 -0
  4. package/docs/API.md +51 -14
  5. package/docs/COMPARISON.md +2 -2
  6. package/docs/GUIDE/GUIDE_1_Initial_Setup.md +28 -1
  7. package/docs/GUIDE/GUIDE_2_2_Manipulating_And_Searching_Tables.md +5 -1
  8. package/docs/GUIDE/GUIDE_2_7_Pagination_And_Ordering.md +3 -1
  9. package/docs/GUIDE/GUIDE_2_8_Effects_of_PUT_and_PATCH.md +12 -60
  10. package/docs/GUIDE/GUIDE_2_Data_And_Relations.md +2 -2
  11. package/docs/GUIDE/GUIDE_3_Field_Transformations.md +5 -1
  12. package/docs/GUIDE/GUIDE_7_Hooks_Data_Management_And_Plugins.md +2 -0
  13. package/docs/GUIDE/GUIDE_X_Autofiltering.md +355 -0
  14. package/docs/GUIDE/GUIDE_X_Fastify.md +78 -0
  15. package/docs/GUIDE/GUIDE_X_Knex_Schema_And_Migrations.md +250 -0
  16. package/docs/GUIDE/GUIDE_X_Query_Projections.md +159 -0
  17. package/docs/GUIDE/GUIDE_X_Writing_Plugins.md +199 -0
  18. package/docs/GUIDE/index.md +18 -9
  19. package/docs/QUICKSTART.md +5 -1
  20. package/docs/index.md +1 -1
  21. package/index.js +3 -2
  22. package/package.json +2 -2
  23. package/plugins/core/connectors/express-plugin.js +97 -184
  24. package/plugins/core/connectors/fastify-plugin.js +206 -0
  25. package/plugins/core/connectors/lib/connector-core.js +195 -0
  26. package/plugins/core/connectors/lib/transport-http-helpers.js +122 -0
  27. package/plugins/core/connectors/lib/transport-route-schemas.js +92 -0
  28. package/plugins/core/lib/dbIntrospection.js +1078 -0
  29. package/plugins/core/lib/dbTablesOperations.js +1104 -160
  30. package/plugins/core/lib/querying/knex-json-api-transformers-querying.js +5 -2
  31. package/plugins/core/lib/querying/knex-process-includes.js +3 -4
  32. package/plugins/core/lib/querying/knex-query-helpers.js +17 -71
  33. package/plugins/core/lib/querying/knex-relationship-includes.js +466 -206
  34. package/plugins/core/lib/querying/query-builder-utils.js +19 -0
  35. package/plugins/core/lib/querying/query-field-sort-helpers.js +135 -0
  36. package/plugins/core/lib/querying/sort-helpers.js +33 -0
  37. package/plugins/core/lib/querying/storage-adapter-utils.js +51 -0
  38. package/plugins/core/lib/querying/url-helpers.js +8 -2
  39. package/plugins/core/lib/querying-writing/compile-schemas.js +12 -1
  40. package/plugins/core/lib/querying-writing/knex-field-helpers.js +83 -13
  41. package/plugins/core/lib/querying-writing/knex-json-api-transformers.js +13 -12
  42. package/plugins/core/lib/querying-writing/query-field-helpers.js +88 -0
  43. package/plugins/core/lib/querying-writing/request-contracts.js +590 -0
  44. package/plugins/core/lib/storage/canonical-storage-mapping.js +113 -0
  45. package/plugins/core/lib/storage/storage-adapter.js +79 -2
  46. package/plugins/core/lib/storage/storage-mapping.js +204 -0
  47. package/plugins/core/rest-api-anyapi-knex-plugin.js +355 -228
  48. package/plugins/core/rest-api-autofilter-plugin.js +414 -0
  49. package/plugins/core/rest-api-knex-plugin.js +249 -211
  50. package/plugins/core/rest-api-plugin-hooks/register-relationship-routes.js +10 -5
  51. package/plugins/core/rest-api-plugin-hooks/register-scope-routes.js +12 -6
  52. package/plugins/core/rest-api-plugin-methods/apply-query-filters.js +41 -0
  53. package/plugins/core/rest-api-plugin-methods/common.js +121 -83
  54. package/plugins/core/rest-api-plugin-methods/enrich-attributes.js +6 -1
  55. package/plugins/core/rest-api-plugin-methods/get.js +23 -14
  56. package/plugins/core/rest-api-plugin-methods/patch.js +28 -12
  57. package/plugins/core/rest-api-plugin-methods/post.js +13 -8
  58. package/plugins/core/rest-api-plugin-methods/put.js +45 -21
  59. package/plugins/core/rest-api-plugin-methods/query.js +15 -53
  60. package/plugins/core/rest-api-plugin.js +2 -0
  61. package/plugins/core/rest-api-positioning-plugin.js +1 -1
  62. package/plugins/core/rest-api-query-projections-plugin.js +130 -0
  63. package/plugins/core/socketio-plugin.js +1 -3
  64. package/tests/autofilter.test.js +463 -0
  65. package/tests/custom-id-simplified-post.test.js +75 -0
  66. package/tests/custom-idproperty-relationships.test.js +33 -0
  67. package/tests/db-introspection.test.js +518 -0
  68. package/tests/db-table-operations.test.js +781 -0
  69. package/tests/fastify-plugin.test.js +141 -0
  70. package/tests/field-getters.test.js +1 -2
  71. package/tests/field-setters.test.js +0 -4
  72. package/tests/fixtures/api-configs.js +188 -219
  73. package/tests/helpers/fake-fastify.js +99 -0
  74. package/tests/http-connectors-parity.test.js +235 -0
  75. package/tests/projected-fields.test.js +319 -0
  76. package/tests/relationships.test.js +3 -3
  77. package/tests/searchschema-knex-behavior.test.js +187 -0
  78. package/tests/searchschema-merge.test.js +21 -69
  79. package/tests/storage-mapping.test.js +210 -0
  80. package/audit/00-charter.md +0 -103
  81. package/audit/01-scope-map.md +0 -84
  82. package/audit/02-coverage-matrix.csv +0 -174
  83. package/audit/03-invariants.md +0 -123
  84. package/audit/04-standards-rubric.md +0 -56
  85. package/audit/05-competitor-rubric.md +0 -77
  86. package/audit/06-findings.md +0 -160
  87. package/audit/07-risk-register.csv +0 -10
  88. package/audit/08-remediation-roadmap.md +0 -177
  89. package/audit/09-signoff-check.md +0 -23
  90. package/audit/10-final-synthesis.md +0 -29
  91. package/audit/evidence/code/all-files-json-rest-api.txt +0 -168
  92. package/audit/evidence/code/all-files-json-rest-schema.txt +0 -12
  93. package/audit/evidence/code/boundary-leak-checks.txt +0 -72
  94. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt +0 -480
  95. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt +0 -532
  96. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__busboy-detector.js.txt +0 -175
  97. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__formidable-detector.js.txt +0 -138
  98. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__request-helpers.js.txt +0 -222
  99. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt +0 -342
  100. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__dbTablesOperations.js.txt +0 -304
  101. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__fractional-positioning.js.txt +0 -188
  102. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt +0 -336
  103. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__connectors-query-parser.js.txt +0 -165
  104. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt +0 -265
  105. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-value-normalizers.js.txt +0 -369
  106. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt +0 -72
  107. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__field-utils.js.txt +0 -139
  108. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-constants.js.txt +0 -45
  109. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-field-helpers.js.txt +0 -396
  110. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-json-api-transformers.js.txt +0 -162
  111. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__payload-validators.js.txt +0 -1314
  112. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__schema-helpers.js.txt +0 -488
  113. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__scope-validations.js.txt +0 -484
  114. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__simplified-helpers.js.txt +0 -857
  115. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt +0 -565
  116. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-json-api-transformers-querying.js.txt +0 -485
  117. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt +0 -560
  118. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-process-includes.js.txt +0 -167
  119. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers-base.js.txt +0 -109
  120. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt +0 -1064
  121. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt +0 -1983
  122. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-window-queries.js.txt +0 -328
  123. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__url-helpers.js.txt +0 -119
  124. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__storage__storage-adapter.js.txt +0 -160
  125. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__many-to-many-manipulations.js.txt +0 -300
  126. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__relationship-processor.js.txt +0 -245
  127. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt +0 -459
  128. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-cors-plugin.js.txt +0 -237
  129. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt +0 -1135
  130. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt +0 -314
  131. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__compile-resource-schemas.js.txt +0 -7
  132. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__register-relationship-routes.js.txt +0 -71
  133. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__register-scope-routes.js.txt +0 -102
  134. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__turn-scope-init-into-vars.js.txt +0 -49
  135. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__validate-include-configurations.js.txt +0 -39
  136. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__add-route.js.txt +0 -23
  137. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__check-permissions.js.txt +0 -13
  138. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt +0 -639
  139. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete-relationship.js.txt +0 -117
  140. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete.js.txt +0 -104
  141. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__enrich-attributes.js.txt +0 -199
  142. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get-related.js.txt +0 -353
  143. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get-relationship.js.txt +0 -61
  144. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get.js.txt +0 -184
  145. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch-relationship.js.txt +0 -55
  146. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch.js.txt +0 -191
  147. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post-relationship.js.txt +0 -110
  148. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post.js.txt +0 -168
  149. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__put.js.txt +0 -253
  150. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__query.js.txt +0 -207
  151. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__release.js.txt +0 -12
  152. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin.js.txt +0 -165
  153. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt +0 -668
  154. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt +0 -621
  155. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt +0 -218
  156. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__s3-storage.js.txt +0 -124
  157. package/audit/evidence/code/critical-pass1/json-rest-schema__src__CorePlugin.js.txt +0 -269
  158. package/audit/evidence/code/critical-pass1/json-rest-schema__src__Schema.js.txt +0 -242
  159. package/audit/evidence/code/critical-pass1/json-rest-schema__src__index.js.txt +0 -77
  160. package/audit/evidence/code/critical-pass1-risk-keywords.txt +0 -238
  161. package/audit/evidence/code/critical-pass1-summary.csv +0 -67
  162. package/audit/evidence/code/critical-pass2-summary.csv +0 -67
  163. package/audit/evidence/code/early-silent-zones-no-test-token.txt +0 -57
  164. package/audit/evidence/code/error-model-signals.txt +0 -98
  165. package/audit/evidence/code/git-files-json-rest-api.txt +0 -171
  166. package/audit/evidence/code/git-files-json-rest-schema.txt +0 -27
  167. package/audit/evidence/code/hook-flow-signals.txt +0 -282
  168. package/audit/evidence/code/idproperty-signals.txt +0 -157
  169. package/audit/evidence/code/import-cycles-non-anyapi.txt +0 -3
  170. package/audit/evidence/code/import-hotspots-non-anyapi.txt +0 -96
  171. package/audit/evidence/code/imports-json-rest-api.txt +0 -354
  172. package/audit/evidence/code/imports-json-rest-schema.txt +0 -15
  173. package/audit/evidence/code/in-scope-files-json-rest-api.txt +0 -160
  174. package/audit/evidence/code/in-scope-files-json-rest-schema.txt +0 -13
  175. package/audit/evidence/code/non-anyapi-core-files.txt +0 -101
  176. package/audit/evidence/code/permission-signals.txt +0 -193
  177. package/audit/evidence/code/query-include-signals.txt +0 -687
  178. package/audit/evidence/code/transaction-signals.txt +0 -28
  179. package/audit/evidence/code/validation-signals.txt +0 -650
  180. package/audit/evidence/code/write-path-signals.txt +0 -61
  181. package/audit/evidence/docs/docs-claims-signals.txt +0 -1075
  182. package/audit/evidence/docs/schema-docs-claims-signals.txt +0 -179
  183. package/audit/evidence/external/corpus-freeze.md +0 -21
  184. package/audit/evidence/external/npm-competitor-metadata.txt +0 -70
  185. package/audit/evidence/external/npm-download-signals.txt +0 -23
  186. package/audit/evidence/external/npm-jsonapi-server.txt +0 -8
  187. package/audit/evidence/external/npm-modern-jsonapi-metadata.txt +0 -38
  188. package/audit/evidence/external/readme-fortune-signals.txt +0 -26
  189. package/audit/evidence/external/readme-fortune.md +0 -165
  190. package/audit/evidence/external/readme-json-api-serializer-signals.txt +0 -80
  191. package/audit/evidence/external/readme-json-api-serializer.md +0 -690
  192. package/audit/evidence/external/readme-jsonapi-serde-server-signals.txt +0 -0
  193. package/audit/evidence/external/readme-jsonapi-serde-server.md +0 -22
  194. package/audit/evidence/external/readme-jsonapi-serializer-signals.txt +0 -63
  195. package/audit/evidence/external/readme-jsonapi-serializer.md +0 -315
  196. package/audit/evidence/external/readme-jsonapi-server-signals.txt +0 -19
  197. package/audit/evidence/external/readme-jsonapi-server.md +0 -104
  198. package/audit/evidence/external/readme-nestjs-json-api-signals.txt +0 -4
  199. package/audit/evidence/external/readme-nestjs-json-api.md +0 -94
  200. package/audit/evidence/external/readme-yaser-json-api-nestjs-signals.txt +0 -47
  201. package/audit/evidence/external/readme-yaser-json-api-nestjs.md +0 -447
  202. package/audit/evidence/external/standard-jsonapi-snippets.txt +0 -84
  203. package/audit/evidence/external/standard-rfc-snippets.txt +0 -168
  204. package/audit/evidence/external/standards-sources.txt +0 -6
  205. package/audit/evidence/runtime/baseline-commits.txt +0 -2
  206. package/audit/evidence/runtime/db-adapter-assumptions.txt +0 -3
  207. package/audit/evidence/runtime/environment.txt +0 -4
  208. package/audit/evidence/runtime/invariant-runtime-mapping.md +0 -38
  209. package/audit/evidence/runtime/probe-patch-relationship-error.exitcode +0 -1
  210. package/audit/evidence/runtime/probe-patch-relationship-error.log +0 -76
  211. package/audit/evidence/runtime/probe-patch-relationship-error.mjs +0 -67
  212. package/audit/evidence/runtime/probe-patch-relationship-referenceerror.exitcode +0 -1
  213. package/audit/evidence/runtime/probe-patch-relationship-referenceerror.log +0 -62
  214. package/audit/evidence/runtime/probe-patch-relationship-referenceerror.mjs +0 -47
  215. package/audit/evidence/runtime/test-exitcodes.txt +0 -4
  216. package/audit/evidence/runtime/test-summary.md +0 -107
  217. package/audit/evidence/runtime/trace-anchors.txt +0 -61
  218. package/audit/evidence/tests/access-multitenancy-test-signals.txt +0 -125
  219. package/audit/evidence/tests/failing-tests-summary.txt +0 -25
  220. package/audit/evidence/tests/npm-test-json-rest-api.exitcode +0 -1
  221. package/audit/evidence/tests/npm-test-json-rest-api.log +0 -5885
  222. package/audit/evidence/tests/npm-test-json-rest-schema.exitcode +0 -1
  223. package/audit/evidence/tests/npm-test-json-rest-schema.log +0 -356
  224. package/audit/evidence/tests/query-include-test-signals.txt +0 -948
  225. package/audit/evidence/tests/relationship-test-signals.txt +0 -223
  226. package/audit/evidence/tests/skipped-tests.txt +0 -10
  227. package/audit/evidence/tests/test-suite-list-non-anyapi.txt +0 -30
  228. package/audit/evidence/tests/test-suite-list.txt +0 -32
  229. package/audit/subsystems/docs-drift.md +0 -49
  230. package/audit/subsystems/pass2-cross-review.md +0 -131
  231. package/audit/subsystems/plugins-access.md +0 -51
  232. package/audit/subsystems/plugins-bulk.md +0 -50
  233. package/audit/subsystems/plugins-cors.md +0 -48
  234. package/audit/subsystems/plugins-file.md +0 -53
  235. package/audit/subsystems/plugins-multihome.md +0 -50
  236. package/audit/subsystems/plugins-positioning.md +0 -54
  237. package/audit/subsystems/plugins-socketio.md +0 -50
  238. package/audit/subsystems/query-engine.md +0 -61
  239. package/audit/subsystems/relationships.md +0 -55
  240. package/audit/subsystems/rest-orchestration.md +0 -66
  241. package/audit/subsystems/schema-core.md +0 -64
  242. package/audit/subsystems/storage-knex.md +0 -57
  243. package/audit/subsystems/tests.md +0 -48
  244. package/audit/subsystems/transport-express.md +0 -55
  245. package/audit/traces/trace-read-get.md +0 -22
  246. package/audit/traces/trace-read-query.md +0 -25
  247. package/audit/traces/trace-relationship-endpoints.md +0 -31
  248. package/audit/traces/trace-write-delete.md +0 -17
  249. package/audit/traces/trace-write-patch.md +0 -26
  250. package/audit/traces/trace-write-post.md +0 -22
  251. package/audit/traces/trace-write-put.md +0 -23
  252. package/docs/GUIDE/GUIDE_4_Authentication_And_Permissions.md +0 -707
  253. package/docs/GUIDE/GUIDE_X_Multihome.md +0 -666
  254. package/plugins/core/lib/querying-writing/payload-validators.js +0 -1314
  255. package/plugins/core/rest-api-access.js +0 -459
  256. package/plugins/core/rest-api-multihome-plugin.js +0 -314
  257. package/tests/multihome.test.js +0 -553
  258. package/tests/multihome.test.js.bak +0 -550
  259. package/tests/ownership-optout.test.js +0 -76
  260. package/tests/rest-api-access.test.js +0 -206
@@ -1,242 +0,0 @@
1
- 1 /**
2
- 2 * @file Defines the Schema class, which contains the core validation engine.
3
- 3 */
4
- 4
5
- 5 /**
6
- 6 * @typedef {object} ValidationError
7
- 7 * @property {string} field - The name of the field that failed validation.
8
- 8 * @property {string} code - A stable, machine-readable error code (e.g., 'MIN_LENGTH').
9
- 9 * @property {string} message - The human-readable error message.
10
- 10 * @property {object} [params] - A key-value object with context about the error (e.g., { min: 3, actual: 2 }).
11
- 11 */
12
- 12
13
- 13 /**
14
- 14 * @typedef {object} ValidationContext
15
- 15 * @property {Schema} schema - The current schema instance.
16
- 16 * @property {object} definition - The schema definition for the specific field.
17
- 17 * @property {any} value - The current value of the field being processed.
18
- 18 * @property {string} fieldName - The name of the field.
19
- 19 * @property {object} object - The full object being validated (with modifications).
20
- 20 * @property {object} objectBeforeCast - The original, unmodified input object.
21
- 21 * @property {any} valueBeforeCast - The original value of the field.
22
- 22 * @property {object} options - The global validation options.
23
- 23 * @property {{nullable: boolean, nullOnEmpty: boolean}} computedOptions - Calculated options.
24
- 24 * @property {string} [parameterName] - The name of the validator parameter being processed.
25
- 25 * @property {any} [parameterValue] - The value of the validator parameter.
26
- 26 * @property {function(): void} throwTypeError - Throws a standardized type casting error.
27
- 27 * @property {function(string, string, object=): void} throwParamError - Throws a standardized parameter validation error.
28
- 28 */
29
- 29
30
- 30 /**
31
- 31 * Represents an instance of a schema that can validate objects against a structure.
32
- 32 * This class is instantiated by the createSchema factory function.
33
- 33 */
34
- 34 export class Schema {
35
- 35 /**
36
- 36 * @param {object} structure The schema definition.
37
- 37 * @param {object} types The globally registered type handlers.
38
- 38 * @param {object} validators The globally registered validator handlers.
39
- 39 */
40
- 40 constructor (structure, types, validators) {
41
- 41 this.structure = structure
42
- 42 this.types = types // Now passed in directly
43
- 43 this.validators = validators // Now passed in directly
44
- 44 }
45
- 45
46
- 46 // --- Private Helpers ---
47
- 47
48
- 48 /** @private */
49
- 49 _typeError (field) {
50
- 50 return this._paramError(field, 'TYPE_CAST_FAILED', 'Value could not be cast to the required type.')
51
- 51 }
52
- 52
53
- 53 /** @private */
54
- 54 _paramError (field, code, message, params = {}) {
55
- 55 const e = new Error(message)
56
- 56 e.errorObject = { field, code, message, params }
57
- 57 return e
58
- 58 }
59
- 59
60
- 60 /** @private */
61
- 61 _paramToBeSkipped (parameterName, skipParams, fieldName) {
62
- 62 if (typeof skipParams !== 'object' || skipParams === null) return false
63
- 63 if (Array.isArray(skipParams[fieldName]) && skipParams[fieldName].includes(parameterName)) return true
64
- 64 return false
65
- 65 }
66
- 66
67
- 67 /**
68
- 68 * Processes a single field through the entire validation pipeline (pre-checks, casting, validators).
69
- 69 * This is the heart of the validation logic for an individual field.
70
- 70 * @private
71
- 71 * @param {string} fieldName - The name of the field to validate.
72
- 72 * @param {object} object - The original input object.
73
- 73 * @param {object} validatedObject - The object being built with validated data.
74
- 74 * @param {object} options - The global validation options.
75
- 75 * @returns {Promise<ValidationError|null>} An error object if validation fails, otherwise null.
76
- 76 */
77
- 77 async _validateField (fieldName, object, validatedObject, options) {
78
- 78 const definition = this.structure[fieldName]
79
- 79 if (!definition) return null
80
- 80
81
- 81 // --- 1. Pre-validation Checks ---
82
- 82 if (Array.isArray(options.skipFields) && options.skipFields.includes(fieldName)) return null
83
- 83
84
- 84 if (definition.required && object[fieldName] === undefined) {
85
- 85 if (!this._paramToBeSkipped('required', options.skipParams, fieldName)) {
86
- 86 return { field: fieldName, code: 'REQUIRED', message: 'Field is required', params: {} }
87
- 87 }
88
- 88 }
89
- 89
90
- 90 if (object[fieldName] === undefined) {
91
- 91 // It's not required and it's not present, so we can stop processing this field.
92
- 92 // The 'defaultTo' value will be applied in the main `validate` loop's post-processing step.
93
- 93 return null
94
- 94 }
95
- 95
96
- 96 const nullable = definition.nullable === true || options.nullable === true
97
- 97 const nullOnEmpty = definition.nullOnEmpty === true || options.nullOnEmpty === true
98
- 98
99
- 99 if (object[fieldName] === null) {
100
- 100 return nullable ? null : { field: fieldName, code: 'NOT_NULLABLE', message: 'Field cannot be null', params: {} }
101
- 101 }
102
- 102
103
- 103 if (String(object[fieldName]) === '' && nullOnEmpty) {
104
- 104 validatedObject[fieldName] = null
105
- 105 return null
106
- 106 }
107
- 107
108
- 108 /** @type {ValidationContext} */
109
- 109 const context = {
110
- 110 schema: this,
111
- 111 definition,
112
- 112 value: validatedObject[fieldName],
113
- 113 fieldName,
114
- 114 object: validatedObject,
115
- 115 objectBeforeCast: object,
116
- 116 valueBeforeCast: object[fieldName],
117
- 117 options,
118
- 118 computedOptions: { nullable: nullable || nullOnEmpty, nullOnEmpty },
119
- 119
120
- 120 // NEW: Public API for throwing standardized errors from within plugins/handlers
121
- 121 throwTypeError: () => {
122
- 122 throw this._typeError(fieldName)
123
- 123 },
124
- 124 throwParamError: (code, message, params) => {
125
- 125 throw this._paramError(fieldName, code, message, params)
126
- 126 }
127
- 127 }
128
- 128
129
- 129 // --- 2. Type Casting ---
130
- 130 const typeHandler = this.types[definition.type]
131
- 131 if (!typeHandler) throw new Error(`No casting function for type: ${definition.type}`)
132
- 132
133
- 133 try {
134
- 134 const castResult = await typeHandler(context)
135
- 135 if (castResult !== undefined) {
136
- 136 validatedObject[fieldName] = castResult
137
- 137 context.value = castResult // Update context for subsequent validators.
138
- 138 }
139
- 139 } catch (e) {
140
- 140 if (e.errorObject) return e.errorObject // It's a validation error.
141
- 141 throw e // It's an unexpected system error, re-throw it.
142
- 142 }
143
- 143
144
- 144 // --- 3. Parameter Validators ---
145
- 145 for (const paramName in definition) {
146
- 146 if (paramName === 'type') continue
147
- 147 if (this._paramToBeSkipped(paramName, options.skipParams, fieldName)) continue
148
- 148
149
- 149 const validatorHandler = this.validators[paramName]
150
- 150 if (validatorHandler) {
151
- 151 try {
152
- 152 context.parameterName = paramName
153
- 153 context.parameterValue = definition[paramName]
154
- 154 const validatorResult = await validatorHandler(context)
155
- 155 if (validatorResult !== undefined) {
156
- 156 validatedObject[fieldName] = validatorResult
157
- 157 context.value = validatorResult // Update context value for the next validator.
158
- 158 }
159
- 159 } catch (e) {
160
- 160 if (e.errorObject) return e.errorObject // It's a validation error.
161
- 161 throw e // It's an unexpected system error.
162
- 162 }
163
- 163 }
164
- 164 }
165
- 165 return null // Field is valid
166
- 166 }
167
- 167
168
- 168 // --- Public API ---
169
- 169
170
- 170 /**
171
- 171 * Validates an object against the schema structure.
172
- 172 * This method orchestrates the validation process.
173
- 173 * @param {object} object - The input object to validate.
174
- 174 * @param {object} [options={}] - Validation options.
175
- 175 * @returns {Promise<{validatedObject: object, errors: Object.<string, ValidationError>}>}
176
- 176 */
177
- 177 async validate (object, options = {}) {
178
- 178 const errors = {}
179
- 179 const validatedObject = { ...object }
180
- 180 const validationPromises = []
181
- 181
182
- 182 // Step 1: Check for fields in the input that are not in the schema.
183
- 183 for (const fieldName in object) {
184
- 184 if (this.structure[fieldName] === undefined) {
185
- 185 errors[fieldName] = { field: fieldName, code: 'FIELD_NOT_ALLOWED', message: 'Field not allowed', params: {} }
186
- 186 }
187
- 187 }
188
- 188
189
- 189 // Step 2: Determine which fields to iterate over for validation.
190
- 190 const targetFields = options.onlyObjectValues ? Object.keys(object) : Object.keys(this.structure)
191
- 191
192
- 192 // Step 3: Concurrently validate all fields.
193
- 193 for (const fieldName of targetFields) {
194
- 194 validationPromises.push(
195
- 195 this._validateField(fieldName, object, validatedObject, options)
196
- 196 )
197
- 197 }
198
- 198
199
- 199 // Step 4: Collect results from all validation pipelines.
200
- 200 const results = await Promise.all(validationPromises)
201
- 201 for (const error of results) {
202
- 202 if (error) {
203
- 203 errors[error.field] = error
204
- 204 }
205
- 205 }
206
- 206
207
- 207 // Step 5: Post-process for defaultTo on fields that were not present in the input.
208
- 208 // For full validation (!onlyObjectValues), ensure all schema fields are present.
209
- 209 if (!options.onlyObjectValues) {
210
- 210 for (const fieldName in this.structure) {
211
- 211 // Only process fields that were not in the original input
212
- 212 if (!(fieldName in object) && validatedObject[fieldName] === undefined) {
213
- 213 if (this.structure[fieldName].defaultTo !== undefined) {
214
- 214 const def = this.structure[fieldName].defaultTo
215
- 215 validatedObject[fieldName] = typeof def === 'function' ? def() : def
216
- 216 } else {
217
- 217 // Set fields not in input to null for complete PUT-like records
218
- 218 validatedObject[fieldName] = null
219
- 219 }
220
- 220 }
221
- 221 }
222
- 222 }
223
- 223
224
- 224 return { validatedObject, errors }
225
- 225 }
226
- 226
227
- 227 /**
228
- 228 * Utility to filter an object, keeping only fields that have a specific parameter.
229
- 229 * @param {object} object - The object to clean.
230
- 230 * @param {string} parameterName - The schema parameter to look for.
231
- 231 * @returns {object} A new object with only the matching fields.
232
- 232 */
233
- 233 cleanup (object, parameterName) {
234
- 234 const newObject = {}
235
- 235 for (const k in object) {
236
- 236 if (this.structure[k] && this.structure[k][parameterName]) {
237
- 237 newObject[k] = object[k]
238
- 238 }
239
- 239 }
240
- 240 return newObject
241
- 241 }
242
- 242 }
@@ -1,77 +0,0 @@
1
- 1 /**
2
- 2 * @file Main entry point for the schema library.
3
- 3 * Assembles and exports the `createSchema` factory function and related utilities.
4
- 4 */
5
- 5
6
- 6 import { Schema } from './Schema.js'
7
- 7 import CorePlugin from './CorePlugin.js'
8
- 8
9
- 9 /**
10
- 10 * @type {Object.<string, Function>}
11
- 11 * Stores all registered type handlers. This is now a directly managed object.
12
- 12 */
13
- 13 const globalTypes = {}
14
- 14
15
- 15 /**
16
- 16 * @type {Object.<string, Function>}
17
- 17 * Stores all registered validator handlers. This is now a directly managed object.
18
- 18 */
19
- 19 const globalValidators = {}
20
- 20
21
- 21 /**
22
- 22 * Registers a new type handler.
23
- 23 * @param {string} name - The name of the type (e.g., 'string', 'email').
24
- 24 * @param {Function} handler - The function to handle the type casting.
25
- 25 */
26
- 26 export function addType (name, handler) {
27
- 27 if (typeof handler !== 'function') {
28
- 28 throw new Error(`Type handler for '${name}' must be a function.`)
29
- 29 }
30
- 30 globalTypes[name] = handler
31
- 31 }
32
- 32
33
- 33 /**
34
- 34 * Registers a new validator handler.
35
- 35 * @param {string} name - The name of the validator (e.g., 'min', 'required').
36
- 36 * @param {Function} handler - The function to handle the validation logic.
37
- 37 */
38
- 38 export function addValidator (name, handler) {
39
- 39 if (typeof handler !== 'function') {
40
- 40 throw new Error(`Validator handler for '${name}' must be a function.`)
41
- 41 }
42
- 42 globalValidators[name] = handler
43
- 43 }
44
- 44
45
- 45 /**
46
- 46 * Installs a plugin by calling its `install` method.
47
- 47 * @param {{install: Function}} plugin - A plugin object with an `install` method.
48
- 48 * @returns {void}
49
- 49 */
50
- 50 export function use (plugin) {
51
- 51 if (typeof plugin.install !== 'function') {
52
- 52 throw new Error('Plugin must have an install method.')
53
- 53 }
54
- 54 // Pass the addType and addValidator functions directly to the plugin
55
- 55 plugin.install({ addType, addValidator })
56
- 56 }
57
- 57
58
- 58 /**
59
- 59 * The main factory function for creating new schema instances.
60
- 60 * Each created schema will use the currently registered global types and validators.
61
- 61 * @param {object} structure - The schema definition object.
62
- 62 * @returns {import('./Schema').Schema} A new schema instance.
63
- 63 */
64
- 64 const createSchema = (structure) => new Schema(structure, globalTypes, globalValidators)
65
- 65
66
- 66 // Attach the registration methods directly to the factory function for convenience.
67
- 67 // This maintains the existing public API from the original code.
68
- 68 createSchema.addType = addType
69
- 69 createSchema.addValidator = addValidator
70
- 70 createSchema.use = use
71
- 71
72
- 72 // Automatically install the core plugin to provide out-of-the-box functionality.
73
- 73 createSchema.use(CorePlugin)
74
- 74
75
- 75 // Export all functions as named exports
76
- 76 export { createSchema }
77
- 77 // export { createKnexTable, generateKnexMigration } from './createKnexTable.js';
@@ -1,238 +0,0 @@
1
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt:28: 28 async ({ api }) => {} // TODO: Anything to do here?
2
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt:35: 35 } catch (e) {
3
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt:77: 77 } catch (e) {
4
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt:78: 78 log.warn('Busboy not installed. Install with: npm install busboy')
5
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt:84: 84 } catch (e) {
6
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt:85: 85 log.warn('Formidable not installed. Install with: npm install formidable')
7
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt:370: 370 } catch (error) {
8
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt:433: 433 } catch (routeError) {
9
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt:434: 434 log.error('[EXPRESS DEBUG] Error creating route:', {
10
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt:78: 78 } catch (error) {
11
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt:115: 115 } catch (error) {
12
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt:212: 212 } catch (error) {
13
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt:245: 245 } catch (error) {
14
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt:305: 305 } catch (error) {
15
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt:338: 338 } catch (error) {
16
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt:387: 387 } catch (error) {
17
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt:470: 470 } catch (error) {
18
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt:472: 472 log.warn('Optimized bulk insert failed, falling back to default', { error: error.message })
19
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt:201: 201 throw new Error(`Cannot operate on ${scopeName} without authentication`)
20
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt:255: 255 throw new Error('AccessPlugin: knexQuery must provide query and tableName for ownership filtering')
21
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt:261: 261 throw new Error(`Cannot query ${scopeName} without authentication`)
22
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt:300: 300 throw new Error(`Operation '${operation}' not allowed on resource '${scopeName}'`)
23
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt:312: 312 throw new Error(`Unknown auth rule: ${rule}`)
24
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt:327: 327 } catch (error) {
25
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt:408: 408 throw new Error(`Resource does not have ownership field '${field}'`)
26
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt:415: 415 throw new Error(`Resource does not have ownership field '${field}'`)
27
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt:418: 418 throw new Error('No resource or user ID provided for ownership check')
28
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt:143: 143 throw new Error(`Computed field '${fieldName}' in scope '${scopeName}' must have a type`)
29
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt:147: 147 throw new Error(`Computed field '${fieldName}' in scope '${scopeName}' has invalid compute function`)
30
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt:238: 238 throw new Error(
31
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt:263: 263 throw new Error(
32
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt:277: 277 } catch (error) {
33
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt:278: 278 throw new Error(`Invalid getter dependencies in ${scopeName}: ${error.message}`)
34
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt:299: 299 throw new Error(
35
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt:313: 313 } catch (error) {
36
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt:314: 314 throw new Error(`Invalid setter dependencies in ${scopeName}: ${error.message}`)
37
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__validate-include-configurations.js.txt:19: 19 throw new Error(
38
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__validate-include-configurations.js.txt:26: 26 throw new Error(
39
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__validate-include-configurations.js.txt:34: 34 throw new Error(
40
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-process-includes.js.txt:109: 109 throw new Error('scopeName is undefined in context')
41
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-process-includes.js.txt:146: 146 } catch (error) {
42
- audit/evidence/code/critical-pass1/json-rest-schema__src__index.js.txt:28: 28 throw new Error(`Type handler for '${name}' must be a function.`)
43
- audit/evidence/code/critical-pass1/json-rest-schema__src__index.js.txt:40: 40 throw new Error(`Validator handler for '${name}' must be a function.`)
44
- audit/evidence/code/critical-pass1/json-rest-schema__src__index.js.txt:52: 52 throw new Error('Plugin must have an install method.')
45
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__turn-scope-init-into-vars.js.txt:31: 31 throw new Error(
46
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__turn-scope-init-into-vars.js.txt:42: 42 throw new Error(
47
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get-related.js.txt:273: 273 throw new Error('Missing foreignKey or otherKey in many-to-many relationship')
48
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__fractional-positioning.js.txt:6: 6 } catch (e) {
49
- audit/evidence/code/critical-pass1/json-rest-schema__src__Schema.js.txt:131: 131 if (!typeHandler) throw new Error(`No casting function for type: ${definition.type}`)
50
- audit/evidence/code/critical-pass1/json-rest-schema__src__Schema.js.txt:139: 139 } catch (e) {
51
- audit/evidence/code/critical-pass1/json-rest-schema__src__Schema.js.txt:159: 159 } catch (e) {
52
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__query.js.txt:145: 145 } catch (e) {
53
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__enrich-attributes.js.txt:65: 65 } catch (error) {
54
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__enrich-attributes.js.txt:141: 141 } catch (error) {
55
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-field-helpers.js.txt:203: 203 if (!fieldDef) throw new Error(`Unknown sparse field '${field}' requested for '${scopeName}'`)
56
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-field-helpers.js.txt:310: 310 } catch (e) {
57
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__put.js.txt:250: 250 } catch (error) {
58
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__many-to-many-manipulations.js.txt:111: 111 throw new Error(`Pivot table resource '${relDef.through}' not found`)
59
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__many-to-many-manipulations.js.txt:139: 139 } catch (error) {
60
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__many-to-many-manipulations.js.txt:217: 217 * } catch (error) {
61
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__many-to-many-manipulations.js.txt:265: 265 throw new Error(`Pivot table resource '${relDef.through}' not found`)
62
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__many-to-many-manipulations.js.txt:279: 279 } catch (error) {
63
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-json-api-transformers-querying.js.txt:201: 201 } catch (e) {
64
- audit/evidence/code/critical-pass1/json-rest-schema__src__CorePlugin.js.txt:158: 158 } catch (e) {
65
- audit/evidence/code/critical-pass1/json-rest-schema__src__CorePlugin.js.txt:175: 175 } catch (e) {
66
- audit/evidence/code/critical-pass1/json-rest-schema__src__CorePlugin.js.txt:179: 179 } catch (e2) {
67
- audit/evidence/code/critical-pass1/json-rest-schema__src__CorePlugin.js.txt:230: 230 throw new Error(`Validator for ${context.fieldName} must be a function.`)
68
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt:53: 53 throw new Error('Page size must be greater than 0')
69
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt:56: 56 throw new Error('Page number must be greater than 0')
70
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt:303: 303 * } catch (e) {
71
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt:328: 328 throw new Error('Empty cursor')
72
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt:336: 336 throw new Error('Invalid cursor format: missing colon separator')
73
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt:343: 343 throw new Error('Invalid cursor format: empty field name')
74
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt:350: 350 } catch (e) {
75
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt:351: 351 throw new Error(`Invalid cursor format: ${e.message}`)
76
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete.js.txt:101: 101 } catch (error) {
77
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__storage__storage-adapter.js.txt:152: 152 throw new Error('createStorageAdapter requires schemaInfo')
78
- audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__s3-storage.js.txt:35: 35 throw new Error('S3Storage requires a bucket name')
79
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post.js.txt:165: 165 } catch (error) {
80
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post-relationship.js.txt:107: 107 } catch (error) {
81
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch.js.txt:188: 188 } catch (error) {
82
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete-relationship.js.txt:114: 114 } catch (error) {
83
- audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt:33: 33 throw new Error(`File extension '${originalExt}' is not allowed`)
84
- audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt:62: 62 throw new Error('nameGenerator function required for custom strategy')
85
- audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt:68: 68 throw new Error(`Unknown name strategy: ${this.nameStrategy}`)
86
- audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt:126: 126 } catch (error) {
87
- audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt:180: 180 throw new Error('Invalid file path')
88
- audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt:189: 189 throw new Error('File has no data or filepath')
89
- audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt:207: 207 throw new Error('Invalid file path')
90
- audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt:212: 212 } catch (error) {
91
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:7: 7 throw new Error('Multihome plugin requires a storage plugin with knex support (rest-api-knex or rest-api-anyapi-knex)')
92
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:79: 79 log.warn('No multihome ID found in request', {
93
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:100: 100 log.warn(`Resource ${scopeName} missing ${vars.multihome.field} field - multihome filtering disabled for this
94
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:103: 103 throw new Error(
95
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:125: 125 throw new Error('No multihome context available - cannot execute query')
96
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:145: 145 throw new Error(`Resource ${scopeName} missing required ${vars.multihome.field} field`)
97
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:191: 191 throw new Error('Cannot create record without multihome context')
98
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:202: 202 throw new Error(`Resource ${scopeName} missing required ${vars.multihome.field} field`)
99
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:223: 223 throw new Error(
100
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt:246: 246 throw new Error('No multihome context available')
101
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:145: 145 throw new Error('Authentication required')
102
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:149: 149 } catch (error) {
103
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:153: 153 } catch (hookError) {
104
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:305: 305 } catch (error) {
105
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:328: 328 log.warn(`Socket.IO broadcast skipped: unknown resource ${scopeName}`)
106
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:388: 388 } catch (error) {
107
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:420: 420 } catch (error) {
108
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:427: 427 } catch (error) {
109
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:452: 452 } catch (error) {
110
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:453: 453 log.warn('Socket.IO authentication failed', error)
111
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:481: 481 } catch (error) {
112
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:519: 519 } catch (error) {
113
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt:551: 551 } catch (error) {
114
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt:321: 321 console.warn(`Computed fields [${fieldNames}] were sent in input for resource '${context.scopeName}' but will be ignored as they are output-only`)
115
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt:436: 436 throw new Error(`Unknown resource type: ${item.type}`)
116
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt:457: 457 throw new Error(`Cannot create relationship to non-existent ${item.type} with id ${item.id}`)
117
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt:515: 515 } catch (error) {
118
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt:516: 516 console.warn(`Setter for field '${fieldName}' failed:`, error)
119
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt:563: 563 } catch (error) {
120
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt:564: 564 enhancedLog.warn(`Could not fetch minimal record after ${context.method} operation`, { error, id: context.id })
121
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt:621: 621 throw new Error(`Invalid returnMode: ${returnMode}`)
122
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:27: 27 * } catch (error) {
123
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:51: 51 throw new Error(`Circular reference detected: ${targetScopeName} -> ${Array.from(searchedScopes).join(' -> ')}`)
124
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:59: 59 } catch (error) {
125
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:61: 61 throw new Error(`Target scope '${targetScopeName}' not found`)
126
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:66: 66 throw new Error(`Target scope '${targetScopeName}' has no schema`)
127
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:72: 72 throw new Error(`Field '${fieldName}' not found in scope '${targetScopeName}'`)
128
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:77: 77 throw new Error(`Field '${targetScopeName}.${fieldName}' is not indexed. Add 'indexed: true' to allow cross-table search`)
129
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:183: 183 throw new Error(`Invalid cross-table path '${targetPath}'. Must contain at least 'scope.field'`)
130
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:200: 200 throw new Error(`Circular reference detected in path: ${Array.from(searchedScopes).join(' -> ')} -> ${currentScope}`)
131
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:257: 257 throw new Error(`Missing foreignKey in hasMany relationship '${relName}' for scope '${currentScope}'`)
132
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:280: 280 throw new Error(
133
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:357: 357 throw new Error(`Invalid path '${targetPath}': no relationships to traverse`)
134
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:559: 559 } catch (error) {
135
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt:560: 560 log.warn(`Failed to create index on ${tableName}.${field}:`, error.message)
136
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:58: 58 throw new Error('File detector must have name, detect(), and parse() properties')
137
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:130: 130 } catch (error) {
138
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:131: 131 log.warn(`Detector '${detector.name}' failed:`, error)
139
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:221: 221 throw new Error(`No storage configured for file field '${fieldConfig.field}'`)
140
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:228: 228 } catch (error) {
141
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:233: 233 } catch (cleanupError) {
142
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:234: 234 log.warn('Failed to cleanup file after upload error:', cleanupError)
143
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:270: 270 } catch (error) {
144
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:271: 271 log.warn('Failed to cleanup temp file:', error)
145
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:313: 313 throw new Error(`Invalid size format: ${size}`)
146
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt:320: 320 throw new Error(`Unknown size unit: ${unit}`)
147
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__simplified-helpers.js.txt:245: 245 rule: 'deprecated_foreign_key',
148
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt:13: 13 * } catch (error) {
149
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt:42: 42 throw new Error('No storage implementation for exists. Install a storage plugin.')
150
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt:46: 46 throw new Error('No storage implementation for get. Install a storage plugin.')
151
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt:50: 50 throw new Error('No storage implementation for getMinimal. Install a storage plugin.')
152
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt:54: 54 throw new Error('No storage implementation for query. Install a storage plugin.')
153
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt:58: 58 throw new Error('No storage implementation for post. Install a storage plugin.')
154
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt:62: 62 throw new Error('No storage implementation for patch. Install a storage plugin.')
155
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt:66: 66 throw new Error('No storage implementation for put. Install a storage plugin.')
156
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt:70: 70 throw new Error('No storage implementation for delete. Install a storage plugin.')
157
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__scope-validations.js.txt:151: 151 throw new Error(
158
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__scope-validations.js.txt:161: 161 throw new Error(
159
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__scope-validations.js.txt:170: 170 throw new Error(
160
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__scope-validations.js.txt:179: 179 throw new Error(
161
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch-relationship.js.txt:52: 52 } catch (error) {
162
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:18: 18 throw new Error(
163
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:24: 24 throw new Error('Positioning plugin requires a storage plugin with knex support (rest-api-knex or rest-api-anyapi-knex)')
164
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:63: 63 throw new Error(`Invalid positioning strategy: ${vars.positioning.strategy}. Must be 'fractional' or 'integer'`)
165
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:67: 67 throw new Error("Integer positioning strategy not yet implemented. Please use 'fractional'")
166
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:104: 104 log.warn(`Filter field '${filterField}' not found in search schema or resource schema for positioning`)
167
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:155: 155 throw new Error(
168
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:179: 179 throw new Error(
169
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:251: 251 } catch (error) {
170
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:252: 252 log.warn(`Could not create positioning index for ${scopeName}:`, error.message)
171
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:407: 407 log.warn('*** Positioning skipped - no storage adapter available', { scopeName })
172
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:526: 526 } catch (error) {
173
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt:602: 602 throw new Error(`Unknown resource: ${scopeName}`)
174
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-value-normalizers.js.txt:116: 116 console.warn(`Invalid date value for field type '${type}': ${value}`)
175
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__formidable-detector.js.txt:36: 36 } catch (e) {
176
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__formidable-detector.js.txt:99: 99 // For now, just take the first file (TODO: handle multiple files per field)
177
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__formidable-detector.js.txt:118: 118 } catch (error) {
178
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt:63: 63 } catch (e) {
179
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt:194: 194 throw new Error('fields parameter is required for alterKnexFields')
180
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt:286: 286 throw new Error(`Scope '${scopeName}' not found in api.resources`)
181
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt:524: 524 log.warn(`Ignoring non-sortable field: ${field}`)
182
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt:593: 593 } catch (error) {
183
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt:632: 632 log.warn(`Cursor missing value for sort field: ${field}`)
184
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt:661: 661 } catch (error) {
185
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt:700: 700 log.warn(`Cursor missing value for sort field: ${field}`)
186
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-cors-plugin.js.txt:113: 113 log.warn('CORS origin not allowed', { origin })
187
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-cors-plugin.js.txt:173: 173 log.warn('CORS origin not allowed for response', {
188
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__schema-helpers.js.txt:387: 387 throw new Error(`Circular dependency detected: ${item}`)
189
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__schema-helpers.js.txt:395: 395 throw new Error(`Unknown dependency '${dep}' for '${item}'`)
190
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__schema-helpers.js.txt:482: 482 } catch (error) {
191
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__schema-helpers.js.txt:484: 484 throw new Error(`${error.message} in ${dependencyProperty}`)
192
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:336: 336 } catch (error) {
193
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:344: 344 throw new Error(`Failed to load relationship metadata for scope '${scopeName}': ${error.message}`)
194
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:384: 384 log.warn('[INCLUDE] Target scope not found:', targetScope)
195
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:537: 537 } catch (error) {
196
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:610: 610 throw new Error(`Missing foreignKey or otherKey in many-to-many relationship '${relName}' for scope '${scopeName}'`)
197
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:845: 845 throw new Error(`Missing foreignKey in hasMany relationship '${relName}' for scope '${scopeName}'`)
198
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:892: 892 } catch (error) {
199
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:898: 898 log.warn('[INCLUDE] Window function query failed, falling back to standard query:', {
200
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1018: 1018 } catch (error) {
201
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1073: 1073 throw new Error(`Missing foreignKey in hasOne relationship '${includeName}' for scope '${scopeName}'`)
202
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1113: 1113 log.warn(`[INCLUDE] Multiple records found for hasOne relationship '${includeName}' with ${foreignKey}=${parentId}`)
203
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1215: 1215 log.warn('[INCLUDE] Skipping non-allowed type:', targetType)
204
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1360: 1360 } catch (error) {
205
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1421: 1421 log.warn('[INCLUDE] Via relationship not found or not polymorphic:', {
206
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1555: 1555 } catch (error) {
207
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1614: 1614 log.warn('[INCLUDE] No schema info for scope:', scopeName)
208
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1694: 1694 } catch (includeError) {
209
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1707: 1707 log.warn('[INCLUDE] Unknown relationship:', {
210
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1715: 1715 } catch (error) {
211
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1818: 1818 } catch (error) {
212
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1895: 1895 throw new Error(`Missing foreignKey in hasMany relationship '${relName}' for scope '${scopeName}'`)
213
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt:1918: 1918 throw new Error(`Missing foreignKey or otherKey in manyToMany relationship '${relName}' for scope '${scopeName}'`)
214
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt:255: 255 throw new Error(
215
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt:332: 332 throw new Error(
216
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt:337: 337 throw new Error(
217
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt:953: 953 log.trace('[DEBUG basicFiltersHook] Called with:', {
218
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt:962: 962 log.trace('[DEBUG basicFiltersHook] Returning early - no filters')
219
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt:981: 981 log.trace(`[DEBUG basicFiltersHook] No field definition for filter key: ${filterKey}`)
220
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt:984: 984 log.trace(`[DEBUG basicFiltersHook] Processing filter: ${filterKey} = ${filterValue}, fieldDef:`, fieldDef)
221
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt:990: 990 log.trace(`[DEBUG basicFiltersHook] Skipping filter ${filterKey} - is cross-table or polymorphic`)
222
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt:1058: 1058 log.trace(`[DEBUG basicFiltersHook] Applying filter: ${dbField} ${operator} ${filterValue}`)
223
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:108: 108 } catch (dbError) {
224
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:109: 109 console.warn(`[supportsWindowFunctions] Failed to get MySQL version: ${dbError.message}`)
225
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:121: 121 } catch (dbError) {
226
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:122: 122 console.warn(`[supportsWindowFunctions] Failed to get SQLite version: ${dbError.message}`)
227
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:146: 146 } catch (dbError) {
228
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:147: 147 console.warn(`[supportsWindowFunctions] Failed to get MariaDB version: ${dbError.message}`)
229
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:153: 153 } catch (error) {
230
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:223: 223 } catch (dbError) {
231
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:224: 224 console.warn(`[getDatabaseInfo] Failed to get MySQL version: ${dbError.message}`)
232
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:233: 233 } catch (dbError) {
233
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:234: 234 console.warn(`[getDatabaseInfo] Failed to get SQLite version: ${dbError.message}`)
234
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:243: 243 } catch (dbError) {
235
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:244: 244 console.warn(`[getDatabaseInfo] Failed to get PostgreSQL version: ${dbError.message}`)
236
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt:251: 251 } catch (error) {
237
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__busboy-detector.js.txt:32: 32 } catch (e) {
238
- audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__busboy-detector.js.txt:137: 137 } catch (error) {