json-rest-api 1.0.22 → 1.0.24

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 (290) hide show
  1. package/CLAUDE.md +1 -2
  2. package/JSKIT_BACKEND_MIGRATION_TRACKER.txt +180 -0
  3. package/README.md +22 -1
  4. package/SINGLE_VALIDATION_CONTRACT_TODO.txt +172 -0
  5. package/docs/API.md +196 -38
  6. package/docs/COMPARISON.md +2 -2
  7. package/docs/GUIDE/GUIDE_1_Initial_Setup.md +111 -5
  8. package/docs/GUIDE/GUIDE_2_2_Manipulating_And_Searching_Tables.md +5 -1
  9. package/docs/GUIDE/GUIDE_2_7_Pagination_And_Ordering.md +3 -1
  10. package/docs/GUIDE/GUIDE_2_8_Effects_of_PUT_and_PATCH.md +12 -60
  11. package/docs/GUIDE/GUIDE_2_Data_And_Relations.md +2 -2
  12. package/docs/GUIDE/GUIDE_3_Field_Transformations.md +5 -1
  13. package/docs/GUIDE/GUIDE_7_Hooks_Data_Management_And_Plugins.md +2 -0
  14. package/docs/GUIDE/GUIDE_X_Autofiltering.md +355 -0
  15. package/docs/GUIDE/GUIDE_X_Fastify.md +78 -0
  16. package/docs/GUIDE/GUIDE_X_Knex_Schema_And_Migrations.md +370 -0
  17. package/docs/GUIDE/GUIDE_X_Query_Projections.md +159 -0
  18. package/docs/GUIDE/GUIDE_X_Writing_Plugins.md +199 -0
  19. package/docs/GUIDE/index.md +18 -9
  20. package/docs/QUICKSTART.md +5 -1
  21. package/docs/index.md +1 -1
  22. package/index.js +3 -2
  23. package/lib/enhanced-logger.js +1 -1
  24. package/package.json +6 -2
  25. package/plugins/core/bulk-operations-plugin.js +26 -34
  26. package/plugins/core/connectors/express-plugin.js +97 -190
  27. package/plugins/core/connectors/fastify-plugin.js +206 -0
  28. package/plugins/core/connectors/lib/busboy-detector.js +4 -4
  29. package/plugins/core/connectors/lib/connector-core.js +195 -0
  30. package/plugins/core/connectors/lib/transport-http-helpers.js +122 -0
  31. package/plugins/core/connectors/lib/transport-route-schemas.js +92 -0
  32. package/plugins/core/lib/anyapi/schema-utils.js +43 -4
  33. package/plugins/core/lib/anyapi/utils/descriptor-helpers.js +4 -1
  34. package/plugins/core/lib/dbIntrospection.js +1078 -0
  35. package/plugins/core/lib/dbTablesOperations.js +1111 -160
  36. package/plugins/core/lib/querying/knex-cross-table-search.js +0 -7
  37. package/plugins/core/lib/querying/knex-json-api-transformers-querying.js +5 -3
  38. package/plugins/core/lib/querying/knex-process-includes.js +3 -4
  39. package/plugins/core/lib/querying/knex-query-helpers.js +21 -76
  40. package/plugins/core/lib/querying/knex-relationship-includes.js +468 -215
  41. package/plugins/core/lib/querying/query-builder-utils.js +19 -0
  42. package/plugins/core/lib/querying/query-field-sort-helpers.js +135 -0
  43. package/plugins/core/lib/querying/sort-helpers.js +33 -0
  44. package/plugins/core/lib/querying/storage-adapter-utils.js +51 -0
  45. package/plugins/core/lib/querying/url-helpers.js +8 -2
  46. package/plugins/core/lib/querying-writing/compile-schemas.js +20 -5
  47. package/plugins/core/lib/querying-writing/knex-field-helpers.js +83 -14
  48. package/plugins/core/lib/querying-writing/knex-json-api-transformers.js +13 -12
  49. package/plugins/core/lib/querying-writing/query-field-helpers.js +88 -0
  50. package/plugins/core/lib/querying-writing/request-contracts.js +590 -0
  51. package/plugins/core/lib/querying-writing/resource-id-normalization.js +131 -0
  52. package/plugins/core/lib/querying-writing/schema-helpers.js +0 -2
  53. package/plugins/core/lib/querying-writing/simplified-helpers.js +4 -11
  54. package/plugins/core/lib/storage/canonical-storage-mapping.js +133 -0
  55. package/plugins/core/lib/storage/storage-adapter.js +82 -4
  56. package/plugins/core/lib/storage/storage-mapping.js +274 -0
  57. package/plugins/core/lib/writing/many-to-many-manipulations.js +4 -2
  58. package/plugins/core/rest-api-anyapi-knex-plugin.js +531 -312
  59. package/plugins/core/rest-api-autofilter-plugin.js +414 -0
  60. package/plugins/core/rest-api-knex-plugin.js +271 -226
  61. package/plugins/core/rest-api-plugin-hooks/register-relationship-routes.js +10 -5
  62. package/plugins/core/rest-api-plugin-hooks/register-scope-routes.js +12 -6
  63. package/plugins/core/rest-api-plugin-hooks/turn-scope-init-into-vars.js +1 -0
  64. package/plugins/core/rest-api-plugin-methods/apply-query-filters.js +41 -0
  65. package/plugins/core/rest-api-plugin-methods/common.js +148 -92
  66. package/plugins/core/rest-api-plugin-methods/delete-relationship.js +11 -2
  67. package/plugins/core/rest-api-plugin-methods/delete.js +6 -1
  68. package/plugins/core/rest-api-plugin-methods/enrich-attributes.js +6 -1
  69. package/plugins/core/rest-api-plugin-methods/get-related.js +7 -2
  70. package/plugins/core/rest-api-plugin-methods/get-relationship.js +7 -2
  71. package/plugins/core/rest-api-plugin-methods/get.js +29 -14
  72. package/plugins/core/rest-api-plugin-methods/patch-relationship.js +10 -3
  73. package/plugins/core/rest-api-plugin-methods/patch.js +56 -12
  74. package/plugins/core/rest-api-plugin-methods/post-relationship.js +11 -2
  75. package/plugins/core/rest-api-plugin-methods/post.js +21 -8
  76. package/plugins/core/rest-api-plugin-methods/put.js +73 -21
  77. package/plugins/core/rest-api-plugin-methods/query.js +15 -53
  78. package/plugins/core/rest-api-plugin-methods/release.js +0 -2
  79. package/plugins/core/rest-api-plugin.js +6 -0
  80. package/plugins/core/rest-api-positioning-plugin.js +2 -5
  81. package/plugins/core/rest-api-query-projections-plugin.js +130 -0
  82. package/plugins/core/socketio-plugin.js +1 -4
  83. package/plugins/storage/local-storage.js +1 -1
  84. package/plugins/storage/s3-storage.js +5 -2
  85. package/quickTest.js +1 -0
  86. package/scripts/run-docs.js +80 -84
  87. package/test-debug.js +1 -1
  88. package/tests/README.md +7 -0
  89. package/tests/anyapi-basic.test.js +3 -0
  90. package/tests/autofilter.test.js +463 -0
  91. package/tests/custom-id-mysql-returning-fallback.test.js +128 -0
  92. package/tests/custom-id-simplified-post.test.js +75 -0
  93. package/tests/custom-idproperty-relationships.test.js +33 -0
  94. package/tests/db-introspection.test.js +521 -0
  95. package/tests/db-table-operations.test.js +786 -0
  96. package/tests/fastify-plugin.test.js +156 -0
  97. package/tests/field-getters.test.js +1 -2
  98. package/tests/field-setters.test.js +0 -4
  99. package/tests/fixtures/api-configs.js +278 -176
  100. package/tests/helpers/fake-fastify.js +99 -0
  101. package/tests/http-connectors-parity.test.js +235 -0
  102. package/tests/id-normalization.test.js +444 -0
  103. package/tests/logical-id-write-validation.test.js +151 -0
  104. package/tests/pagination-cursor-multifield.test.js +11 -11
  105. package/tests/projected-fields.test.js +319 -0
  106. package/tests/relationships.test.js +3 -3
  107. package/tests/searchschema-knex-behavior.test.js +187 -0
  108. package/tests/searchschema-merge.test.js +21 -69
  109. package/tests/storage-mapping.test.js +259 -0
  110. package/audit/00-charter.md +0 -103
  111. package/audit/01-scope-map.md +0 -84
  112. package/audit/02-coverage-matrix.csv +0 -174
  113. package/audit/03-invariants.md +0 -123
  114. package/audit/04-standards-rubric.md +0 -56
  115. package/audit/05-competitor-rubric.md +0 -77
  116. package/audit/06-findings.md +0 -160
  117. package/audit/07-risk-register.csv +0 -10
  118. package/audit/08-remediation-roadmap.md +0 -177
  119. package/audit/09-signoff-check.md +0 -23
  120. package/audit/10-final-synthesis.md +0 -29
  121. package/audit/evidence/code/all-files-json-rest-api.txt +0 -168
  122. package/audit/evidence/code/all-files-json-rest-schema.txt +0 -12
  123. package/audit/evidence/code/boundary-leak-checks.txt +0 -72
  124. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt +0 -480
  125. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt +0 -532
  126. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__busboy-detector.js.txt +0 -175
  127. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__formidable-detector.js.txt +0 -138
  128. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__request-helpers.js.txt +0 -222
  129. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt +0 -342
  130. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__dbTablesOperations.js.txt +0 -304
  131. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__fractional-positioning.js.txt +0 -188
  132. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt +0 -336
  133. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__connectors-query-parser.js.txt +0 -165
  134. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt +0 -265
  135. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-value-normalizers.js.txt +0 -369
  136. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt +0 -72
  137. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__field-utils.js.txt +0 -139
  138. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-constants.js.txt +0 -45
  139. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-field-helpers.js.txt +0 -396
  140. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-json-api-transformers.js.txt +0 -162
  141. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__payload-validators.js.txt +0 -1314
  142. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__schema-helpers.js.txt +0 -488
  143. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__scope-validations.js.txt +0 -484
  144. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__simplified-helpers.js.txt +0 -857
  145. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt +0 -565
  146. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-json-api-transformers-querying.js.txt +0 -485
  147. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt +0 -560
  148. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-process-includes.js.txt +0 -167
  149. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers-base.js.txt +0 -109
  150. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt +0 -1064
  151. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt +0 -1983
  152. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-window-queries.js.txt +0 -328
  153. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__url-helpers.js.txt +0 -119
  154. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__storage__storage-adapter.js.txt +0 -160
  155. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__many-to-many-manipulations.js.txt +0 -300
  156. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__relationship-processor.js.txt +0 -245
  157. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt +0 -459
  158. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-cors-plugin.js.txt +0 -237
  159. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt +0 -1135
  160. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt +0 -314
  161. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__compile-resource-schemas.js.txt +0 -7
  162. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__register-relationship-routes.js.txt +0 -71
  163. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__register-scope-routes.js.txt +0 -102
  164. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__turn-scope-init-into-vars.js.txt +0 -49
  165. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__validate-include-configurations.js.txt +0 -39
  166. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__add-route.js.txt +0 -23
  167. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__check-permissions.js.txt +0 -13
  168. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt +0 -639
  169. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete-relationship.js.txt +0 -117
  170. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete.js.txt +0 -104
  171. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__enrich-attributes.js.txt +0 -199
  172. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get-related.js.txt +0 -353
  173. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get-relationship.js.txt +0 -61
  174. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get.js.txt +0 -184
  175. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch-relationship.js.txt +0 -55
  176. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch.js.txt +0 -191
  177. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post-relationship.js.txt +0 -110
  178. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post.js.txt +0 -168
  179. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__put.js.txt +0 -253
  180. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__query.js.txt +0 -207
  181. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__release.js.txt +0 -12
  182. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin.js.txt +0 -165
  183. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt +0 -668
  184. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt +0 -621
  185. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt +0 -218
  186. package/audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__s3-storage.js.txt +0 -124
  187. package/audit/evidence/code/critical-pass1/json-rest-schema__src__CorePlugin.js.txt +0 -269
  188. package/audit/evidence/code/critical-pass1/json-rest-schema__src__Schema.js.txt +0 -242
  189. package/audit/evidence/code/critical-pass1/json-rest-schema__src__index.js.txt +0 -77
  190. package/audit/evidence/code/critical-pass1-risk-keywords.txt +0 -238
  191. package/audit/evidence/code/critical-pass1-summary.csv +0 -67
  192. package/audit/evidence/code/critical-pass2-summary.csv +0 -67
  193. package/audit/evidence/code/early-silent-zones-no-test-token.txt +0 -57
  194. package/audit/evidence/code/error-model-signals.txt +0 -98
  195. package/audit/evidence/code/git-files-json-rest-api.txt +0 -171
  196. package/audit/evidence/code/git-files-json-rest-schema.txt +0 -27
  197. package/audit/evidence/code/hook-flow-signals.txt +0 -282
  198. package/audit/evidence/code/idproperty-signals.txt +0 -157
  199. package/audit/evidence/code/import-cycles-non-anyapi.txt +0 -3
  200. package/audit/evidence/code/import-hotspots-non-anyapi.txt +0 -96
  201. package/audit/evidence/code/imports-json-rest-api.txt +0 -354
  202. package/audit/evidence/code/imports-json-rest-schema.txt +0 -15
  203. package/audit/evidence/code/in-scope-files-json-rest-api.txt +0 -160
  204. package/audit/evidence/code/in-scope-files-json-rest-schema.txt +0 -13
  205. package/audit/evidence/code/non-anyapi-core-files.txt +0 -101
  206. package/audit/evidence/code/permission-signals.txt +0 -193
  207. package/audit/evidence/code/query-include-signals.txt +0 -687
  208. package/audit/evidence/code/transaction-signals.txt +0 -28
  209. package/audit/evidence/code/validation-signals.txt +0 -650
  210. package/audit/evidence/code/write-path-signals.txt +0 -61
  211. package/audit/evidence/docs/docs-claims-signals.txt +0 -1075
  212. package/audit/evidence/docs/schema-docs-claims-signals.txt +0 -179
  213. package/audit/evidence/external/corpus-freeze.md +0 -21
  214. package/audit/evidence/external/npm-competitor-metadata.txt +0 -70
  215. package/audit/evidence/external/npm-download-signals.txt +0 -23
  216. package/audit/evidence/external/npm-jsonapi-server.txt +0 -8
  217. package/audit/evidence/external/npm-modern-jsonapi-metadata.txt +0 -38
  218. package/audit/evidence/external/readme-fortune-signals.txt +0 -26
  219. package/audit/evidence/external/readme-fortune.md +0 -165
  220. package/audit/evidence/external/readme-json-api-serializer-signals.txt +0 -80
  221. package/audit/evidence/external/readme-json-api-serializer.md +0 -690
  222. package/audit/evidence/external/readme-jsonapi-serde-server-signals.txt +0 -0
  223. package/audit/evidence/external/readme-jsonapi-serde-server.md +0 -22
  224. package/audit/evidence/external/readme-jsonapi-serializer-signals.txt +0 -63
  225. package/audit/evidence/external/readme-jsonapi-serializer.md +0 -315
  226. package/audit/evidence/external/readme-jsonapi-server-signals.txt +0 -19
  227. package/audit/evidence/external/readme-jsonapi-server.md +0 -104
  228. package/audit/evidence/external/readme-nestjs-json-api-signals.txt +0 -4
  229. package/audit/evidence/external/readme-nestjs-json-api.md +0 -94
  230. package/audit/evidence/external/readme-yaser-json-api-nestjs-signals.txt +0 -47
  231. package/audit/evidence/external/readme-yaser-json-api-nestjs.md +0 -447
  232. package/audit/evidence/external/standard-jsonapi-snippets.txt +0 -84
  233. package/audit/evidence/external/standard-rfc-snippets.txt +0 -168
  234. package/audit/evidence/external/standards-sources.txt +0 -6
  235. package/audit/evidence/runtime/baseline-commits.txt +0 -2
  236. package/audit/evidence/runtime/db-adapter-assumptions.txt +0 -3
  237. package/audit/evidence/runtime/environment.txt +0 -4
  238. package/audit/evidence/runtime/invariant-runtime-mapping.md +0 -38
  239. package/audit/evidence/runtime/probe-patch-relationship-error.exitcode +0 -1
  240. package/audit/evidence/runtime/probe-patch-relationship-error.log +0 -76
  241. package/audit/evidence/runtime/probe-patch-relationship-error.mjs +0 -67
  242. package/audit/evidence/runtime/probe-patch-relationship-referenceerror.exitcode +0 -1
  243. package/audit/evidence/runtime/probe-patch-relationship-referenceerror.log +0 -62
  244. package/audit/evidence/runtime/probe-patch-relationship-referenceerror.mjs +0 -47
  245. package/audit/evidence/runtime/test-exitcodes.txt +0 -4
  246. package/audit/evidence/runtime/test-summary.md +0 -107
  247. package/audit/evidence/runtime/trace-anchors.txt +0 -61
  248. package/audit/evidence/tests/access-multitenancy-test-signals.txt +0 -125
  249. package/audit/evidence/tests/failing-tests-summary.txt +0 -25
  250. package/audit/evidence/tests/npm-test-json-rest-api.exitcode +0 -1
  251. package/audit/evidence/tests/npm-test-json-rest-api.log +0 -5885
  252. package/audit/evidence/tests/npm-test-json-rest-schema.exitcode +0 -1
  253. package/audit/evidence/tests/npm-test-json-rest-schema.log +0 -356
  254. package/audit/evidence/tests/query-include-test-signals.txt +0 -948
  255. package/audit/evidence/tests/relationship-test-signals.txt +0 -223
  256. package/audit/evidence/tests/skipped-tests.txt +0 -10
  257. package/audit/evidence/tests/test-suite-list-non-anyapi.txt +0 -30
  258. package/audit/evidence/tests/test-suite-list.txt +0 -32
  259. package/audit/subsystems/docs-drift.md +0 -49
  260. package/audit/subsystems/pass2-cross-review.md +0 -131
  261. package/audit/subsystems/plugins-access.md +0 -51
  262. package/audit/subsystems/plugins-bulk.md +0 -50
  263. package/audit/subsystems/plugins-cors.md +0 -48
  264. package/audit/subsystems/plugins-file.md +0 -53
  265. package/audit/subsystems/plugins-multihome.md +0 -50
  266. package/audit/subsystems/plugins-positioning.md +0 -54
  267. package/audit/subsystems/plugins-socketio.md +0 -50
  268. package/audit/subsystems/query-engine.md +0 -61
  269. package/audit/subsystems/relationships.md +0 -55
  270. package/audit/subsystems/rest-orchestration.md +0 -66
  271. package/audit/subsystems/schema-core.md +0 -64
  272. package/audit/subsystems/storage-knex.md +0 -57
  273. package/audit/subsystems/tests.md +0 -48
  274. package/audit/subsystems/transport-express.md +0 -55
  275. package/audit/traces/trace-read-get.md +0 -22
  276. package/audit/traces/trace-read-query.md +0 -25
  277. package/audit/traces/trace-relationship-endpoints.md +0 -31
  278. package/audit/traces/trace-write-delete.md +0 -17
  279. package/audit/traces/trace-write-patch.md +0 -26
  280. package/audit/traces/trace-write-post.md +0 -22
  281. package/audit/traces/trace-write-put.md +0 -23
  282. package/docs/GUIDE/GUIDE_4_Authentication_And_Permissions.md +0 -707
  283. package/docs/GUIDE/GUIDE_X_Multihome.md +0 -666
  284. package/plugins/core/lib/querying-writing/payload-validators.js +0 -1314
  285. package/plugins/core/rest-api-access.js +0 -459
  286. package/plugins/core/rest-api-multihome-plugin.js +0 -314
  287. package/tests/multihome.test.js +0 -553
  288. package/tests/multihome.test.js.bak +0 -550
  289. package/tests/ownership-optout.test.js +0 -76
  290. package/tests/rest-api-access.test.js +0 -206
