json-rest-api 1.0.21 → 1.0.22
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.
- package/audit/00-charter.md +103 -0
- package/audit/01-scope-map.md +84 -0
- package/audit/02-coverage-matrix.csv +174 -0
- package/audit/03-invariants.md +123 -0
- package/audit/04-standards-rubric.md +56 -0
- package/audit/05-competitor-rubric.md +77 -0
- package/audit/06-findings.md +160 -0
- package/audit/07-risk-register.csv +10 -0
- package/audit/08-remediation-roadmap.md +177 -0
- package/audit/09-signoff-check.md +23 -0
- package/audit/10-final-synthesis.md +29 -0
- package/audit/evidence/code/all-files-json-rest-api.txt +168 -0
- package/audit/evidence/code/all-files-json-rest-schema.txt +12 -0
- package/audit/evidence/code/boundary-leak-checks.txt +72 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__bulk-operations-plugin.js.txt +480 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__express-plugin.js.txt +532 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__busboy-detector.js.txt +175 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__formidable-detector.js.txt +138 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__connectors__lib__request-helpers.js.txt +222 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__file-handling-plugin.js.txt +342 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__dbTablesOperations.js.txt +304 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__fractional-positioning.js.txt +188 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__compile-schemas.js.txt +336 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__connectors-query-parser.js.txt +165 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-capabilities.js.txt +265 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__database-value-normalizers.js.txt +369 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__default-data-helpers.js.txt +72 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__field-utils.js.txt +139 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-constants.js.txt +45 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-field-helpers.js.txt +396 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__knex-json-api-transformers.js.txt +162 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__payload-validators.js.txt +1314 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__schema-helpers.js.txt +488 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__scope-validations.js.txt +484 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying-writing__simplified-helpers.js.txt +857 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-cross-table-search.js.txt +565 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-json-api-transformers-querying.js.txt +485 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-pagination-helpers.js.txt +560 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-process-includes.js.txt +167 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers-base.js.txt +109 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-query-helpers.js.txt +1064 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-relationship-includes.js.txt +1983 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__knex-window-queries.js.txt +328 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__querying__url-helpers.js.txt +119 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__storage__storage-adapter.js.txt +160 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__many-to-many-manipulations.js.txt +300 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__lib__writing__relationship-processor.js.txt +245 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-access.js.txt +459 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-cors-plugin.js.txt +237 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-knex-plugin.js.txt +1135 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-multihome-plugin.js.txt +314 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__compile-resource-schemas.js.txt +7 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__register-relationship-routes.js.txt +71 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__register-scope-routes.js.txt +102 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__turn-scope-init-into-vars.js.txt +49 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-hooks__validate-include-configurations.js.txt +39 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__add-route.js.txt +23 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__check-permissions.js.txt +13 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__common.js.txt +639 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete-relationship.js.txt +117 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__delete.js.txt +104 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__enrich-attributes.js.txt +199 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get-related.js.txt +353 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get-relationship.js.txt +61 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__get.js.txt +184 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch-relationship.js.txt +55 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__patch.js.txt +191 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post-relationship.js.txt +110 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__post.js.txt +168 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__put.js.txt +253 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__query.js.txt +207 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin-methods__release.js.txt +12 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-plugin.js.txt +165 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__rest-api-positioning-plugin.js.txt +668 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__core__socketio-plugin.js.txt +621 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__local-storage.js.txt +218 -0
- package/audit/evidence/code/critical-pass1/json-rest-api__plugins__storage__s3-storage.js.txt +124 -0
- package/audit/evidence/code/critical-pass1/json-rest-schema__src__CorePlugin.js.txt +269 -0
- package/audit/evidence/code/critical-pass1/json-rest-schema__src__Schema.js.txt +242 -0
- package/audit/evidence/code/critical-pass1/json-rest-schema__src__index.js.txt +77 -0
- package/audit/evidence/code/critical-pass1-risk-keywords.txt +238 -0
- package/audit/evidence/code/critical-pass1-summary.csv +67 -0
- package/audit/evidence/code/critical-pass2-summary.csv +67 -0
- package/audit/evidence/code/early-silent-zones-no-test-token.txt +57 -0
- package/audit/evidence/code/error-model-signals.txt +98 -0
- package/audit/evidence/code/git-files-json-rest-api.txt +171 -0
- package/audit/evidence/code/git-files-json-rest-schema.txt +27 -0
- package/audit/evidence/code/hook-flow-signals.txt +282 -0
- package/audit/evidence/code/idproperty-signals.txt +157 -0
- package/audit/evidence/code/import-cycles-non-anyapi.txt +3 -0
- package/audit/evidence/code/import-hotspots-non-anyapi.txt +96 -0
- package/audit/evidence/code/imports-json-rest-api.txt +354 -0
- package/audit/evidence/code/imports-json-rest-schema.txt +15 -0
- package/audit/evidence/code/in-scope-files-json-rest-api.txt +160 -0
- package/audit/evidence/code/in-scope-files-json-rest-schema.txt +13 -0
- package/audit/evidence/code/non-anyapi-core-files.txt +101 -0
- package/audit/evidence/code/permission-signals.txt +193 -0
- package/audit/evidence/code/query-include-signals.txt +687 -0
- package/audit/evidence/code/transaction-signals.txt +28 -0
- package/audit/evidence/code/validation-signals.txt +650 -0
- package/audit/evidence/code/write-path-signals.txt +61 -0
- package/audit/evidence/docs/docs-claims-signals.txt +1075 -0
- package/audit/evidence/docs/schema-docs-claims-signals.txt +179 -0
- package/audit/evidence/external/corpus-freeze.md +21 -0
- package/audit/evidence/external/npm-competitor-metadata.txt +70 -0
- package/audit/evidence/external/npm-download-signals.txt +23 -0
- package/audit/evidence/external/npm-jsonapi-server.txt +8 -0
- package/audit/evidence/external/npm-modern-jsonapi-metadata.txt +38 -0
- package/audit/evidence/external/readme-fortune-signals.txt +26 -0
- package/audit/evidence/external/readme-fortune.md +165 -0
- package/audit/evidence/external/readme-json-api-serializer-signals.txt +80 -0
- package/audit/evidence/external/readme-json-api-serializer.md +690 -0
- package/audit/evidence/external/readme-jsonapi-serde-server-signals.txt +0 -0
- package/audit/evidence/external/readme-jsonapi-serde-server.md +22 -0
- package/audit/evidence/external/readme-jsonapi-serializer-signals.txt +63 -0
- package/audit/evidence/external/readme-jsonapi-serializer.md +315 -0
- package/audit/evidence/external/readme-jsonapi-server-signals.txt +19 -0
- package/audit/evidence/external/readme-jsonapi-server.md +104 -0
- package/audit/evidence/external/readme-nestjs-json-api-signals.txt +4 -0
- package/audit/evidence/external/readme-nestjs-json-api.md +94 -0
- package/audit/evidence/external/readme-yaser-json-api-nestjs-signals.txt +47 -0
- package/audit/evidence/external/readme-yaser-json-api-nestjs.md +447 -0
- package/audit/evidence/external/standard-jsonapi-snippets.txt +84 -0
- package/audit/evidence/external/standard-rfc-snippets.txt +168 -0
- package/audit/evidence/external/standards-sources.txt +6 -0
- package/audit/evidence/runtime/baseline-commits.txt +2 -0
- package/audit/evidence/runtime/db-adapter-assumptions.txt +3 -0
- package/audit/evidence/runtime/environment.txt +4 -0
- package/audit/evidence/runtime/invariant-runtime-mapping.md +38 -0
- package/audit/evidence/runtime/probe-patch-relationship-error.exitcode +1 -0
- package/audit/evidence/runtime/probe-patch-relationship-error.log +76 -0
- package/audit/evidence/runtime/probe-patch-relationship-error.mjs +67 -0
- package/audit/evidence/runtime/probe-patch-relationship-referenceerror.exitcode +1 -0
- package/audit/evidence/runtime/probe-patch-relationship-referenceerror.log +62 -0
- package/audit/evidence/runtime/probe-patch-relationship-referenceerror.mjs +47 -0
- package/audit/evidence/runtime/test-exitcodes.txt +4 -0
- package/audit/evidence/runtime/test-summary.md +107 -0
- package/audit/evidence/runtime/trace-anchors.txt +61 -0
- package/audit/evidence/tests/access-multitenancy-test-signals.txt +125 -0
- package/audit/evidence/tests/failing-tests-summary.txt +25 -0
- package/audit/evidence/tests/npm-test-json-rest-api.exitcode +1 -0
- package/audit/evidence/tests/npm-test-json-rest-api.log +5885 -0
- package/audit/evidence/tests/npm-test-json-rest-schema.exitcode +1 -0
- package/audit/evidence/tests/npm-test-json-rest-schema.log +356 -0
- package/audit/evidence/tests/query-include-test-signals.txt +948 -0
- package/audit/evidence/tests/relationship-test-signals.txt +223 -0
- package/audit/evidence/tests/skipped-tests.txt +10 -0
- package/audit/evidence/tests/test-suite-list-non-anyapi.txt +30 -0
- package/audit/evidence/tests/test-suite-list.txt +32 -0
- package/audit/subsystems/docs-drift.md +49 -0
- package/audit/subsystems/pass2-cross-review.md +131 -0
- package/audit/subsystems/plugins-access.md +51 -0
- package/audit/subsystems/plugins-bulk.md +50 -0
- package/audit/subsystems/plugins-cors.md +48 -0
- package/audit/subsystems/plugins-file.md +53 -0
- package/audit/subsystems/plugins-multihome.md +50 -0
- package/audit/subsystems/plugins-positioning.md +54 -0
- package/audit/subsystems/plugins-socketio.md +50 -0
- package/audit/subsystems/query-engine.md +61 -0
- package/audit/subsystems/relationships.md +55 -0
- package/audit/subsystems/rest-orchestration.md +66 -0
- package/audit/subsystems/schema-core.md +64 -0
- package/audit/subsystems/storage-knex.md +57 -0
- package/audit/subsystems/tests.md +48 -0
- package/audit/subsystems/transport-express.md +55 -0
- package/audit/traces/trace-read-get.md +22 -0
- package/audit/traces/trace-read-query.md +25 -0
- package/audit/traces/trace-relationship-endpoints.md +31 -0
- package/audit/traces/trace-write-delete.md +17 -0
- package/audit/traces/trace-write-patch.md +26 -0
- package/audit/traces/trace-write-post.md +22 -0
- package/audit/traces/trace-write-put.md +23 -0
- package/package.json +3 -3
|
@@ -0,0 +1,168 @@
|
|
|
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.
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
2026-03-01T15:55:13.737Z [34m[INFO][0m [36m[basic-test-api][0m 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 [34m[INFO][0m [36m[basic-test-api][0m Plugin 'rest-api' installed successfully { duration: '1ms' }
|
|
11
|
+
2026-03-01T15:55:13.742Z [34m[INFO][0m [36m[basic-test-api][0m Installing plugin 'rest-api-knex' { options: '[Object with methods]' }
|
|
12
|
+
2026-03-01T15:55:13.747Z [34m[INFO][0m [36m[basic-test-api:plugin:rest-api-knex][0m Database capabilities detected: { database: 'SQLite', version: '3.49.2', windowFunctions: true }
|
|
13
|
+
2026-03-01T15:55:13.747Z [34m[INFO][0m [36m[basic-test-api:plugin:rest-api-knex][0m RestApiKnexPlugin installed - basic CRUD operations ready
|
|
14
|
+
2026-03-01T15:55:13.747Z [34m[INFO][0m [36m[basic-test-api][0m Plugin 'rest-api-knex' installed successfully { duration: '5ms' }
|
|
15
|
+
2026-03-01T15:55:13.748Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'countries' added successfully
|
|
16
|
+
2026-03-01T15:55:13.750Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'countries'
|
|
17
|
+
2026-03-01T15:55:13.753Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'publishers' added successfully
|
|
18
|
+
2026-03-01T15:55:13.753Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'publishers'
|
|
19
|
+
2026-03-01T15:55:13.754Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'authors' added successfully
|
|
20
|
+
2026-03-01T15:55:13.754Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'authors'
|
|
21
|
+
2026-03-01T15:55:13.754Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'books' added successfully
|
|
22
|
+
2026-03-01T15:55:13.755Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'books'
|
|
23
|
+
2026-03-01T15:55:13.755Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'book_authors' added successfully
|
|
24
|
+
2026-03-01T15:55:13.755Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'book_authors'
|
|
25
|
+
|
|
26
|
+
=== invalid relationshipData type (string) ===
|
|
27
|
+
2026-03-01T15:55:13.768Z [31m[ERROR][0m [36m[basic-test-api:books][0m 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 [31m[ERROR][0m [36m[basic-test-api][0m 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 [31m[ERROR][0m [36m[basic-test-api][0m 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 [31m[ERROR][0m [36m[basic-test-api][0m 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 ===
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
2026-03-01T15:57:20.166Z [34m[INFO][0m [36m[basic-test-api][0m 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 [34m[INFO][0m [36m[basic-test-api][0m Plugin 'rest-api' installed successfully { duration: '1ms' }
|
|
11
|
+
2026-03-01T15:57:20.171Z [34m[INFO][0m [36m[basic-test-api][0m Installing plugin 'rest-api-knex' { options: '[Object with methods]' }
|
|
12
|
+
2026-03-01T15:57:20.177Z [34m[INFO][0m [36m[basic-test-api:plugin:rest-api-knex][0m Database capabilities detected: { database: 'SQLite', version: '3.49.2', windowFunctions: true }
|
|
13
|
+
2026-03-01T15:57:20.177Z [34m[INFO][0m [36m[basic-test-api:plugin:rest-api-knex][0m RestApiKnexPlugin installed - basic CRUD operations ready
|
|
14
|
+
2026-03-01T15:57:20.177Z [34m[INFO][0m [36m[basic-test-api][0m Plugin 'rest-api-knex' installed successfully { duration: '6ms' }
|
|
15
|
+
2026-03-01T15:57:20.178Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'countries' added successfully
|
|
16
|
+
2026-03-01T15:57:20.180Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'countries'
|
|
17
|
+
2026-03-01T15:57:20.184Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'publishers' added successfully
|
|
18
|
+
2026-03-01T15:57:20.184Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'publishers'
|
|
19
|
+
2026-03-01T15:57:20.185Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'authors' added successfully
|
|
20
|
+
2026-03-01T15:57:20.185Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'authors'
|
|
21
|
+
2026-03-01T15:57:20.186Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'books' added successfully
|
|
22
|
+
2026-03-01T15:57:20.186Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'books'
|
|
23
|
+
2026-03-01T15:57:20.187Z [34m[INFO][0m [36m[basic-test-api][0m Scope 'book_authors' added successfully
|
|
24
|
+
2026-03-01T15:57:20.187Z [34m[INFO][0m [36m[basic-test-api:global][0m Routes registered for scope 'book_authors'
|
|
25
|
+
2026-03-01T15:57:20.204Z [31m[ERROR][0m [36m[basic-test-api:books][0m 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 [31m[ERROR][0m [36m[basic-test-api][0m 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 [31m[ERROR][0m [36m[basic-test-api][0m 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)
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
})
|
|
@@ -0,0 +1,107 @@
|
|
|
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
|