@web-ts-toolkit/access-router 0.65.1 → 0.67.0
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/MIGRATION.md +1089 -0
- package/README.md +480 -665
- package/advanced.d.mts +2 -1
- package/advanced.d.ts +2 -1
- package/advanced.js +1873 -816
- package/advanced.mjs +1618 -561
- package/index.d.mts +38 -26
- package/index.d.ts +38 -26
- package/index.js +11981 -11341
- package/index.mjs +11853 -11218
- package/llms.txt +8 -3
- package/package.json +4 -4
- package/{parsers-h_oU4bB0.d.mts → parsers-fSBARZSn.d.mts} +2700 -2946
- package/{parsers-h_oU4bB0.d.ts → parsers-fSBARZSn.d.ts} +2700 -2946
- package/processors.js +13 -1
- package/processors.mjs +13 -1
package/llms.txt
CHANGED
|
@@ -18,22 +18,27 @@
|
|
|
18
18
|
- [Names with different jobs](README.md#names-with-different-jobs) · [skim: deprecated compatibility no-op](README.md#skim-compatibility-no-op)
|
|
19
19
|
- [Runtime isolation and nullish grants](README.md#default-runtime-vs-isolated-runtime) · [Factory overloads](README.md#createrouter-overloads) · [Optional raw-document metadata getter](README.md#optional-permissions-plugin)
|
|
20
20
|
- [Operation matrix and fallback](README.md#basic-and-advanced-operation-access) · [Live setters](README.md#live-updates-and-option-snapshots)
|
|
21
|
-
- [
|
|
22
|
-
- [
|
|
21
|
+
- [Nested operation breaking migration](MIGRATION.md#breaking-change-nested-operation-access): hard removal of flat keys and RouteVariantAccess, no aliases/translation. Root/advanced export OperationAccessContext, OperationAccessVariants, OperationAccessRule and typed whole/member setters. Scalar or { default, basic, advanced, root } per operation; exact same-owner runtime context defaults precede operation scalar/default, then outer fallback, then deny. Only undefined falls through; objects do not deep-merge. Defined subdocument fields stay closed; absent fields use top-level policy, scalar fields retain fallback. Omitted model policy inherits; explicit whole undefined retains exact-operation defaults, not bare/outer catch-alls. Root target member is independent of the scalar outer batch guard; unpaired direct routes use basic, root counterparts root. Secondary populate/private/include/retry/visibility checks use scalar/default only; trusted services and flags unchanged. Context paths are configuration, not wire/populate selectors; requestSchemas/client/field/permission names are unchanged. Generic option getters are raw fallback lookups, not final entry resolution.
|
|
22
|
+
- [Owned authorization modes](README.md#owned-authorization-modes): exactly readAuthorizationMode/listAuthorizationMode/createAuthorizationMode/updateAuthorizationMode on server model/default options, same literal AuthorizationMode, isolated default; undefined restores inheritance. CREATE/UPDATE apply only to post-persistence/lifecycle output; UPSERT selects the captured executed branch while retaining upsert. Both write modes always acquire a full bounded detached source/native leaves; trusted omits only the subsequent doc-hook view copy, never lends live documents/_doc/payloads/snapshots. Target-own READ/LIST mode also selects genuine write-origin populate, still with mandatory full detachment (unlike query-origin trusted hidden graphs). Embedded scopes inherit owner mode/facts; independent calls recapture, READ retries retain READ. Actor/policy/boolean facts, getter views/private inputs/selected bounds stay protected. Input admission/hydrated pre-write UPDATE hook/lifecycle unchanged, not sandboxed. NEW/helpers/dedicated/count/delete/distinct/custom origins gain no trusted stage. No implicit save/query/rollback; output failure may follow commit. No per-call/wire selector, alternate spellings or retired flag aliases.
|
|
23
|
+
- [Shipped breaking migration](MIGRATION.md): M1 boolean DocumentGrants/two-argument FieldPermissionHook; M2 frozen ModelOutputContext vs mutable lifecycle; M3 no handles, zero-read empty-fact raw helpers vs explicit current read; M4 all ten rejected keys and tested revision rollback; M5 search checklist/errors/module conditions. Complete workflow is compiled/executed from installed public imports.
|
|
23
24
|
- [Data list/read](README.md#data-routers) · [Data ownership/native values](README.md#in-memory-data-ownership) · [Runnable data example](README.md#runnable-data-router-split)
|
|
24
25
|
- [Root batches: maxOrderGroups bounds both group count and numeric order](README.md#root-batch-bounds)
|
|
25
26
|
- [Request validation and OpenAPI](README.md#request-validation-and-openapi) · [AJV sync/async contract](README.md#ajv-validation-contract)
|
|
26
27
|
|
|
27
28
|
## Business and migration contracts
|
|
28
29
|
|
|
30
|
+
- [Document-permission dependencies](README.md#document-permission-dependencies-breaking-change): alwaysSelectFields is removed, no alias/setter. Root/advanced export ModelDocPermissionsDescriptor/Definition/AccessRecord. Functions or { dependsOn?, get } directly or per-access/default/custom; active docPermissionsAccess exact→default only, no output-access dependency union. Top-level persisted schema keys only (whole nested containers); dotted/unsafe/unknown/virtual inputs reject. Missing inputs never skip get; dependencies grant no output. Whole-definition dotted setters, no partial member edits. Owning embedded facts, independent related/pre-/post-write stages; raw helpers never calculate hooks or fetch inputs.
|
|
31
|
+
- [Model-condition guards](README.md#model-condition-guards): private fresh visible-row/fact read, no DTO/field/virtual/include-output/metadata/decorate/task work or `_read` override interception. Source/fact/necessary-input errors remain 400; ordinary denied/missing is 401. Same defaults/projection/hydration/hook source and target-input admission. Request-only service admission is distinct from generated HTTP READ operation admission; captured LIST retry only for an admitted miss. Security belongs in operation/row/fact hooks; a separately checked normal DTO read adds its explicit cost. See shipped M2/M3/M5 migration.
|
|
29
32
|
- [Server-owned hydration and migration](README.md#breaking-release-server-owned-hydration): root/advanced types `HydrationMode` and `ModelHydrationOptions`; model/starting-default `hydration` has exactly publicList (built-in lean), publicRead/find/findOne/findById (built-in hydrated). Records replace shallowly; exact dotted setters update one member. Fresh calls capture their owning runtime; in-flight calls keep theirs. Move `defaults.*Options.lean`/`service.defaults` deliberately to model-wide configuration (true → 'lean', false → 'hydrated'); legacy method-default controls throw. No per-call/client/wire replacement; stale permissive keys are inert, strict correlated options still reject, and business fields keep their meaning.
|
|
30
33
|
- [Fixed/related modes and value caveat](README.md#breaking-release-server-owned-hydration): includes/post-save subdocument visibility stay lean; raw parents/lifecycle documents stay hydrated; $$sq uses target public configuration; populate inherits its parent query. Plain finalized results do not imply identical schema defaults/getters/transforms/init-hook values or a measured speedup.
|
|
31
34
|
- [Finalized permissions alias](README.md#finalized-permissions-alias): non-enumerable value alias to already-exposed canonical metadata, including dotted paths, independent of hydration/plugin. Stripping suppresses it; business/virtual/include collisions win. Package copies preserve it where metadata exists; no metadata synthesis or arbitrary-copy/client-wrapper promise. The optional Mongoose raw getter is separate.
|
|
32
35
|
- [Trusted service authorization](README.md#trusted-service-authorization) · [Request admission](README.md#public-request-admission-and-backend-options): policy is server-only; wire/default control slots reject it.
|
|
33
|
-
- [Selection, grants and document
|
|
36
|
+
- [Selection, grants and document results](README.md#selection-grants-and-document-results) · [Runnable Mongo authorization example](README.md#runnable-service-authorization): DTOs/metadata are DATA, never reusable authority. Raw helpers use global permissions + frozen empty facts and add zero reads/hooks; current document-dependent authority requires a new normal query (+1 read/hook for a single-row refresh).
|
|
34
37
|
- [Independent mutation input](README.md#independent-mutation-input-authority) · [Scoped subdocuments](README.md#dedicated-subdocument-authorization) · [Successful hidden-write responses](README.md#subdocument-writes-with-hidden-responses)
|
|
35
38
|
- [Row scope vs query transformation](README.md#backend-row-authorization-and-filter-migration) · [Denial vs miss](README.md#denial-and-request-validation) · [Whole-value distinct](README.md#distinct-whole-value-request-authorization)
|
|
36
39
|
- [Removed overrides migration](README.md#breaking-release-service-overrides-migration) · [Named helper migration and data compatibility](README.md#breaking-release-named-helpers-and-default-behavior)
|
|
40
|
+
|
|
41
|
+
- [Optional raw collections](README.md#optional-raw-collections-one-deliberately-shared-capture): model Service/PublicService (both getters) and Core expose `pickAllowedFieldsMany(rows, access, options?)` (Core prepends modelName), reusing server-only OutputFieldOptions; no DataService/HTTP/client API. One entry actor/model/catalog/config/scope/policy capture is NOT N fresh picks or a default handle/H3 migration. All sources owned before first predicate; independent row EMPTY stages/memos in all modes, no DB/doc hooks/virtuals/row or target admission/restoration. Ordinary presentation normally uses zero helpers; current facts need a new normal READ/LIST with private hook inputs. Dense ordinary 0–1,000-position arrays, nullish preserved; per-row 20,000/depth-100 owners plus whole-call 200,000 work / 16 MiB cumulative router-controlled admission/staging/traversal/copies. EXCLUDES opaque Mongoose/native internals/dependency allocations, trusted effects and engine enumeration; NOT total-memory/RSS/whole-normalization/CPU/sandbox cap. Admit normalized returns before next explicit router copy; explicit native/wire preparation still counts. Bounded shared gate, stable order, sticky whole 400/close/drain/clear (predicate-body errors omit fields), no partial results/rollback/retry. Root/advanced type-only FilteredOutput<T>: deep optional readonly strings, nullish arrays, string Map-to-record, canonical Date/RegExp/Buffer; other BSON/hydrated (including string IDs)/depth-eight unknown. Readonly is not native freeze/input validation/exact field inference. See exact installed M3 recipes; no measured speedup or old-gate substitution.
|
|
37
42
|
- [Includes/count cardinality](README.md#include-cardinality) · [Bounded numeric Map counts and Set-to-number migration](README.md#numeric-grouped-count-service-api-breaking-migration) · [Source/attachment provenance](README.md#safe-include-output-paths)
|
|
38
43
|
- [Correlated includes and literal escapes](README.md#correlated-includes) · [Nested writes and trusted hooks](README.md#nested-updates-and-trusted-hooks)
|
|
39
44
|
- [Virtuals, literal-filter preservation and output compatibility](README.md#virtuals-computed-fields) · [Request/runtime reentrant hook chains](README.md#hook-admission-and-reentrant-service-calls) · [Separate persistence limits](README.md#persistence-concurrency-and-resource-limits)
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@web-ts-toolkit/access-router",
|
|
3
3
|
"description": "ACL-aware Express routers and in-memory data services for Mongoose-backed APIs",
|
|
4
4
|
"homepage": "https://web-ts-toolkit.pages.dev/docs/packages/access-router",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.67.0",
|
|
6
6
|
"sideEffects": [
|
|
7
7
|
"./**/index.js",
|
|
8
8
|
"./**/index.mjs",
|
|
@@ -54,11 +54,11 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"engines": {
|
|
57
|
-
"node": ">=
|
|
57
|
+
"node": ">=24"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@web-ts-toolkit/express-json-router": "0.
|
|
61
|
-
"@web-ts-toolkit/utils": "0.
|
|
60
|
+
"@web-ts-toolkit/express-json-router": "0.67.0",
|
|
61
|
+
"@web-ts-toolkit/utils": "0.67.0",
|
|
62
62
|
"just-diff": "^6.0.2",
|
|
63
63
|
"mongoose-schema-jsonschema": "^4.0.1",
|
|
64
64
|
"sift": "^17.1.3",
|