@@ -1,168 +0,0 @@
1
- # RFC9110 + RFC5789 key clauses (captured)
2
- captured_at=2026-03-01T16:01:55Z
3
-
4
- ## RFC9110
5
- source=https://www.rfc-editor.org/rfc/rfc9110
6
- 279: 15.5.1. 400 Bad Request
7
- 282: 15.5.4. 403 Forbidden
8
- 283: 15.5.5. 404 Not Found
9
- 288: 15.5.10. 409 Conflict
10
- 289: 15.5.11. 410 Gone
11
- 290: 15.5.12. 411 Length Required
12
- 291: 15.5.13. 412 Precondition Failed
13
- 292: 15.5.14. 413 Content Too Large
14
- 293: 15.5.15. 414 URI Too Long
15
- 294: 15.5.16. 415 Unsupported Media Type
16
- 295: 15.5.17. 416 Range Not Satisfiable
17
- 296: 15.5.18. 417 Expectation Failed
18
- 297: 15.5.19. 418 (Unused)
19
- 386: interface, extensible semantics, and self-descriptive messages to
20
- 444: All three major versions of HTTP rely on the semantics defined by
21
- 450: This revision of HTTP separates the definition of semantics (this
22
- 453: independently while referring to the same core semantics.
23
- 466: semantics in relation to the identified target resource, and responds
24
- 469: out, determining what to do next based on the status codes and
25
- 472: HTTP semantics include the intentions defined by each request method
26
- 473: (Section 9), extensions to those semantics that might be described in
27
- 474: request header fields, status codes that describe the response
28
- 581: the semantics of protocol elements sent. For example, a client that
29
- 631: the semantics defined for it by this specification, including
30
- 634: implements what is implied by those semantics. For example, an
31
- 642: specific error handling mechanisms except when they have a direct
32
- 644: require different error handling strategies. For example, a Web
33
- 647: systems control client might consider any form of error recovery to
34
- 662: While HTTP's core semantics don't change between protocol versions,
35
- 678: semantics or implying additional capabilities of the sender.
36
- 706: request semantics, which is made possible by vesting the request
37
- 707: semantics in the request method (Section 9) and a few request-
38
- 709: manner inconsistent with the semantics of the method of the request.
39
- 710: For example, though the URI of a resource might imply semantics that
40
- 769: message's semantics can be understood in isolation, and that the
41
- 800: "response" messages, each including a status code (Section 15). The
42
- 803: interpreted in accordance with the status code, and trailer fields to
43
- 830: reporting of errors to the user, it is acceptable for such reporting
44
- 831: to only be observable in an error console or log file. Likewise,
45
- 943: mistakenly violating HTTP semantics.
46
- 1217: its presence as an error; it is likely being used to obscure the
47
- 1272: the semantics that users will associate with a URI, and the
48
- 1273: usefulness of those semantics is what ultimately transforms these
49
- 1426: error. Automated clients MUST log the error to an appropriate audit
50
- 1428: certificate error). Automated clients MAY provide a configuration
51
- 1462: semantics defined by that name. For example, the Date header field
52
- 1481: their defined semantics allow them to be safely ignored by recipients
53
- 1519: the semantics of the message, by appending each subsequent field line
54
- 1566: specific field's semantics.
55
- 1570: appropriate 4xx (Client Error) status code. Ignoring such header
56
- 1575: than the client wishes to process if the field semantics are such
57
- 1577: message framing or response semantics.
58
- 1629: detecting such errors improves interoperability. Fields that expect
59
- 1762: OWS and RWS have the same semantics as a single SP. Any content
60
- 1771: BWS has no semantics. Any content known to be defined as BWS MAY be
61
- 1824: might not be case-sensitive, depending on the semantics of the
62
- 1919: semantics of day-name, day, month, year, and time-of-day are the same
63
- 1944: common structure, and capacity for conveying semantics. This
64
- 1975: semantics, and trailer fields provide optional metadata that was
65
- 2016: level error indicates that it is not complete.
66
- 2023: Response message control data includes a status code (Section 15),
67
- 2051: from the response status code or header fields (e.g., Server) that
68
- 2078: semantics, describe the sender, define the content, or provide
69
- 2110: semantics (Section 9).
70
- 2119: method, response status code (Section 15), and response fields
71
- 2123: date (Section 6.6.1), whereas the content of the same status code in
72
- 2132: Response messages with an error status code usually contain content
73
- 2133: that represents the error condition, such that the content describes
74
- 2134: the error state and what steps are suggested for resolving it.
75
- 2178: 1. If the request method is HEAD or the response status code is 204
76
- 2182: 2. If the request method is GET and the response status code is 200
77
- 2186: 3. If the request method is GET and the response status code is 203
78
- 2191: 4. If the request method is GET and the response status code is 206
79
- 2218: fields in the header section to avoid contradicting message semantics
80
- 2276: name have the equivalent semantics as appending the multiple values
81
- 2296: message was originated, having the same semantics as the Origination
82
- 2450: semantics and, if so, where that request is to be directed.
83
- 2494: client to a different resource, respond with an error, or drop the
84
- 2517: The 421 (Misdirected Request) status code in a response indicates
85
- 2528: All responses, regardless of the status code (including interim
86
-
87
- ## RFC5789
88
- source=https://www.rfc-editor.org/rfc/rfc5789.txt
89
- 13: PATCH Method for HTTP
90
- 20: This proposal adds a new HTTP method, PATCH, to modify an existing
91
- 60:RFC 5789 HTTP PATCH March 2010
92
- 66: 2. The PATCH Method ................................................2
93
- 67: 2.1. A Simple PATCH Example .....................................4
94
- 82: This specification defines the new HTTP/1.1 [RFC2616] method, PATCH,
95
- 83: which is used to apply partial modifications to a resource.
96
- 86: errors. The PUT method is already defined to overwrite a resource
97
- 91: discover patch format support). PATCH was mentioned in earlier HTTP
98
- 94: In this document, the key words "MUST", "MUST NOT", "REQUIRED",
99
- 95: "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",
100
- 101:2. The PATCH Method
101
- 103: The PATCH method requests that a set of changes described in the
102
- 116:RFC 5789 HTTP PATCH March 2010
103
- 119: The difference between the PUT and PATCH requests is reflected in the
104
- 124: be replaced. With PATCH, however, the enclosed entity contains a set
105
- 126: origin server should be modified to produce a new version. The PATCH
106
- 130: PATCH.
107
- 132: PATCH is neither safe nor idempotent as defined by [RFC2616], Section
108
- 135: A PATCH request can be issued in such a way as to be idempotent,
109
- 137: PATCH requests on the same resource in a similar time frame.
110
- 138: Collisions from multiple PATCH requests may be more dangerous than
111
- 141: using this kind of patch application SHOULD use a conditional request
112
- 144: can use a strong ETag [RFC2616] in an If-Match header on the PATCH
113
- 152: The server MUST apply the entire set of changes atomically and never
114
- 155: cannot be successfully applied, then the server MUST NOT apply any of
115
- 157: PATCH can vary depending on the patch document and the type of
116
- 160: directory hierarchy. The atomicity requirement holds for all
117
- 162: details on status codes and possible error conditions.
118
- 165: one or more currently cached entities, those entries SHOULD be
119
- 172:RFC 5789 HTTP PATCH March 2010
120
- 177: header matching the Request-URI, indicating that the PATCH response
121
- 178: body is a resource representation. A cached PATCH response can only
122
- 179: be used to respond to subsequent GET and HEAD requests; it MUST NOT
123
- 180: be used to respond to other methods (in particular, PATCH).
124
- 183: contained patch document and MUST NOT be applied to the resource
125
- 186: the patch document had a language. Servers SHOULD NOT store such
126
- 187: headers except as trace information, and SHOULD NOT use such header
127
- 193: There is no guarantee that a resource can be modified with PATCH.
128
- 198: are required to support. Servers MUST ensure that a received patch
129
- 202: Clients need to choose when to use PATCH rather than PUT. For
130
- 205: sense to use PUT instead of PATCH. A comparison to POST is even more
131
- 207: encompass PUT and PATCH-like operations if the server chooses. If
132
- 209: URI in a predictable way, POST should be considered instead of PATCH
133
- 212:2.1. A Simple PATCH Example
134
- 214: PATCH /file.txt HTTP/1.1
135
- 228:RFC 5789 HTTP PATCH March 2010
136
- 234: Successful PATCH response to existing text file:
137
- 245: entity created by applying the PATCH, available at
138
- 251: There are several known conditions under which a PATCH request can
139
- 256: SHOULD return a 400 (Bad Request) response. The definition of
140
- 262: identified by the Request-URI. Such a response SHOULD include an
141
- 274: more specific errors like "Conflicting State" that could be
142
- 275: signaled with this status code, but the more specific error would
143
- 284:RFC 5789 HTTP PATCH March 2010
144
- 301: precondition failed, then the 412 (Precondition Failed) error is
145
- 308: Concurrent modification: Some applications of PATCH might require
146
- 313: indicate this error by using a 409 (Conflict) response.
147
- 325: The entity body of error responses SHOULD contain enough information
148
- 326: to communicate the nature of the error to the client. The content-
149
- 340:RFC 5789 HTTP PATCH March 2010
150
- 345: A server can advertise its support for the PATCH method by adding it
151
- 347: header defined in HTTP/1.1. The PATCH method MAY appear in the
152
- 355: Accept-Patch SHOULD appear in the OPTIONS response for any resource
153
- 356: that supports the use of the PATCH method. The presence of the
154
- 358: indication that PATCH is allowed on the resource identified by the
155
- 383: Allow: GET, PUT, POST, OPTIONS, HEAD, DELETE, PATCH
156
- 386: The examples show a server that supports PATCH generally using two
157
- 396:RFC 5789 HTTP PATCH March 2010
158
- 416: The security considerations for PATCH are nearly identical to the
159
- 420: transport errors or through accidental overwrites. Whatever
160
- 421: mechanisms are used for PUT can be used for PATCH as well. The
161
- 422: following considerations apply especially to PATCH.
162
- 428: Section 2. If a PATCH request fails, the client can issue a GET
163
- 431: if the PATCH request can be resent, but in other cases, the attempt
164
- 433: of a failure of the underlying transport channel, where a PATCH
165
- 442: response. The PATCH method complicates such watch-keeping because
166
- 452:RFC 5789 HTTP PATCH March 2010
167
- 463: documents. Servers MUST take adequate precautions to ensure that
168
- 465: CPU, disk I/O) through the client's use of PATCH.
@@ -1,6 +0,0 @@
1
- # Standards references fetch time
2
- captured_at=2026-03-01T16:01:15Z
3
- jsonapi_format=https://jsonapi.org/format/
4
- rfc9110=https://www.rfc-editor.org/rfc/rfc9110
5
- rfc5789=https://www.rfc-editor.org/rfc/rfc5789
6
- fetch_cors=https://fetch.spec.whatwg.org/#http-cors-protocol
@@ -1,2 +0,0 @@
1
- json-rest-api 72c08eec75f696a80c70b25608ed7c19eb505698
2
- json-rest-schema 9c30d3ba7317407a69231515fd58196862b25b34
@@ -1,3 +0,0 @@
1
- json-rest-api package peerDeps: knex optional, express/socket.io optional
2
- json-rest-api tests default storage mode: knex (SQLite in-memory for fixtures)
3
- json-rest-schema tests: knex + sqlite3
@@ -1,4 +0,0 @@
1
- date_utc=2026-03-01T15:32:20Z
2
- node=v20.19.0
3
- npm=11.6.2
4
- os=Linux merc-ThinkPad-X1-Carbon-Gen-8 6.14.0-37-generic #37~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 20 10:25:38 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
@@ -1,38 +0,0 @@
1
- # Runtime-to-Invariant Mapping (M5)
2
-
3
- ## Observed runtime/test failures
4
-
5
- 1. `patchRelationship` failure path emits `ReferenceError: handleWriteMethodError is not defined`.
6
- - Evidence:
7
- - [probe-patch-relationship-referenceerror.log](/home/merc/Development/current/json-rest-api/audit/evidence/runtime/probe-patch-relationship-referenceerror.log)
8
- - Invariant impact:
9
- - `INV-001` fail
10
- - `INV-008` fail
11
- - Risk mapping:
12
- - `RISK-001`
13
-
14
- 2. Positioning multifilter suite has 2 assertion failures.
15
- - Evidence:
16
- - [failing-tests-summary.txt](/home/merc/Development/current/json-rest-api/audit/evidence/tests/failing-tests-summary.txt)
17
- - Invariant impact:
18
- - `INV-010` partial
19
- - `INV-012` partial
20
- - Risk mapping:
21
- - `RISK-002`
22
-
23
- 3. `json-rest-schema` suite has 1 failing import contract test.
24
- - Evidence:
25
- - [npm-test-json-rest-schema.log](/home/merc/Development/current/json-rest-api/audit/evidence/tests/npm-test-json-rest-schema.log)
26
- - Invariant impact:
27
- - `INV-012` partial
28
- - Risk mapping:
29
- - `RISK-004`
30
-
31
- ## Non-failing but risk-relevant runtime signal
32
- - Full `json-rest-api` run includes 324 passing tests with 10 skipped; skips concentrate in cursor multifield pagination suite.
33
- - Evidence:
34
- - [test-summary.md](/home/merc/Development/current/json-rest-api/audit/evidence/runtime/test-summary.md)
35
- - [skipped-tests.txt](/home/merc/Development/current/json-rest-api/audit/evidence/tests/skipped-tests.txt)
36
- - Invariant impact:
37
- - `INV-007` partial
38
- - `INV-012` partial
@@ -1,76 +0,0 @@
1
- 2026-03-01T15:55:13.737Z [INFO] [basic-test-api] Installing plugin 'rest-api' {
2
- options: {
3
- simplifiedApi: false,
4
- simplifiedTransport: false,
5
- returnRecordApi: { post: true, put: false, patch: false },
6
- returnRecordTransport: { post: 'full', put: 'no', patch: 'minimal' },
7
- sortableFields: [ 'id', 'title', 'country_id', 'publisher_id', 'name', 'code' ]
8
- }
9
- }
10
- 2026-03-01T15:55:13.741Z [INFO] [basic-test-api] Plugin 'rest-api' installed successfully { duration: '1ms' }
11
- 2026-03-01T15:55:13.742Z [INFO] [basic-test-api] Installing plugin 'rest-api-knex' { options: '[Object with methods]' }
12
- 2026-03-01T15:55:13.747Z [INFO] [basic-test-api:plugin:rest-api-knex] Database capabilities detected: { database: 'SQLite', version: '3.49.2', windowFunctions: true }
13
- 2026-03-01T15:55:13.747Z [INFO] [basic-test-api:plugin:rest-api-knex] RestApiKnexPlugin installed - basic CRUD operations ready
14
- 2026-03-01T15:55:13.747Z [INFO] [basic-test-api] Plugin 'rest-api-knex' installed successfully { duration: '5ms' }
15
- 2026-03-01T15:55:13.748Z [INFO] [basic-test-api] Scope 'countries' added successfully
16
- 2026-03-01T15:55:13.750Z [INFO] [basic-test-api:global] Routes registered for scope 'countries'
17
- 2026-03-01T15:55:13.753Z [INFO] [basic-test-api] Scope 'publishers' added successfully
18
- 2026-03-01T15:55:13.753Z [INFO] [basic-test-api:global] Routes registered for scope 'publishers'
19
- 2026-03-01T15:55:13.754Z [INFO] [basic-test-api] Scope 'authors' added successfully
20
- 2026-03-01T15:55:13.754Z [INFO] [basic-test-api:global] Routes registered for scope 'authors'
21
- 2026-03-01T15:55:13.754Z [INFO] [basic-test-api] Scope 'books' added successfully
22
- 2026-03-01T15:55:13.755Z [INFO] [basic-test-api:global] Routes registered for scope 'books'
23
- 2026-03-01T15:55:13.755Z [INFO] [basic-test-api] Scope 'book_authors' added successfully
24
- 2026-03-01T15:55:13.755Z [INFO] [basic-test-api:global] Routes registered for scope 'book_authors'
25
-
26
- === invalid relationshipData type (string) ===
27
- 2026-03-01T15:55:13.768Z [ERROR] [basic-test-api:books] Error in PATCH method {
28
- scopeName: 'books',
29
- method: 'patch',
30
- inputRecord: { data: { type: 'books', id: '1', relationships: [Object] } },
31
- error: {
32
- name: 'RestApiPayloadError',
33
- message: "Relationship 'authors': Resource identifier must be an object",
34
- stack: "RestApiPayloadError: Relationship 'authors': Resource identifier must be an object\n" +
35
- ' at validateResourceIdentifier (file:///home/merc/Development/current/json-rest-api/plugins/core/lib/querying-writing/payload-validators.js:104:11)\n' +
36
- ' at validateRelationship (file:///home/merc/Development/current/json-rest-api/plugins/core/lib/querying-writing/payload-validators.js:232:5)\n' +
37
- ' at file:///home/merc/Development/current/json-rest-api/plugins/core/lib/querying-writing/payload-validators.js:1309:7\n' +
38
- ' at Array.forEach (<anonymous>)\n' +
39
- ' at validatePatchPayload (file:///home/merc/Development/current/json-rest-api/plugins/core/lib/querying-writing/payload-validators.js:1308:40)\n' +
40
- ' at patchMethod (file:///home/merc/Development/current/json-rest-api/plugins/core/rest-api-plugin-methods/patch.js:64:5)\n' +
41
- ' at async Proxy.<anonymous> (file:///home/merc/Development/current/json-rest-api/node_modules/hooked-api/index.js:593:34)\n' +
42
- ' at async patchRelationshipMethod (file:///home/merc/Development/current/json-rest-api/plugins/core/rest-api-plugin-methods/patch-relationship.js:28:5)\n' +
43
- ' at async Proxy.<anonymous> (file:///home/merc/Development/current/json-rest-api/node_modules/hooked-api/index.js:593:34)\n' +
44
- ' at async main (file:///home/merc/Development/current/json-rest-api/audit/evidence/runtime/probe-patch-relationship-error.mjs:50:7)',
45
- code: 'REST_API_PAYLOAD',
46
- type: 'rest_api_payload',
47
- path: "Relationship 'authors'",
48
- details: {
49
- path: "Relationship 'authors'",
50
- expected: 'object',
51
- received: 'string'
52
- }
53
- },
54
- errorSummary: "Relationship 'authors': Resource identifier must be an object | code: REST_API_PAYLOAD"
55
- }
56
- 2026-03-01T15:55:13.769Z [ERROR] [basic-test-api] Scope method 'patch' on 'books' failed {
57
- error: "Relationship 'authors': Resource identifier must be an object",
58
- duration: '2ms'
59
- }
60
- 2026-03-01T15:55:13.769Z [ERROR] [basic-test-api] Scope method 'patchRelationship' on 'books' failed { error: 'handleWriteMethodError is not defined', duration: '2ms' }
61
- RESULT: error
62
- NAME: ReferenceError
63
- MESSAGE: handleWriteMethodError is not defined
64
- STACK_HEAD: ReferenceError: handleWriteMethodError is not defined | at patchRelationshipMethod (file:///home/merc/Development/current/json-rest-api/plugins/core/rest-api-plugin-methods/patch-relationship.js:53:5) | at async Proxy.<anonymous> (file:///home/merc/Development/current/json-rest-api/node_modules/hooked-api/index.js:593:34) | at async main (file:///home/merc/Development/current/json-rest-api/audit/evidence/runtime/probe-patch-relationship-error.mjs:50:7)
65
-
66
- === invalid relationshipData shape (object) ===
67
- 2026-03-01T15:56:13.771Z [ERROR] [basic-test-api] Scope method 'patchRelationship' on 'books' failed {
68
- error: 'Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?',
69
- duration: '60002ms'
70
- }
71
- RESULT: error
72
- NAME: KnexTimeoutError
73
- MESSAGE: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
74
- STACK_HEAD: KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call? | at Client_BetterSQLite3.acquireConnection (/home/merc/Development/current/json-rest-api/node_modules/knex/lib/client.js:332:26) | at async Transaction_Sqlite.acquireConnection (/home/merc/Development/current/json-rest-api/node_modules/knex/lib/execution/transaction.js:262:28)
75
-
76
- === missing book id ===
@@ -1,67 +0,0 @@
1
- import knexLib from 'knex'
2
- import { createBasicApi } from '../../../tests/fixtures/api-configs.js'
3
- import { createJsonApiDocument, createRelationship, resourceIdentifier } from '../../../tests/helpers/test-utils.js'
4
-
5
- const knex = knexLib({
6
- client: 'better-sqlite3',
7
- connection: { filename: ':memory:' },
8
- useNullAsDefault: true
9
- })
10
-
11
- function header (name) { console.log(`\n=== ${name} ===`) }
12
-
13
- async function main () {
14
- const api = await createBasicApi(knex, { includeExpress: false })
15
-
16
- const country = await api.resources.countries.post({
17
- inputRecord: createJsonApiDocument('countries', { name: 'USA', code: 'US' }),
18
- simplified: false
19
- })
20
-
21
- const book = await api.resources.books.post({
22
- inputRecord: createJsonApiDocument('books', { title: 'Book 1' }, {
23
- country: createRelationship(resourceIdentifier('countries', country.data.id))
24
- }),
25
- simplified: false
26
- })
27
-
28
- const scenarios = [
29
- {
30
- name: 'invalid relationshipData type (string)',
31
- args: { id: book.data.id, relationshipName: 'authors', relationshipData: 'bad-type' }
32
- },
33
- {
34
- name: 'invalid relationshipData shape (object)',
35
- args: { id: book.data.id, relationshipName: 'authors', relationshipData: { type: 'authors', id: 1 } }
36
- },
37
- {
38
- name: 'missing book id',
39
- args: { id: 999999, relationshipName: 'authors', relationshipData: [] }
40
- },
41
- {
42
- name: 'unknown relationship name',
43
- args: { id: book.data.id, relationshipName: 'nonexistentRelationship', relationshipData: [] }
44
- }
45
- ]
46
-
47
- for (const s of scenarios) {
48
- header(s.name)
49
- try {
50
- await api.resources.books.patchRelationship(s.args)
51
- console.log('RESULT: success')
52
- } catch (error) {
53
- console.log('RESULT: error')
54
- console.log('NAME:', error?.name)
55
- console.log('MESSAGE:', error?.message)
56
- console.log('STACK_HEAD:', String(error?.stack || '').split('\n').slice(0, 6).join(' | '))
57
- }
58
- }
59
-
60
- await knex.destroy()
61
- }
62
-
63
- main().catch(async (e) => {
64
- console.error('FATAL:', e)
65
- await knex.destroy()
66
- process.exitCode = 1
67
- })
@@ -1,62 +0,0 @@
1
- 2026-03-01T15:57:20.166Z [INFO] [basic-test-api] Installing plugin 'rest-api' {
2
- options: {
3
- simplifiedApi: false,
4
- simplifiedTransport: false,
5
- returnRecordApi: { post: true, put: false, patch: false },
6
- returnRecordTransport: { post: 'full', put: 'no', patch: 'minimal' },
7
- sortableFields: [ 'id', 'title', 'country_id', 'publisher_id', 'name', 'code' ]
8
- }
9
- }
10
- 2026-03-01T15:57:20.170Z [INFO] [basic-test-api] Plugin 'rest-api' installed successfully { duration: '1ms' }
11
- 2026-03-01T15:57:20.171Z [INFO] [basic-test-api] Installing plugin 'rest-api-knex' { options: '[Object with methods]' }
12
- 2026-03-01T15:57:20.177Z [INFO] [basic-test-api:plugin:rest-api-knex] Database capabilities detected: { database: 'SQLite', version: '3.49.2', windowFunctions: true }
13
- 2026-03-01T15:57:20.177Z [INFO] [basic-test-api:plugin:rest-api-knex] RestApiKnexPlugin installed - basic CRUD operations ready
14
- 2026-03-01T15:57:20.177Z [INFO] [basic-test-api] Plugin 'rest-api-knex' installed successfully { duration: '6ms' }
15
- 2026-03-01T15:57:20.178Z [INFO] [basic-test-api] Scope 'countries' added successfully
16
- 2026-03-01T15:57:20.180Z [INFO] [basic-test-api:global] Routes registered for scope 'countries'
17
- 2026-03-01T15:57:20.184Z [INFO] [basic-test-api] Scope 'publishers' added successfully
18
- 2026-03-01T15:57:20.184Z [INFO] [basic-test-api:global] Routes registered for scope 'publishers'
19
- 2026-03-01T15:57:20.185Z [INFO] [basic-test-api] Scope 'authors' added successfully
20
- 2026-03-01T15:57:20.185Z [INFO] [basic-test-api:global] Routes registered for scope 'authors'
21
- 2026-03-01T15:57:20.186Z [INFO] [basic-test-api] Scope 'books' added successfully
22
- 2026-03-01T15:57:20.186Z [INFO] [basic-test-api:global] Routes registered for scope 'books'
23
- 2026-03-01T15:57:20.187Z [INFO] [basic-test-api] Scope 'book_authors' added successfully
24
- 2026-03-01T15:57:20.187Z [INFO] [basic-test-api:global] Routes registered for scope 'book_authors'
25
- 2026-03-01T15:57:20.204Z [ERROR] [basic-test-api:books] Error in PATCH method {
26
- scopeName: 'books',
27
- method: 'patch',
28
- inputRecord: { data: { type: 'books', id: '1', relationships: [Object] } },
29
- error: {
30
- name: 'RestApiPayloadError',
31
- message: "Relationship 'authors': Resource identifier must be an object",
32
- stack: "RestApiPayloadError: Relationship 'authors': Resource identifier must be an object\n" +
33
- ' at validateResourceIdentifier (file:///home/merc/Development/current/json-rest-api/plugins/core/lib/querying-writing/payload-validators.js:104:11)\n' +
34
- ' at validateRelationship (file:///home/merc/Development/current/json-rest-api/plugins/core/lib/querying-writing/payload-validators.js:232:5)\n' +
35
- ' at file:///home/merc/Development/current/json-rest-api/plugins/core/lib/querying-writing/payload-validators.js:1309:7\n' +
36
- ' at Array.forEach (<anonymous>)\n' +
37
- ' at validatePatchPayload (file:///home/merc/Development/current/json-rest-api/plugins/core/lib/querying-writing/payload-validators.js:1308:40)\n' +
38
- ' at patchMethod (file:///home/merc/Development/current/json-rest-api/plugins/core/rest-api-plugin-methods/patch.js:64:5)\n' +
39
- ' at async Proxy.<anonymous> (file:///home/merc/Development/current/json-rest-api/node_modules/hooked-api/index.js:593:34)\n' +
40
- ' at async patchRelationshipMethod (file:///home/merc/Development/current/json-rest-api/plugins/core/rest-api-plugin-methods/patch-relationship.js:28:5)\n' +
41
- ' at async Proxy.<anonymous> (file:///home/merc/Development/current/json-rest-api/node_modules/hooked-api/index.js:593:34)\n' +
42
- ' at async main (file:///home/merc/Development/current/json-rest-api/audit/evidence/runtime/probe-patch-relationship-referenceerror.mjs:27:5)',
43
- code: 'REST_API_PAYLOAD',
44
- type: 'rest_api_payload',
45
- path: "Relationship 'authors'",
46
- details: {
47
- path: "Relationship 'authors'",
48
- expected: 'object',
49
- received: 'string'
50
- }
51
- },
52
- errorSummary: "Relationship 'authors': Resource identifier must be an object | code: REST_API_PAYLOAD"
53
- }
54
- 2026-03-01T15:57:20.205Z [ERROR] [basic-test-api] Scope method 'patch' on 'books' failed {
55
- error: "Relationship 'authors': Resource identifier must be an object",
56
- duration: '2ms'
57
- }
58
- 2026-03-01T15:57:20.205Z [ERROR] [basic-test-api] Scope method 'patchRelationship' on 'books' failed { error: 'handleWriteMethodError is not defined', duration: '4ms' }
59
- PROBE_RESULT=error
60
- ERROR_NAME=ReferenceError
61
- ERROR_MESSAGE=handleWriteMethodError is not defined
62
- ERROR_STACK=ReferenceError: handleWriteMethodError is not defined | at patchRelationshipMethod (file:///home/merc/Development/current/json-rest-api/plugins/core/rest-api-plugin-methods/patch-relationship.js:53:5) | at async Proxy.<anonymous> (file:///home/merc/Development/current/json-rest-api/node_modules/hooked-api/index.js:593:34) | at async main (file:///home/merc/Development/current/json-rest-api/audit/evidence/runtime/probe-patch-relationship-referenceerror.mjs:27:5)
@@ -1,47 +0,0 @@
1
- import knexLib from 'knex'
2
- import { createBasicApi } from '../../../tests/fixtures/api-configs.js'
3
- import { createJsonApiDocument, createRelationship, resourceIdentifier } from '../../../tests/helpers/test-utils.js'
4
-
5
- const knex = knexLib({
6
- client: 'better-sqlite3',
7
- connection: { filename: ':memory:' },
8
- useNullAsDefault: true
9
- })
10
-
11
- async function main () {
12
- const api = await createBasicApi(knex, { includeExpress: false })
13
-
14
- const country = await api.resources.countries.post({
15
- inputRecord: createJsonApiDocument('countries', { name: 'USA', code: 'US' }),
16
- simplified: false
17
- })
18
-
19
- const book = await api.resources.books.post({
20
- inputRecord: createJsonApiDocument('books', { title: 'Book 1' }, {
21
- country: createRelationship(resourceIdentifier('countries', country.data.id))
22
- }),
23
- simplified: false
24
- })
25
-
26
- try {
27
- await api.resources.books.patchRelationship({
28
- id: book.data.id,
29
- relationshipName: 'authors',
30
- relationshipData: 'bad-type'
31
- })
32
- console.log('PROBE_RESULT=unexpected_success')
33
- } catch (error) {
34
- console.log('PROBE_RESULT=error')
35
- console.log('ERROR_NAME=' + (error?.name || ''))
36
- console.log('ERROR_MESSAGE=' + (error?.message || ''))
37
- console.log('ERROR_STACK=' + String(error?.stack || '').split('\n').slice(0, 4).join(' | '))
38
- }
39
-
40
- await knex.destroy()
41
- }
42
-
43
- main().catch(async (e) => {
44
- console.error('PROBE_FATAL=' + (e?.message || e))
45
- await knex.destroy()
46
- process.exitCode = 1
47
- })
@@ -1,4 +0,0 @@
1
- json-rest-api:
2
- 1
3
- json-rest-schema:
4
- 1
@@ -1,107 +0,0 @@
1
- # Runtime test summary (non-anyapi)
2
-
3
- ## json-rest-api npm test
4
- log: audit/evidence/tests/npm-test-json-rest-api.log
5
- 5335: ok 2 - auto assigns ownership when creating a project
6
- 5340: ok 3 - filters query results by ownership for non-admin users
7
- 5345: ok 4 - allows admin roles to bypass ownership filtering
8
- 5350: ok 5 - prevents users from accessing records they do not own
9
- 5355: ok 6 - enforces helper ownership checks
10
- 5360:ok 28 - Access plugin
11
- 5458: ok 1 - should create a country
12
- 5463: ok 2 - should create a publisher with country relationship
13
- 5468: ok 3 - should fail to create resource with missing required field
14
- 5473: ok 1 - POST - Create Resources
15
- 5480: ok 1 - should retrieve a single resource
16
- 5485: ok 2 - should fail to retrieve non-existent resource
17
- 5490: ok 3 - should retrieve collection of resources
18
- 5495: ok 2 - GET - Retrieve Resources
19
- 5502: ok 1 - should partially update a resource
20
- 5507: ok 3 - PATCH - Update Resources
21
- 5514: ok 1 - should delete an existing resource
22
- 5519: ok 4 - DELETE - Remove Resources
23
- 5525: ok 1 - Basic CRUD Operations
24
- 5531:ok 29 - REST API Tests
25
- 5556: ok 1 - should merge search:true fields with explicit searchSchema
26
- 5561: ok 2 - should work with only search:true fields (no explicit searchSchema)
27
- 5566: ok 3 - should work with only explicit searchSchema (no search:true)
28
- 5571: ok 4 - should allow filtering with merged searchSchema fields
29
- 5576:ok 30 - SearchSchema Merge Behavior
30
- 5619: ok 1 - should receive minimal notifications for subscribed resources
31
- 5631: ok 2 - should not receive notifications for non-matching filters
32
- 5636: ok 1 - Basic Subscription and Notifications
33
- 5656: ok 1 - should validate filters against searchSchema
34
- 5667: ok 2 - should reject function filters without filterRecord
35
- 5672: ok 2 - Filter Validation
36
- 5709: ok 1 - should not broadcast when operations fail
37
- 5717: ok 2 - should broadcast after successful operations
38
- 5722: ok 3 - Transaction Safety
39
- 5733: ok 1 - should handle multiple subscriptions from same client
40
- 5742: ok 2 - should unsubscribe correctly
41
- 5747: ok 4 - Multiple Subscriptions
42
- 5757: ok 1 - should receive notifications for updates
43
- 5765: ok 2 - should receive notifications for deletes
44
- 5770: ok 5 - Update and Delete Notifications
45
- 5784: ok 1 - should filter by relationship fields
46
- 5789: ok 6 - Relationship Filters
47
- 5795:ok 31 - WebSocket/Socket.IO Plugin
48
- 5819: ok 1 - should accept virtual fields in POST request
49
- 5824: ok 2 - should not store virtual fields in database
50
- 5829: ok 3 - should handle virtual fields in PATCH request
51
- 5834: ok 4 - should respect sparse fieldsets with virtual fields on PATCH
52
- 5839: ok 5 - should exclude virtual fields when not requested in sparse fieldsets
53
- 5844: ok 6 - should handle PUT requests with virtual fields
54
- 5849: ok 1 - Virtual field validation
55
- 5856: ok 1 - should handle both virtual and computed fields correctly
56
- 5861: ok 2 - should calculate computed fields regardless of input
57
- 5866: ok 2 - Virtual fields vs computed fields
58
- 5872:ok 32 - Virtual Fields Tests
59
- 5878:# tests 336
60
- 5879:# suites 164
61
- 5880:# pass 324
62
- 5881:# fail 2
63
- 5883:# skipped 10
64
- 5885:# duration_ms 15332.355453
65
-
66
- ## json-rest-schema npm test
67
- log: audit/evidence/tests/npm-test-json-rest-schema.log
68
- 174: ok 7 - type:'string' should process input undefined to undefined
69
- 179: ok 8 - type:'string' should fail for input: {}
70
- 184: ok 9 - type:'number' should process input "42.5" to 42.5
71
- 189: ok 10 - type:'number' should process input "" to 0
72
- 194: ok 11 - type:'number' should fail for input: null
73
- 199: ok 12 - type:'number' should fail for input: "abc"
74
- 204: ok 13 - type:'timestamp' should process input 1672531200000 to 1672531200000
75
- 209: ok 14 - type:'timestamp' should process input "0" to null
76
- 214: ok 15 - type:'timestamp' should fail for input: "abc"
77
- 219: ok 16 - type:'dateTime' should process input "2025-01-01T12:30:00Z" to "2025-01-01T12:30:00.000Z"
78
- 224: ok 17 - type:'dateTime' should process input "invalid" to null
79
- 229: ok 18 - type:'date' should process input "2025-01-01T12:30:00Z" to "2025-01-01T00:00:00.000Z"
80
- 234: ok 19 - type:'date' should process input "2025-01-01" to "2025-01-01T00:00:00.000Z"
81
- 239: ok 20 - type:'array' should process input "one" to ["one"]
82
- 244: ok 21 - type:'array' should process input ["one","two"] to ["one","two"]
83
- 249: ok 22 - type:'boolean' should process input "true" to true
84
- 254: ok 23 - type:'boolean' should process input "on" to true
85
- 259: ok 24 - type:'boolean' should process input "false" to false
86
- 264: ok 25 - type:'boolean' should process input 1 to true
87
- 269: ok 26 - type:'boolean' should process input 0 to false
88
- 274: ok 27 - type:'boolean' should process input "no" to false
89
- 279: ok 28 - type:'id' should process input "123" to 123
90
- 284: ok 29 - type:'id' should fail for input: "id-123"
91
- 289: ok 30 - type:'serialize' should process an object to a string
92
- 294: ok 31 - type:`serialize` should handle circular references
93
- 299:ok 4 - 3. Core Plugin: Type Handlers
94
- 306: ok 1 - `min`/`max` validators should work for numbers, `minLength`/`maxLength` for strings
95
- 311: ok 2 - `validator` should work with a custom function (sync and async)
96
- 316: ok 3 - `uppercase`/`lowercase` should transform strings
97
- 321: ok 4 - `length` should truncate strings and error on long numbers
98
- 326: ok 5 - `notEmpty` should fail on empty strings
99
- 331:ok 5 - 4. Core Plugin: Validator Handlers
100
- 338: ok 1 - should allow defining and using a custom plugin
101
- 343:ok 6 - 5. Extensibility: Custom Plugins
102
- 349:# tests 57
103
- 350:# suites 6
104
- 351:# pass 56
105
- 352:# fail 1
106
- 354:# skipped 0
107
- 356:# duration_ms 163.644013