json-rest-api 1.0.20 → 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 +5 -5
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
lib/enhanced-logger.js
|
|
2
|
+
lib/error-formatter.js
|
|
3
|
+
lib/rest-api-errors.js
|
|
4
|
+
plugins/core/bulk-operations-plugin.js
|
|
5
|
+
plugins/core/connectors/express-plugin.js
|
|
6
|
+
plugins/core/connectors/lib/busboy-detector.js
|
|
7
|
+
plugins/core/connectors/lib/formidable-detector.js
|
|
8
|
+
plugins/core/connectors/lib/request-helpers.js
|
|
9
|
+
plugins/core/file-handling-plugin.js
|
|
10
|
+
plugins/core/lib/dbTablesOperations.js
|
|
11
|
+
plugins/core/lib/fractional-positioning.js
|
|
12
|
+
plugins/core/lib/querying-writing/compile-schemas.js
|
|
13
|
+
plugins/core/lib/querying-writing/connectors-query-parser.js
|
|
14
|
+
plugins/core/lib/querying-writing/database-capabilities.js
|
|
15
|
+
plugins/core/lib/querying-writing/database-value-normalizers.js
|
|
16
|
+
plugins/core/lib/querying-writing/default-data-helpers.js
|
|
17
|
+
plugins/core/lib/querying-writing/field-utils.js
|
|
18
|
+
plugins/core/lib/querying-writing/knex-constants.js
|
|
19
|
+
plugins/core/lib/querying-writing/knex-field-helpers.js
|
|
20
|
+
plugins/core/lib/querying-writing/knex-json-api-transformers.js
|
|
21
|
+
plugins/core/lib/querying-writing/payload-validators.js
|
|
22
|
+
plugins/core/lib/querying-writing/schema-helpers.js
|
|
23
|
+
plugins/core/lib/querying-writing/scope-validations.js
|
|
24
|
+
plugins/core/lib/querying-writing/simplified-helpers.js
|
|
25
|
+
plugins/core/lib/querying/knex-cross-table-search.js
|
|
26
|
+
plugins/core/lib/querying/knex-json-api-transformers-querying.js
|
|
27
|
+
plugins/core/lib/querying/knex-pagination-helpers.js
|
|
28
|
+
plugins/core/lib/querying/knex-process-includes.js
|
|
29
|
+
plugins/core/lib/querying/knex-query-helpers-base.js
|
|
30
|
+
plugins/core/lib/querying/knex-query-helpers.js
|
|
31
|
+
plugins/core/lib/querying/knex-relationship-includes.js
|
|
32
|
+
plugins/core/lib/querying/knex-window-queries.js
|
|
33
|
+
plugins/core/lib/querying/url-helpers.js
|
|
34
|
+
plugins/core/lib/storage/storage-adapter.js
|
|
35
|
+
plugins/core/lib/writing/knex-json-api-transformers-writing.js
|
|
36
|
+
plugins/core/lib/writing/many-to-many-manipulations.js
|
|
37
|
+
plugins/core/lib/writing/relationship-processor.js
|
|
38
|
+
plugins/core/rest-api-access.js
|
|
39
|
+
plugins/core/rest-api-cors-plugin.js
|
|
40
|
+
plugins/core/rest-api-knex-plugin.js
|
|
41
|
+
plugins/core/rest-api-label-plugin.js
|
|
42
|
+
plugins/core/rest-api-multihome-plugin.js
|
|
43
|
+
plugins/core/rest-api-plugin-hooks/compile-resource-schemas.js
|
|
44
|
+
plugins/core/rest-api-plugin-hooks/register-relationship-routes.js
|
|
45
|
+
plugins/core/rest-api-plugin-hooks/register-scope-routes.js
|
|
46
|
+
plugins/core/rest-api-plugin-hooks/turn-scope-init-into-vars.js
|
|
47
|
+
plugins/core/rest-api-plugin-hooks/validate-include-configurations.js
|
|
48
|
+
plugins/core/rest-api-plugin-methods/add-route.js
|
|
49
|
+
plugins/core/rest-api-plugin-methods/check-permissions.js
|
|
50
|
+
plugins/core/rest-api-plugin-methods/common.js
|
|
51
|
+
plugins/core/rest-api-plugin-methods/delete-relationship.js
|
|
52
|
+
plugins/core/rest-api-plugin-methods/delete.js
|
|
53
|
+
plugins/core/rest-api-plugin-methods/enrich-attributes.js
|
|
54
|
+
plugins/core/rest-api-plugin-methods/get-related.js
|
|
55
|
+
plugins/core/rest-api-plugin-methods/get-relationship.js
|
|
56
|
+
plugins/core/rest-api-plugin-methods/get.js
|
|
57
|
+
plugins/core/rest-api-plugin-methods/patch-relationship.js
|
|
58
|
+
plugins/core/rest-api-plugin-methods/patch.js
|
|
59
|
+
plugins/core/rest-api-plugin-methods/post-relationship.js
|
|
60
|
+
plugins/core/rest-api-plugin-methods/post.js
|
|
61
|
+
plugins/core/rest-api-plugin-methods/put.js
|
|
62
|
+
plugins/core/rest-api-plugin-methods/query.js
|
|
63
|
+
plugins/core/rest-api-plugin-methods/release.js
|
|
64
|
+
plugins/core/rest-api-plugin.js
|
|
65
|
+
plugins/core/rest-api-positioning-plugin.js
|
|
66
|
+
plugins/core/socketio-plugin.js
|
|
67
|
+
tests/README.md
|
|
68
|
+
tests/TEST_TEMPLATE.test.js
|
|
69
|
+
tests/bulk-operations.test.js
|
|
70
|
+
tests/computed-fields.test.js
|
|
71
|
+
tests/cors.test.js
|
|
72
|
+
tests/curl.test.js
|
|
73
|
+
tests/custom-idproperty-relationships.test.js
|
|
74
|
+
tests/field-getters.test.js
|
|
75
|
+
tests/field-setters.test.js
|
|
76
|
+
tests/fixtures/api-configs.js
|
|
77
|
+
tests/helpers/storage-mode.js
|
|
78
|
+
tests/helpers/test-utils.js
|
|
79
|
+
tests/include-depth-validation.test.js
|
|
80
|
+
tests/includes.test.js
|
|
81
|
+
tests/multihome.test.js
|
|
82
|
+
tests/nested-includes.test.js
|
|
83
|
+
tests/ownership-optout.test.js
|
|
84
|
+
tests/pagination-cursor-multifield.test.js
|
|
85
|
+
tests/pagination-enhanced.test.js
|
|
86
|
+
tests/polymorphic-relationships.test.js
|
|
87
|
+
tests/polymorphic-simple.test.js
|
|
88
|
+
tests/positioning-advanced.test.js
|
|
89
|
+
tests/positioning-extended.test.js
|
|
90
|
+
tests/positioning-multifilter.test.js
|
|
91
|
+
tests/positioning.test.js
|
|
92
|
+
tests/queries.test.js
|
|
93
|
+
tests/query-limits.test.js
|
|
94
|
+
tests/relationship-endpoints.test.js
|
|
95
|
+
tests/relationships.test.js
|
|
96
|
+
tests/rest-api-access.test.js
|
|
97
|
+
tests/rest-api.test.js
|
|
98
|
+
tests/searchschema-merge.test.js
|
|
99
|
+
tests/socketio.test.js
|
|
100
|
+
tests/test-development-guide.md
|
|
101
|
+
tests/virtual-fields.test.js
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
plugins/core/rest-api-plugin.js:18:import checkPermissionsMethod from './rest-api-plugin-methods/check-permissions.js'
|
|
2
|
+
plugins/core/rest-api-plugin.js:150: addScopeMethod('checkPermissions', checkPermissionsMethod)
|
|
3
|
+
plugins/core/rest-api-multihome-plugin.js:2: name: 'multihome',
|
|
4
|
+
plugins/core/rest-api-multihome-plugin.js:11: const multihomeOptions = pluginOptions || {}
|
|
5
|
+
plugins/core/rest-api-multihome-plugin.js:14: vars.multihome = {
|
|
6
|
+
plugins/core/rest-api-multihome-plugin.js:15: field: multihomeOptions.field || 'multihome_id',
|
|
7
|
+
plugins/core/rest-api-multihome-plugin.js:16: excludeResources: multihomeOptions.excludeResources || ['system_migrations', 'system_logs'],
|
|
8
|
+
plugins/core/rest-api-multihome-plugin.js:17: requireAuth: multihomeOptions.requireAuth !== undefined ? multihomeOptions.requireAuth : true,
|
|
9
|
+
plugins/core/rest-api-multihome-plugin.js:18: allowMissing: multihomeOptions.allowMissing || false
|
|
10
|
+
plugins/core/rest-api-multihome-plugin.js:52: // Don't use 'www' or 'api' as tenant IDs
|
|
11
|
+
plugins/core/rest-api-multihome-plugin.js:58: return request.headers?.['x-multihome-id'] || null
|
|
12
|
+
plugins/core/rest-api-multihome-plugin.js:62: helpers.extractMultihomeId = multihomeOptions.extractor || defaultSubdomainExtractor
|
|
13
|
+
plugins/core/rest-api-multihome-plugin.js:64: // Hook into transport layer to extract multihome_id
|
|
14
|
+
plugins/core/rest-api-multihome-plugin.js:65: addHook('transport:request', 'extract-multihome-id', {}, async ({ context, request, helpers }) => {
|
|
15
|
+
plugins/core/rest-api-multihome-plugin.js:66: // Extract multihome_id using configured extractor
|
|
16
|
+
plugins/core/rest-api-multihome-plugin.js:67: const multihomeId = helpers.extractMultihomeId(request)
|
|
17
|
+
plugins/core/rest-api-multihome-plugin.js:69: if (multihomeId) {
|
|
18
|
+
plugins/core/rest-api-multihome-plugin.js:72: context.auth.multihome_id = multihomeId
|
|
19
|
+
plugins/core/rest-api-multihome-plugin.js:75: multihome_id: multihomeId,
|
|
20
|
+
plugins/core/rest-api-multihome-plugin.js:78: } else if (vars.multihome.requireAuth) {
|
|
21
|
+
plugins/core/rest-api-multihome-plugin.js:79: log.warn('No multihome ID found in request', {
|
|
22
|
+
plugins/core/rest-api-multihome-plugin.js:86: // Validate that resources have multihome field when added
|
|
23
|
+
plugins/core/rest-api-multihome-plugin.js:87: addHook('scope:added', 'validate-multihome-field', {}, ({ context, vars }) => {
|
|
24
|
+
plugins/core/rest-api-multihome-plugin.js:91: if (vars.multihome.excludeResources.includes(scopeName)) {
|
|
25
|
+
plugins/core/rest-api-multihome-plugin.js:92: log.debug(`Resource ${scopeName} excluded from multihome validation`)
|
|
26
|
+
plugins/core/rest-api-multihome-plugin.js:96: // Check if schema has multihome field
|
|
27
|
+
plugins/core/rest-api-multihome-plugin.js:98: if (schema && !schema[vars.multihome.field]) {
|
|
28
|
+
plugins/core/rest-api-multihome-plugin.js:99: if (vars.multihome.allowMissing) {
|
|
29
|
+
plugins/core/rest-api-multihome-plugin.js:100: log.warn(`Resource ${scopeName} missing ${vars.multihome.field} field - multihome filtering disabled for this
|
|
30
|
+
plugins/core/rest-api-multihome-plugin.js:104: `Resource '${scopeName}' must have '${vars.multihome.field}' field in schema for multi-tenancy`
|
|
31
|
+
plugins/core/rest-api-multihome-plugin.js:111: log.debug('Registering multihome filter hook')
|
|
32
|
+
plugins/core/rest-api-multihome-plugin.js:112: addHook('knexQueryFiltering', 'multihome-filter', {}, async ({ context, vars }) => {
|
|
33
|
+
plugins/core/rest-api-multihome-plugin.js:117: if (vars.multihome.excludeResources.includes(scopeName)) {
|
|
34
|
+
plugins/core/rest-api-multihome-plugin.js:118: log.trace(`Skipping multihome filter for excluded resource: ${scopeName}`)
|
|
35
|
+
plugins/core/rest-api-multihome-plugin.js:122: // Skip if no multihome context
|
|
36
|
+
plugins/core/rest-api-multihome-plugin.js:123: if (!context.auth?.multihome_id) {
|
|
37
|
+
plugins/core/rest-api-multihome-plugin.js:124: if (vars.multihome.requireAuth) {
|
|
38
|
+
plugins/core/rest-api-multihome-plugin.js:125: throw new Error('No multihome context available - cannot execute query')
|
|
39
|
+
plugins/core/rest-api-multihome-plugin.js:130: log.debug('Applying multihome tenant filter', {
|
|
40
|
+
plugins/core/rest-api-multihome-plugin.js:133: tenant: context.auth.multihome_id,
|
|
41
|
+
plugins/core/rest-api-multihome-plugin.js:136: // Check if this resource has multihome field
|
|
42
|
+
plugins/core/rest-api-multihome-plugin.js:138: const hasMultihomeField = scope?.vars?.schemaInfo?.schemaStructure?.[vars.multihome.field]
|
|
43
|
+
plugins/core/rest-api-multihome-plugin.js:141: if (vars.multihome.allowMissing) {
|
|
44
|
+
plugins/core/rest-api-multihome-plugin.js:142: log.trace(`Resource ${scopeName} has no ${vars.multihome.field} field - skipping filter`)
|
|
45
|
+
plugins/core/rest-api-multihome-plugin.js:145: throw new Error(`Resource ${scopeName} missing required ${vars.multihome.field} field`)
|
|
46
|
+
plugins/core/rest-api-multihome-plugin.js:155: field: vars.multihome.field,
|
|
47
|
+
plugins/core/rest-api-multihome-plugin.js:161: const tenantValue = translateFilterValue({
|
|
48
|
+
plugins/core/rest-api-multihome-plugin.js:162: field: vars.multihome.field,
|
|
49
|
+
plugins/core/rest-api-multihome-plugin.js:163: value: context.auth.multihome_id,
|
|
50
|
+
plugins/core/rest-api-multihome-plugin.js:168: if (tenantValue === null) {
|
|
51
|
+
plugins/core/rest-api-multihome-plugin.js:171: query.where(columnRef, tenantValue)
|
|
52
|
+
plugins/core/rest-api-multihome-plugin.js:174: log.trace('Added multihome filter', {
|
|
53
|
+
plugins/core/rest-api-multihome-plugin.js:177: multihome_id: context.auth.multihome_id
|
|
54
|
+
plugins/core/rest-api-multihome-plugin.js:181: // Set multihome_id on new records
|
|
55
|
+
plugins/core/rest-api-multihome-plugin.js:182: addHook('beforeSchemaValidate', 'set-multihome-id', {}, async ({ context, scopeName, vars }) => {
|
|
56
|
+
plugins/core/rest-api-multihome-plugin.js:184: if (vars.multihome.excludeResources.includes(scopeName)) {
|
|
57
|
+
plugins/core/rest-api-multihome-plugin.js:188: // Skip if no multihome context
|
|
58
|
+
plugins/core/rest-api-multihome-plugin.js:189: if (!context.auth?.multihome_id) {
|
|
59
|
+
plugins/core/rest-api-multihome-plugin.js:190: if (vars.multihome.requireAuth) {
|
|
60
|
+
plugins/core/rest-api-multihome-plugin.js:191: throw new Error('Cannot create record without multihome context')
|
|
61
|
+
plugins/core/rest-api-multihome-plugin.js:196: // Check if this resource has multihome field
|
|
62
|
+
plugins/core/rest-api-multihome-plugin.js:198: const hasMultihomeField = scope?.vars?.schemaInfo?.schemaStructure?.[vars.multihome.field]
|
|
63
|
+
plugins/core/rest-api-multihome-plugin.js:201: if (!vars.multihome.allowMissing) {
|
|
64
|
+
plugins/core/rest-api-multihome-plugin.js:202: throw new Error(`Resource ${scopeName} missing required ${vars.multihome.field} field`)
|
|
65
|
+
plugins/core/rest-api-multihome-plugin.js:207: // For POST, always set multihome_id
|
|
66
|
+
plugins/core/rest-api-multihome-plugin.js:210: context.inputRecord.data.attributes[vars.multihome.field] = context.auth.multihome_id
|
|
67
|
+
plugins/core/rest-api-multihome-plugin.js:212: log.debug('Set multihome_id on new record', {
|
|
68
|
+
plugins/core/rest-api-multihome-plugin.js:214: multihome_id: context.auth.multihome_id
|
|
69
|
+
plugins/core/rest-api-multihome-plugin.js:218: // For PUT/PATCH, validate multihome_id if provided
|
|
70
|
+
plugins/core/rest-api-multihome-plugin.js:220: context.inputRecord.data.attributes?.[vars.multihome.field]) {
|
|
71
|
+
plugins/core/rest-api-multihome-plugin.js:221: const providedId = context.inputRecord.data.attributes[vars.multihome.field]
|
|
72
|
+
plugins/core/rest-api-multihome-plugin.js:222: if (providedId !== context.auth.multihome_id) {
|
|
73
|
+
plugins/core/rest-api-multihome-plugin.js:224: `Cannot set ${vars.multihome.field} to '${providedId}' - must match current context '${context.auth.multihome_id}'`
|
|
74
|
+
plugins/core/rest-api-multihome-plugin.js:230: // Add checkPermissions hook to enforce tenant isolation
|
|
75
|
+
plugins/core/rest-api-multihome-plugin.js:232: addHook('checkPermissions', 'multihome-check-permissions', {}, async ({ context, scopeName }) => {
|
|
76
|
+
plugins/core/rest-api-multihome-plugin.js:239: if (vars.multihome.excludeResources.includes(scopeName)) {
|
|
77
|
+
plugins/core/rest-api-multihome-plugin.js:243: // Skip if no multihome context
|
|
78
|
+
plugins/core/rest-api-multihome-plugin.js:244: if (!auth?.multihome_id) {
|
|
79
|
+
plugins/core/rest-api-multihome-plugin.js:245: if (vars.multihome.requireAuth) {
|
|
80
|
+
plugins/core/rest-api-multihome-plugin.js:246: throw new Error('No multihome context available')
|
|
81
|
+
plugins/core/rest-api-multihome-plugin.js:251: // Get the scope to check if it has multihome field
|
|
82
|
+
plugins/core/rest-api-multihome-plugin.js:253: const hasMultihomeField = scope?.vars?.schemaInfo?.schemaStructure?.[vars.multihome.field]
|
|
83
|
+
plugins/core/rest-api-multihome-plugin.js:256: return // Resource doesn't support multihome
|
|
84
|
+
plugins/core/rest-api-multihome-plugin.js:259: // For operations on existing records, verify tenant ownership
|
|
85
|
+
plugins/core/rest-api-multihome-plugin.js:261: // minimalRecord is in JSON:API format, so tenant_id is in attributes
|
|
86
|
+
plugins/core/rest-api-multihome-plugin.js:262: const recordTenant = minimalRecord.attributes?.[vars.multihome.field]
|
|
87
|
+
plugins/core/rest-api-multihome-plugin.js:263: const userTenant = auth.multihome_id
|
|
88
|
+
plugins/core/rest-api-multihome-plugin.js:266: log.error('Multihome permission violation', {
|
|
89
|
+
plugins/core/rest-api-multihome-plugin.js:281: const error = new Error('Access denied - insufficient permissions')
|
|
90
|
+
plugins/core/rest-api-multihome-plugin.js:290: // doesn't exist due to tenant filtering in the GET operation that precedes them
|
|
91
|
+
plugins/core/rest-api-multihome-plugin.js:292: // Add API method to get current multihome context
|
|
92
|
+
plugins/core/rest-api-multihome-plugin.js:293: api.multihome = {
|
|
93
|
+
plugins/core/rest-api-multihome-plugin.js:302: ...vars.multihome,
|
|
94
|
+
plugins/core/rest-api-multihome-plugin.js:308: field: vars.multihome.field,
|
|
95
|
+
plugins/core/rest-api-multihome-plugin.js:309: excludedResources: vars.multihome.excludeResources,
|
|
96
|
+
plugins/core/rest-api-multihome-plugin.js:310: requireAuth: vars.multihome.requireAuth,
|
|
97
|
+
plugins/core/rest-api-access.js:8: const ownershipOptions = pluginOptions.ownership || pluginOptions.autoOwnership || {}
|
|
98
|
+
plugins/core/rest-api-access.js:11: ownership: {
|
|
99
|
+
plugins/core/rest-api-access.js:12: enabled: ownershipOptions.enabled !== false,
|
|
100
|
+
plugins/core/rest-api-access.js:13: field: ownershipOptions.field || 'user_id',
|
|
101
|
+
plugins/core/rest-api-access.js:14: userResource: ownershipOptions.userResource || 'users',
|
|
102
|
+
plugins/core/rest-api-access.js:15: excludeResources: ownershipOptions.excludeResources || [],
|
|
103
|
+
plugins/core/rest-api-access.js:16: filterByOwner: ownershipOptions.filterByOwner !== false,
|
|
104
|
+
plugins/core/rest-api-access.js:17: requireOwnership: ownershipOptions.requireOwnership || false
|
|
105
|
+
plugins/core/rest-api-access.js:25: const ownershipField = () => config.ownership.field
|
|
106
|
+
plugins/core/rest-api-access.js:27: // Minimal helper: treat ownerField false/null as ownership disabled (alias)
|
|
107
|
+
plugins/core/rest-api-access.js:29: scopeOptions?.ownership === false ||
|
|
108
|
+
plugins/core/rest-api-access.js:30: scopeOptions?.ownerField === false ||
|
|
109
|
+
plugins/core/rest-api-access.js:31: scopeOptions?.ownerField === null
|
|
110
|
+
plugins/core/rest-api-access.js:132: const field = scopeVars?.ownershipField || ownershipField()
|
|
111
|
+
plugins/core/rest-api-access.js:135: const ownershipStatus = evaluateOwnership({
|
|
112
|
+
plugins/core/rest-api-access.js:142: return ownershipStatus === 'match'
|
|
113
|
+
plugins/core/rest-api-access.js:156: scope.vars.ownershipField = context.scopeOptions?.ownershipField
|
|
114
|
+
plugins/core/rest-api-access.js:167: addHook('schema:enrich', 'rest-auth-auto-ownership-field', {}, ({ context }) => {
|
|
115
|
+
plugins/core/rest-api-access.js:168: if (!config.ownership.enabled) return
|
|
116
|
+
plugins/core/rest-api-access.js:170: if (config.ownership.excludeResources.includes(scopeName)) return
|
|
117
|
+
plugins/core/rest-api-access.js:173: const field = ownershipField()
|
|
118
|
+
plugins/core/rest-api-access.js:178: fields[field].belongsTo = config.ownership.userResource
|
|
119
|
+
plugins/core/rest-api-access.js:188: belongsTo: config.ownership.userResource,
|
|
120
|
+
plugins/core/rest-api-access.js:192: description: 'Automatically managed ownership field'
|
|
121
|
+
plugins/core/rest-api-access.js:197: if (!config.ownership.enabled) return
|
|
122
|
+
plugins/core/rest-api-access.js:198: if (config.ownership.excludeResources.includes(scopeName)) return
|
|
123
|
+
plugins/core/rest-api-access.js:200: if (config.ownership.requireOwnership) {
|
|
124
|
+
plugins/core/rest-api-access.js:208: const field = ownershipField()
|
|
125
|
+
plugins/core/rest-api-access.js:213: const shouldSet = scopeOptions?.ownership === true || (scopeOptions?.ownership === undefined && hasField)
|
|
126
|
+
plugins/core/rest-api-access.js:230: type: fieldSchema.belongsTo || config.ownership.userResource || 'users',
|
|
127
|
+
plugins/core/rest-api-access.js:239: addHook('beforeProcessingPost', 'rest-auth-auto-set-owner', {}, ({ context, scopeName, scopes, scopeOptions }) => {
|
|
128
|
+
plugins/core/rest-api-access.js:242: addHook('beforeProcessingPatch', 'rest-auth-auto-set-owner', {}, ({ context, scopeName, scopes, scopeOptions }) => {
|
|
129
|
+
plugins/core/rest-api-access.js:245: addHook('beforeProcessingPut', 'rest-auth-auto-set-owner', {}, ({ context, scopeName, scopes, scopeOptions }) => {
|
|
130
|
+
plugins/core/rest-api-access.js:249: addHook('knexQueryFiltering', 'rest-auth-filter-by-owner', { sequence: -40 }, ({ context, scopes, scopeOptions }) => {
|
|
131
|
+
plugins/core/rest-api-access.js:250: if (!config.ownership.enabled || !config.ownership.filterByOwner) return
|
|
132
|
+
plugins/core/rest-api-access.js:255: throw new Error('AccessPlugin: knexQuery must provide query and tableName for ownership filtering')
|
|
133
|
+
plugins/core/rest-api-access.js:258: if (config.ownership.excludeResources.includes(scopeName)) return
|
|
134
|
+
plugins/core/rest-api-access.js:260: if (config.ownership.requireOwnership) {
|
|
135
|
+
plugins/core/rest-api-access.js:269: const field = ownershipField()
|
|
136
|
+
plugins/core/rest-api-access.js:273: const shouldFilter = scopeOptions?.ownership === true || (scopeOptions?.ownership === undefined && hasField)
|
|
137
|
+
plugins/core/rest-api-access.js:282: const ownerValue = translateFilterValue({ field, value: context.auth.userId, scopeName, hookContext: context })
|
|
138
|
+
plugins/core/rest-api-access.js:284: if (ownerValue === null) {
|
|
139
|
+
plugins/core/rest-api-access.js:287: query.where(columnRef, ownerValue)
|
|
140
|
+
plugins/core/rest-api-access.js:291: addHook('checkPermissions', 'rest-auth-enforce', { sequence: -100 }, async ({ context, scope, scopeName }) => {
|
|
141
|
+
plugins/core/rest-api-access.js:343: addHook('checkPermissions', 'rest-auth-check-get-ownership', { sequence: -80 }, ({ context, scope, scopeName, scopeOptions }) => {
|
|
142
|
+
plugins/core/rest-api-access.js:344: if (!config.ownership.enabled || !config.ownership.filterByOwner) return
|
|
143
|
+
plugins/core/rest-api-access.js:345: if (config.ownership.excludeResources.includes(scopeName)) return
|
|
144
|
+
plugins/core/rest-api-access.js:354: const field = ownershipField()
|
|
145
|
+
plugins/core/rest-api-access.js:357: const shouldCheck = scopeOptions?.ownership === true || (scopeOptions?.ownership === undefined && hasField)
|
|
146
|
+
plugins/core/rest-api-access.js:374: const ownershipStatus = evaluateOwnership({
|
|
147
|
+
plugins/core/rest-api-access.js:381: if (ownershipStatus === 'mismatch') {
|
|
148
|
+
plugins/core/rest-api-access.js:401: const field = ownershipField()
|
|
149
|
+
plugins/core/rest-api-access.js:403: let ownerId
|
|
150
|
+
plugins/core/rest-api-access.js:406: ownerId = resourceOrUserId[field]
|
|
151
|
+
plugins/core/rest-api-access.js:407: if (!ownerId) {
|
|
152
|
+
plugins/core/rest-api-access.js:408: throw new Error(`Resource does not have ownership field '${field}'`)
|
|
153
|
+
plugins/core/rest-api-access.js:411: ownerId = resourceOrUserId
|
|
154
|
+
plugins/core/rest-api-access.js:413: ownerId = context.existingRecord[field]
|
|
155
|
+
plugins/core/rest-api-access.js:414: if (!ownerId) {
|
|
156
|
+
plugins/core/rest-api-access.js:415: throw new Error(`Resource does not have ownership field '${field}'`)
|
|
157
|
+
plugins/core/rest-api-access.js:418: throw new Error('No resource or user ID provided for ownership check')
|
|
158
|
+
plugins/core/rest-api-access.js:421: if (String(auth.userId) !== String(ownerId)) {
|
|
159
|
+
plugins/core/rest-api-access.js:434: helpers.auth.checkPermission = async function checkPermission (context, rules, options = {}) {
|
|
160
|
+
plugins/core/rest-api-plugin-methods/query.js:125: // Centralised checkPermissions function
|
|
161
|
+
plugins/core/rest-api-plugin-methods/query.js:126: await scope.checkPermissions({
|
|
162
|
+
plugins/core/rest-api-plugin-methods/get-relationship.js:30: // Check permissions
|
|
163
|
+
plugins/core/rest-api-plugin-methods/get-relationship.js:31: await runHooks('checkPermissions')
|
|
164
|
+
plugins/core/rest-api-plugin-methods/get-relationship.js:32: await runHooks('checkPermissionsGetRelationship')
|
|
165
|
+
plugins/core/rest-api-plugin-methods/get-related.js:51: // Check permissions
|
|
166
|
+
plugins/core/rest-api-plugin-methods/get-related.js:52: await runHooks('checkPermissions')
|
|
167
|
+
plugins/core/rest-api-plugin-methods/get-related.js:53: await runHooks('checkPermissionsGetRelated')
|
|
168
|
+
plugins/core/rest-api-plugin-methods/delete-relationship.js:47: // Check permissions
|
|
169
|
+
plugins/core/rest-api-plugin-methods/delete-relationship.js:48: await runHooks('checkPermissions')
|
|
170
|
+
plugins/core/rest-api-plugin-methods/delete-relationship.js:49: await runHooks('checkPermissionsDeleteRelationship')
|
|
171
|
+
plugins/core/rest-api-plugin-methods/patch-relationship.js:23: // Check permissions
|
|
172
|
+
plugins/core/rest-api-plugin-methods/patch-relationship.js:24: await runHooks('checkPermissions')
|
|
173
|
+
plugins/core/rest-api-plugin-methods/patch-relationship.js:25: await runHooks('checkPermissionsPatchRelationship')
|
|
174
|
+
plugins/core/rest-api-plugin-methods/common.js:445: method: 'get', // We're checking read permission
|
|
175
|
+
plugins/core/rest-api-plugin-methods/common.js:460: // Check permissions using the related scope's checkPermissions
|
|
176
|
+
plugins/core/rest-api-plugin-methods/common.js:461: await relatedScope.checkPermissions({
|
|
177
|
+
plugins/core/rest-api-plugin-methods/patch.js:102: // Centralised checkPermissions function
|
|
178
|
+
plugins/core/rest-api-plugin-methods/patch.js:103: await scope.checkPermissions({
|
|
179
|
+
plugins/core/rest-api-plugin-methods/post-relationship.js:49: // Check permissions
|
|
180
|
+
plugins/core/rest-api-plugin-methods/post-relationship.js:50: await runHooks('checkPermissions')
|
|
181
|
+
plugins/core/rest-api-plugin-methods/post-relationship.js:51: await runHooks('checkPermissionsPostRelationship')
|
|
182
|
+
plugins/core/rest-api-plugin-methods/get.js:88: // Centralised checkPermissions function
|
|
183
|
+
plugins/core/rest-api-plugin-methods/get.js:89: await scope.checkPermissions({
|
|
184
|
+
plugins/core/rest-api-plugin-methods/check-permissions.js:2: * checkPermissions
|
|
185
|
+
plugins/core/rest-api-plugin-methods/check-permissions.js:3: * Check if ther are permissions to access a resource.
|
|
186
|
+
plugins/core/rest-api-plugin-methods/check-permissions.js:6:export default async function checkPermissionsMethod ({ context, params, runHooks, scopeName, scopes, helpers }) {
|
|
187
|
+
plugins/core/rest-api-plugin-methods/check-permissions.js:12: await runHooks('checkPermissions')
|
|
188
|
+
plugins/core/rest-api-plugin-methods/put.js:170: // Centralised checkPermissions function
|
|
189
|
+
plugins/core/rest-api-plugin-methods/put.js:171: await scope.checkPermissions({
|
|
190
|
+
plugins/core/rest-api-plugin-methods/delete.js:67: // Centralised checkPermissions function
|
|
191
|
+
plugins/core/rest-api-plugin-methods/delete.js:68: await scope.checkPermissions({
|
|
192
|
+
plugins/core/rest-api-plugin-methods/post.js:97: // Centralised checkPermissions function
|
|
193
|
+
plugins/core/rest-api-plugin-methods/post.js:98: await scope.checkPermissions({
|