@web-ts-toolkit/access-router 0.65.0 → 0.66.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/llms.txt CHANGED
@@ -18,22 +18,25 @@
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
- - [Unsafe comparison switches](README.md#temporary-unsafe-readlist-performance-switches) · [Initial output-copy opt-outs](README.md#temporary-unsafe-initial-output-snapshot-copy-switches): original six comparison/two copy groups keep their independent contracts with the matching new authorization fast-path flag OFF (or dormant). Copy omission requires the corresponding OutputSnapshotChecks skip; otherwise dormant and still copies/compares. READ retries/authenticated descendants retain origin capture. Bounded shape admission/exact graph identities and detached source/callback/grant/getter/response copies remain in that original mode; native/BSON normalization/wire observations can be omitted and change outcomes. Proxies/Map/Set/unproven graphs may copy. Server model/default literal-true only; no client/per-call authority. See the prerequisite table before opting in.
22
- - [Experimental unsafe READ/LIST authorization fast paths](README.md#experimental-unsafe-readlist-authorization-fast-paths) · [Runnable LIST/READ prerequisites, rollback and handle warnings](README.md#runnable-listread-prerequisites-rollback-and-handle-warnings): third independent optional boolean pair `unsafeUseListAuthorizationFastPath` / `unsafeUseReadAuthorizationFastPath`, default false, literal server true only. Each needs ALL FOUR matching DocumentSnapshotChecks/OutputSnapshotChecks/NestedDocumentSnapshotChecks/InitialOutputSnapshotCopy skips; false is off, true with any missing is dormant, never auto-enables prerequisites. READ-to-list retries remain READ; genuine related/embedded stages inherit origin capture before hooks/awaits, independent calls own theirs. Active ordinary lean source/hook input, grants and shallow diagnostic context leaves are borrowed; captured config/scope views reused. No trusted stage snapshot/current-descendant walk. Exact root/tuple checks and issued-document membership remain: removed original children may still be found, replacements get no handle, root helpers filter current values with stale memo/shared grants even after rollback. Rules/row/target gates/original actor/mandatory per-root/target hooks/getters remain; unrelated rows/targets do not cache by ID. Copied rows/grants/value fallbacks, hydration/getter document views/return staging/private argument-four isolation/JSON normalization remain; not every row zero-copy or a general clone bypass. New selected work has 20,000-slot/issued-root and depth-100 budgets, not full unvisited source/grant/context bounds. Mutation/stale decisions/descendant replacement/lost native observations can turn denial into allowance. Writes/write-derived output/dedicated subdocuments/fresh raw helpers strict; control-slot presence rejects, business fields inert. Explicit model false overrides defaults, undefined restores inheritance. Warns active/dormant/missing transitions; rollback only new calls, and original skip flags require separate restoration. Experimental performance-first: benchmark your workload, no universal gain, security equivalence or v0.51.0 parity; no publication-fusion API.
21
+ - [Owned READ/LIST modes](README.md#owned-readlist-authorization-modes): one engine, isolated default, trusted source borrowing only; independent model/default readAuthorizationMode/listAuthorizationMode. Actor/policy/boolean facts remain owned; related targets choose their own mode, embedded scopes inherit genuine owners, READ retries retain READ, writes/new/dedicated origins isolated. No per-call/wire selector or retired flag aliases.
22
+ - [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
23
  - [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
24
  - [Root batches: maxOrderGroups bounds both group count and numeric order](README.md#root-batch-bounds)
25
25
  - [Request validation and OpenAPI](README.md#request-validation-and-openapi) · [AJV sync/async contract](README.md#ajv-validation-contract)
26
26
 
27
27
  ## Business and migration contracts
28
28
 
29
+ - [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
30
  - [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
31
  - [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
32
  - [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
33
  - [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 handles](README.md#selection-grants-and-document-results) · [Runnable Mongo authorization example](README.md#runnable-authorization-and-handle-reuse): default/copied handles validate unchanged graphs; active trusted handles retain only exact root authority/issued membership and borrowed context/grants. Fresh raw policy is not retained-handle authority.
34
+ - [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
35
  - [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
36
  - [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
37
  - [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)
38
+
39
+ - [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
40
  - [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
41
  - [Correlated includes and literal escapes](README.md#correlated-includes) · [Nested writes and trusted hooks](README.md#nested-updates-and-trusted-hooks)
39
42
  - [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.65.0",
5
+ "version": "0.66.0",
6
6
  "sideEffects": [
7
7
  "./**/index.js",
8
8
  "./**/index.mjs",
@@ -57,8 +57,8 @@
57
57
  "node": ">=22"
58
58
  },
59
59
  "dependencies": {
60
- "@web-ts-toolkit/express-json-router": "0.65.0",
61
- "@web-ts-toolkit/utils": "0.65.0",
60
+ "@web-ts-toolkit/express-json-router": "0.66.0",
61
+ "@web-ts-toolkit/utils": "0.66.0",
62
62
  "just-diff": "^6.0.2",
63
63
  "mongoose-schema-jsonschema": "^4.0.1",
64
64
  "sift": "^17.1.3",