@web-ts-toolkit/access-router 0.59.0 → 0.60.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/README.md +55 -0
- package/advanced.d.mts +1 -1
- package/advanced.d.ts +1 -1
- package/advanced.js +19 -3
- package/advanced.mjs +19 -3
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +47 -8
- package/index.mjs +47 -8
- package/package.json +3 -3
- package/{parsers-CngKnVjW.d.mts → parsers-bP4gXehf.d.mts} +38 -0
- package/{parsers-CngKnVjW.d.ts → parsers-bP4gXehf.d.ts} +38 -0
package/README.md
CHANGED
|
@@ -237,6 +237,61 @@ Express routes. `parentPath` supplies the external prefix for route metadata/log
|
|
|
237
237
|
mount that prefix in Express yourself. Live `idField`/`resolveIdFilter` change lookup
|
|
238
238
|
behavior rather than route shape.
|
|
239
239
|
|
|
240
|
+
### Temporary unsafe read/list-performance switches
|
|
241
|
+
|
|
242
|
+
**Both default to off (snapshot checks enabled).** These independent server-only
|
|
243
|
+
settings temporarily skip repeated source snapshot comparisons on one registered model:
|
|
244
|
+
|
|
245
|
+
| Flag | Applies to |
|
|
246
|
+
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
247
|
+
| `unsafeSkipListDocumentSnapshotChecks` | Top-level `find`, generated public lists and root-list responses |
|
|
248
|
+
| `unsafeSkipReadDocumentSnapshotChecks` | Top-level `findOne`, `findById`, public identifier/filter reads and root reads, including read-to-list retries |
|
|
249
|
+
|
|
250
|
+
A read-to-list retry follows the **read flag**, because the initiating operation
|
|
251
|
+
is still a single read. Changing one flag does not change the other.
|
|
252
|
+
|
|
253
|
+
<!-- doc-example: partial -->
|
|
254
|
+
|
|
255
|
+
```ts
|
|
256
|
+
import acl from '@web-ts-toolkit/access-router';
|
|
257
|
+
|
|
258
|
+
// User must already be registered on this runtime. Never take this value from a request.
|
|
259
|
+
// TODO: revisit/remove this temporary workaround after query-performance remediation.
|
|
260
|
+
acl.setModelOptions('User', {
|
|
261
|
+
unsafeSkipReadDocumentSnapshotChecks: true,
|
|
262
|
+
unsafeSkipListDocumentSnapshotChecks: false, // lists stay protected
|
|
263
|
+
});
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Set either flag to `false` with `setModelOption` to roll back for new calls.
|
|
267
|
+
Both flags can be set in `createRouter(Model, { ... })` or `setDefaultModelOptions`
|
|
268
|
+
before model-router creation. Starting defaults do not overwrite existing models'
|
|
269
|
+
stored settings; a per-model `false` overrides a starting default of `true`.
|
|
270
|
+
Prefer per-model opt-in rather than enabling it for every model. Use the owning
|
|
271
|
+
`createAccessRuntime()` API instead of default `acl` for an isolated runtime.
|
|
272
|
+
Only literal boolean `true` enables each flag. Enabling emits a logger warning once
|
|
273
|
+
per model/flag transition, not per row/request. Neither is a global, per-call, HTTP/root
|
|
274
|
+
entry, `options.authorization`, or `service.defaults` option.
|
|
275
|
+
|
|
276
|
+
- **Skipped:** repeated comparisons of the retained projected document with its
|
|
277
|
+
authorization snapshot on the enabled operation. List/read-origin handles and
|
|
278
|
+
captured read-to-list retries retain their mode in later work and helper picks.
|
|
279
|
+
- **Still enforced:** row filters, document/field rules, operation gates, exact
|
|
280
|
+
request/runtime/model/stage ownership, output-mutation/provenance checks and bounds.
|
|
281
|
+
Initial snapshots and detached callback/grant/output copies (including native values)
|
|
282
|
+
remain. Writes (including read-like output), dedicated subdocument operations,
|
|
283
|
+
embedded/related stages and fresh standalone output helpers stay strict. An
|
|
284
|
+
operation without its own opt-out stays protected.
|
|
285
|
+
- **Risk:** source changes during callbacks or awaits will no longer invalidate
|
|
286
|
+
cached grants/decisions. Output may be authorized using stale data even though
|
|
287
|
+
normal permission rules run. This is a deliberate weakening of mutation protection,
|
|
288
|
+
**not a security-equivalent fast mode**. Use only with trusted, non-mutating hooks;
|
|
289
|
+
review your application and measure a staged rollout before production opt-in.
|
|
290
|
+
|
|
291
|
+
Each call captures the setting before awaits. Turning it off protects new calls,
|
|
292
|
+
not in-flight calls, retries or existing handles. These switches do not eliminate
|
|
293
|
+
all cloning or promise v0.51.0 performance. Restore `false` as soon as possible.
|
|
294
|
+
|
|
240
295
|
### Wire placement and option names
|
|
241
296
|
|
|
242
297
|
| Intent | Basic GET query | Advanced body | Root entry |
|
package/advanced.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AccessRouterBaseRequest, a as AccessRouterFieldKey, b as AccessRouterLogger, c as AccessRouterRequest, d as AccessRouterRequestExtensions, e as AdvancedCreateBody, f as AdvancedListBody, g as AdvancedReadBody, h as AdvancedReadFilterBody, i as AdvancedUpdateBody, j as AdvancedUpsertBody, k as AfterPersistAccess, l as AjvErrorObjectLike, m as AjvValidationErrorLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, r as ArkTypeProblemLike, s as AuthorizedListResult, t as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, u as Codes, v as CorrelatedCountInclude, w as CorrelatedFilter, x as CorrelatedInclude, y as CorrelatedIncludeArgs, z as CorrelatedListInclude, D as CorrelatedReadByFilterInclude, E as CorrelatedReadByIdInclude, F as CountBody, G as CreateArgs, H as CreateAuthorization, I as CreateOptions, J as CreateQueryInput, K as CustomHeaders, L as DATA_MIDDLEWARE, M as DataBaseFilterHook, N as DataFieldOptions, O as DataFilter, P as DataFindArgs, Q as DataFindOneArgs, R as DataFindOneOptions, S as DataFindOptions, T as DataHook, U as DataHookContext, V as DataIdentifierHook, W as DataListHook, X as DataOverrideFilterHook, Y as DataRequest, Z as DataRequestSchemas, _ as DataRouterOptions, $ as DecorateAccess, a0 as DecorateAllAccess, a1 as DeepFieldPath, a2 as DefaultModelRouterOptions, a3 as Defaults, a4 as DistinctArgs, a5 as DistinctBody, a6 as DocPermissionsAccess, a7 as DocumentAuthorization, a8 as ErrorResult, a9 as ExistsOptions, aa as ExtendedDataRouterOptions, ab as ExtendedDefaultModelRouterOptions, ac as ExtendedModelRouterOptions, ad as FieldAuthorization, ae as FieldOperationAccess, af as Filter, ag as FilterOperator, ah as FindAccess, ai as FindArgs, aj as FindByIdArgs, ak as FindByIdOptions, al as FindOneArgs, am as FindOneOptions, an as FindOptions, ao as GlobalOptions, ap as GlobalPermissionValue, aq as GuardHook, ar as HydrationMode, as as IdentifierHook, at as Include, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aB as KeyValueProjection, aC as LegacyInclude, aD as ListQueryInput, aE as ListResult, aF as MIDDLEWARE, aG as MaybePromise, aH as ModelBaseFilterHook, aI as ModelChangeHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aL as ModelDocument, aM as ModelDocumentHook, aN as ModelHook, aO as ModelHookContext, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aT as ModelRequest, aU as ModelRouterOptions, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, aZ as ModelVirtualDescriptor, a_ as ModelVirtualDoc, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b3 as ModelVirtualRecordAccess, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, be as PERMISSIONS, bf as PERMISSION_KEYS, bg as PairedRouteAccess, bh as ParentRef, bi as PathValue, bj as PermissionSchema, bk as Populate, bl as PopulateAccess, bm as PopulatePlanningOptions, bn as PrepareAccess, bo as Projection, bp as PublicCreateArgs, bq as PublicCreateOptions, br as PublicErrorResult, bs as PublicListArgs, bt as PublicListOptions, bu as PublicListResult, bv as PublicOutput, bw as PublicReadArgs, bx as PublicReadOptions, by as PublicServiceResult, bz as PublicSingleResult, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bE as PublicUpdateArgs, bF as PublicUpdateOptions, bG as PublicUpsertArgs, bH as PublicUpsertOptions, bI as ReadQueryInput, bJ as RelatedAuthorization, bK as Request, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, bT as RequestSchemas, bU as RootDataListQueryEntry, bV as RootDataOperation, bW as RootDataReadByFilterQueryEntry, bX as RootDataReadByIdQueryEntry, bY as RootModelCountQueryEntry, bZ as RootModelCreateQueryEntry, b_ as RootModelDeleteQueryEntry, b$ as RootModelDistinctQueryEntry, c0 as RootModelListQueryEntry, c1 as RootModelNewQueryEntry, c2 as RootModelOperation, c3 as RootModelReadByFilterQueryEntry, c4 as RootModelReadByIdQueryEntry, c5 as RootModelSubBulkUpdateQueryEntry, c6 as RootModelSubCreateQueryEntry, c7 as RootModelSubDeleteQueryEntry, c8 as RootModelSubListQueryEntry, c9 as RootModelSubReadQueryEntry, ca as RootModelSubUpdateQueryEntry, cb as RootModelUpdateQueryEntry, cc as RootModelUpsertQueryEntry, cd as RootOperationResult, ce as RootQueryEntry, cf as RootRouterOptions, cg as RootSubOperation, ch as RootTarget, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cn as SelectAccess, co as SelectedPopulatedPublicOutput, cp as SelectedPublicOutput, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, ct as ServiceResult, cu as SingleResult, cv as Sort, cw as SortOrder, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cE as StatusCodes, cF as SubListBody, cG as SubOperationAccess, cH as SubPopulate, cI as SubQueryEntry, cJ as SubReadBody, cK as SubRouteGuardOptions, cL as SubdocumentBulkRecord, cM as SubdocumentBulkUpdateInput, cN as SubdocumentCreateAuthorization, cO as SubdocumentCreateInput, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cU as SubdocumentId, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, c$ as SubdocumentParentArgs, d0 as SubdocumentParentOptions, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d3 as SubdocumentRecord, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, d9 as Task, da as TaskType, db as TransformAccess, dc as TypedFilter, dd as UpdateByIdArgs, de as UpdateByIdOptions, df as UpdateOneArgs, dg as UpdateOneOptions, dh as UpdateQueryInput, di as UpsertArgs, dj as UpsertOptions, dk as UpsertQueryInput, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, dq as ValidateAccess, dr as ValidateRule, ds as Validation, dt as ValidationError, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod, dM as parseBody, dN as parseBodyWithSchema, dO as parseNestedBodyWithSchema, dP as parsePathParam, dQ as parseQuery } from './parsers-
|
|
1
|
+
export { A as AccessRouterBaseRequest, a as AccessRouterFieldKey, b as AccessRouterLogger, c as AccessRouterRequest, d as AccessRouterRequestExtensions, e as AdvancedCreateBody, f as AdvancedListBody, g as AdvancedReadBody, h as AdvancedReadFilterBody, i as AdvancedUpdateBody, j as AdvancedUpsertBody, k as AfterPersistAccess, l as AjvErrorObjectLike, m as AjvValidationErrorLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, r as ArkTypeProblemLike, s as AuthorizedListResult, t as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, u as Codes, v as CorrelatedCountInclude, w as CorrelatedFilter, x as CorrelatedInclude, y as CorrelatedIncludeArgs, z as CorrelatedListInclude, D as CorrelatedReadByFilterInclude, E as CorrelatedReadByIdInclude, F as CountBody, G as CreateArgs, H as CreateAuthorization, I as CreateOptions, J as CreateQueryInput, K as CustomHeaders, L as DATA_MIDDLEWARE, M as DataBaseFilterHook, N as DataFieldOptions, O as DataFilter, P as DataFindArgs, Q as DataFindOneArgs, R as DataFindOneOptions, S as DataFindOptions, T as DataHook, U as DataHookContext, V as DataIdentifierHook, W as DataListHook, X as DataOverrideFilterHook, Y as DataRequest, Z as DataRequestSchemas, _ as DataRouterOptions, $ as DecorateAccess, a0 as DecorateAllAccess, a1 as DeepFieldPath, a2 as DefaultModelRouterOptions, a3 as Defaults, a4 as DistinctArgs, a5 as DistinctBody, a6 as DocPermissionsAccess, a7 as DocumentAuthorization, a8 as ErrorResult, a9 as ExistsOptions, aa as ExtendedDataRouterOptions, ab as ExtendedDefaultModelRouterOptions, ac as ExtendedModelRouterOptions, ad as FieldAuthorization, ae as FieldOperationAccess, af as Filter, ag as FilterOperator, ah as FindAccess, ai as FindArgs, aj as FindByIdArgs, ak as FindByIdOptions, al as FindOneArgs, am as FindOneOptions, an as FindOptions, ao as GlobalOptions, ap as GlobalPermissionValue, aq as GuardHook, ar as HydrationMode, as as IdentifierHook, at as Include, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aB as KeyValueProjection, aC as LegacyInclude, aD as ListQueryInput, aE as ListResult, aF as MIDDLEWARE, aG as MaybePromise, aH as ModelBaseFilterHook, aI as ModelChangeHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aL as ModelDocument, aM as ModelDocumentHook, aN as ModelHook, aO as ModelHookContext, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aT as ModelRequest, aU as ModelRouterOptions, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, aZ as ModelVirtualDescriptor, a_ as ModelVirtualDoc, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b3 as ModelVirtualRecordAccess, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, be as PERMISSIONS, bf as PERMISSION_KEYS, bg as PairedRouteAccess, bh as ParentRef, bi as PathValue, bj as PermissionSchema, bk as Populate, bl as PopulateAccess, bm as PopulatePlanningOptions, bn as PrepareAccess, bo as Projection, bp as PublicCreateArgs, bq as PublicCreateOptions, br as PublicErrorResult, bs as PublicListArgs, bt as PublicListOptions, bu as PublicListResult, bv as PublicOutput, bw as PublicReadArgs, bx as PublicReadOptions, by as PublicServiceResult, bz as PublicSingleResult, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bE as PublicUpdateArgs, bF as PublicUpdateOptions, bG as PublicUpsertArgs, bH as PublicUpsertOptions, bI as ReadQueryInput, bJ as RelatedAuthorization, bK as Request, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, bT as RequestSchemas, bU as RootDataListQueryEntry, bV as RootDataOperation, bW as RootDataReadByFilterQueryEntry, bX as RootDataReadByIdQueryEntry, bY as RootModelCountQueryEntry, bZ as RootModelCreateQueryEntry, b_ as RootModelDeleteQueryEntry, b$ as RootModelDistinctQueryEntry, c0 as RootModelListQueryEntry, c1 as RootModelNewQueryEntry, c2 as RootModelOperation, c3 as RootModelReadByFilterQueryEntry, c4 as RootModelReadByIdQueryEntry, c5 as RootModelSubBulkUpdateQueryEntry, c6 as RootModelSubCreateQueryEntry, c7 as RootModelSubDeleteQueryEntry, c8 as RootModelSubListQueryEntry, c9 as RootModelSubReadQueryEntry, ca as RootModelSubUpdateQueryEntry, cb as RootModelUpdateQueryEntry, cc as RootModelUpsertQueryEntry, cd as RootOperationResult, ce as RootQueryEntry, cf as RootRouterOptions, cg as RootSubOperation, ch as RootTarget, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cn as SelectAccess, co as SelectedPopulatedPublicOutput, cp as SelectedPublicOutput, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, ct as ServiceResult, cu as SingleResult, cv as Sort, cw as SortOrder, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cE as StatusCodes, cF as SubListBody, cG as SubOperationAccess, cH as SubPopulate, cI as SubQueryEntry, cJ as SubReadBody, cK as SubRouteGuardOptions, cL as SubdocumentBulkRecord, cM as SubdocumentBulkUpdateInput, cN as SubdocumentCreateAuthorization, cO as SubdocumentCreateInput, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cU as SubdocumentId, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, c$ as SubdocumentParentArgs, d0 as SubdocumentParentOptions, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d3 as SubdocumentRecord, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, d9 as Task, da as TaskType, db as TransformAccess, dc as TypedFilter, dd as UpdateByIdArgs, de as UpdateByIdOptions, df as UpdateOneArgs, dg as UpdateOneOptions, dh as UpdateQueryInput, di as UpsertArgs, dj as UpsertOptions, dk as UpsertQueryInput, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, dq as ValidateAccess, dr as ValidateRule, ds as Validation, dt as ValidationError, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod, dM as parseBody, dN as parseBodyWithSchema, dO as parseNestedBodyWithSchema, dP as parsePathParam, dQ as parseQuery } from './parsers-bP4gXehf.mjs';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import 'mongoose';
|
|
4
4
|
import 'express';
|
package/advanced.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as AccessRouterBaseRequest, a as AccessRouterFieldKey, b as AccessRouterLogger, c as AccessRouterRequest, d as AccessRouterRequestExtensions, e as AdvancedCreateBody, f as AdvancedListBody, g as AdvancedReadBody, h as AdvancedReadFilterBody, i as AdvancedUpdateBody, j as AdvancedUpsertBody, k as AfterPersistAccess, l as AjvErrorObjectLike, m as AjvValidationErrorLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, r as ArkTypeProblemLike, s as AuthorizedListResult, t as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, u as Codes, v as CorrelatedCountInclude, w as CorrelatedFilter, x as CorrelatedInclude, y as CorrelatedIncludeArgs, z as CorrelatedListInclude, D as CorrelatedReadByFilterInclude, E as CorrelatedReadByIdInclude, F as CountBody, G as CreateArgs, H as CreateAuthorization, I as CreateOptions, J as CreateQueryInput, K as CustomHeaders, L as DATA_MIDDLEWARE, M as DataBaseFilterHook, N as DataFieldOptions, O as DataFilter, P as DataFindArgs, Q as DataFindOneArgs, R as DataFindOneOptions, S as DataFindOptions, T as DataHook, U as DataHookContext, V as DataIdentifierHook, W as DataListHook, X as DataOverrideFilterHook, Y as DataRequest, Z as DataRequestSchemas, _ as DataRouterOptions, $ as DecorateAccess, a0 as DecorateAllAccess, a1 as DeepFieldPath, a2 as DefaultModelRouterOptions, a3 as Defaults, a4 as DistinctArgs, a5 as DistinctBody, a6 as DocPermissionsAccess, a7 as DocumentAuthorization, a8 as ErrorResult, a9 as ExistsOptions, aa as ExtendedDataRouterOptions, ab as ExtendedDefaultModelRouterOptions, ac as ExtendedModelRouterOptions, ad as FieldAuthorization, ae as FieldOperationAccess, af as Filter, ag as FilterOperator, ah as FindAccess, ai as FindArgs, aj as FindByIdArgs, ak as FindByIdOptions, al as FindOneArgs, am as FindOneOptions, an as FindOptions, ao as GlobalOptions, ap as GlobalPermissionValue, aq as GuardHook, ar as HydrationMode, as as IdentifierHook, at as Include, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aB as KeyValueProjection, aC as LegacyInclude, aD as ListQueryInput, aE as ListResult, aF as MIDDLEWARE, aG as MaybePromise, aH as ModelBaseFilterHook, aI as ModelChangeHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aL as ModelDocument, aM as ModelDocumentHook, aN as ModelHook, aO as ModelHookContext, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aT as ModelRequest, aU as ModelRouterOptions, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, aZ as ModelVirtualDescriptor, a_ as ModelVirtualDoc, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b3 as ModelVirtualRecordAccess, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, be as PERMISSIONS, bf as PERMISSION_KEYS, bg as PairedRouteAccess, bh as ParentRef, bi as PathValue, bj as PermissionSchema, bk as Populate, bl as PopulateAccess, bm as PopulatePlanningOptions, bn as PrepareAccess, bo as Projection, bp as PublicCreateArgs, bq as PublicCreateOptions, br as PublicErrorResult, bs as PublicListArgs, bt as PublicListOptions, bu as PublicListResult, bv as PublicOutput, bw as PublicReadArgs, bx as PublicReadOptions, by as PublicServiceResult, bz as PublicSingleResult, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bE as PublicUpdateArgs, bF as PublicUpdateOptions, bG as PublicUpsertArgs, bH as PublicUpsertOptions, bI as ReadQueryInput, bJ as RelatedAuthorization, bK as Request, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, bT as RequestSchemas, bU as RootDataListQueryEntry, bV as RootDataOperation, bW as RootDataReadByFilterQueryEntry, bX as RootDataReadByIdQueryEntry, bY as RootModelCountQueryEntry, bZ as RootModelCreateQueryEntry, b_ as RootModelDeleteQueryEntry, b$ as RootModelDistinctQueryEntry, c0 as RootModelListQueryEntry, c1 as RootModelNewQueryEntry, c2 as RootModelOperation, c3 as RootModelReadByFilterQueryEntry, c4 as RootModelReadByIdQueryEntry, c5 as RootModelSubBulkUpdateQueryEntry, c6 as RootModelSubCreateQueryEntry, c7 as RootModelSubDeleteQueryEntry, c8 as RootModelSubListQueryEntry, c9 as RootModelSubReadQueryEntry, ca as RootModelSubUpdateQueryEntry, cb as RootModelUpdateQueryEntry, cc as RootModelUpsertQueryEntry, cd as RootOperationResult, ce as RootQueryEntry, cf as RootRouterOptions, cg as RootSubOperation, ch as RootTarget, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cn as SelectAccess, co as SelectedPopulatedPublicOutput, cp as SelectedPublicOutput, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, ct as ServiceResult, cu as SingleResult, cv as Sort, cw as SortOrder, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cE as StatusCodes, cF as SubListBody, cG as SubOperationAccess, cH as SubPopulate, cI as SubQueryEntry, cJ as SubReadBody, cK as SubRouteGuardOptions, cL as SubdocumentBulkRecord, cM as SubdocumentBulkUpdateInput, cN as SubdocumentCreateAuthorization, cO as SubdocumentCreateInput, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cU as SubdocumentId, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, c$ as SubdocumentParentArgs, d0 as SubdocumentParentOptions, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d3 as SubdocumentRecord, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, d9 as Task, da as TaskType, db as TransformAccess, dc as TypedFilter, dd as UpdateByIdArgs, de as UpdateByIdOptions, df as UpdateOneArgs, dg as UpdateOneOptions, dh as UpdateQueryInput, di as UpsertArgs, dj as UpsertOptions, dk as UpsertQueryInput, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, dq as ValidateAccess, dr as ValidateRule, ds as Validation, dt as ValidationError, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod, dM as parseBody, dN as parseBodyWithSchema, dO as parseNestedBodyWithSchema, dP as parsePathParam, dQ as parseQuery } from './parsers-
|
|
1
|
+
export { A as AccessRouterBaseRequest, a as AccessRouterFieldKey, b as AccessRouterLogger, c as AccessRouterRequest, d as AccessRouterRequestExtensions, e as AdvancedCreateBody, f as AdvancedListBody, g as AdvancedReadBody, h as AdvancedReadFilterBody, i as AdvancedUpdateBody, j as AdvancedUpsertBody, k as AfterPersistAccess, l as AjvErrorObjectLike, m as AjvValidationErrorLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, r as ArkTypeProblemLike, s as AuthorizedListResult, t as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, u as Codes, v as CorrelatedCountInclude, w as CorrelatedFilter, x as CorrelatedInclude, y as CorrelatedIncludeArgs, z as CorrelatedListInclude, D as CorrelatedReadByFilterInclude, E as CorrelatedReadByIdInclude, F as CountBody, G as CreateArgs, H as CreateAuthorization, I as CreateOptions, J as CreateQueryInput, K as CustomHeaders, L as DATA_MIDDLEWARE, M as DataBaseFilterHook, N as DataFieldOptions, O as DataFilter, P as DataFindArgs, Q as DataFindOneArgs, R as DataFindOneOptions, S as DataFindOptions, T as DataHook, U as DataHookContext, V as DataIdentifierHook, W as DataListHook, X as DataOverrideFilterHook, Y as DataRequest, Z as DataRequestSchemas, _ as DataRouterOptions, $ as DecorateAccess, a0 as DecorateAllAccess, a1 as DeepFieldPath, a2 as DefaultModelRouterOptions, a3 as Defaults, a4 as DistinctArgs, a5 as DistinctBody, a6 as DocPermissionsAccess, a7 as DocumentAuthorization, a8 as ErrorResult, a9 as ExistsOptions, aa as ExtendedDataRouterOptions, ab as ExtendedDefaultModelRouterOptions, ac as ExtendedModelRouterOptions, ad as FieldAuthorization, ae as FieldOperationAccess, af as Filter, ag as FilterOperator, ah as FindAccess, ai as FindArgs, aj as FindByIdArgs, ak as FindByIdOptions, al as FindOneArgs, am as FindOneOptions, an as FindOptions, ao as GlobalOptions, ap as GlobalPermissionValue, aq as GuardHook, ar as HydrationMode, as as IdentifierHook, at as Include, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aB as KeyValueProjection, aC as LegacyInclude, aD as ListQueryInput, aE as ListResult, aF as MIDDLEWARE, aG as MaybePromise, aH as ModelBaseFilterHook, aI as ModelChangeHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aL as ModelDocument, aM as ModelDocumentHook, aN as ModelHook, aO as ModelHookContext, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aT as ModelRequest, aU as ModelRouterOptions, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, aZ as ModelVirtualDescriptor, a_ as ModelVirtualDoc, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b3 as ModelVirtualRecordAccess, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, be as PERMISSIONS, bf as PERMISSION_KEYS, bg as PairedRouteAccess, bh as ParentRef, bi as PathValue, bj as PermissionSchema, bk as Populate, bl as PopulateAccess, bm as PopulatePlanningOptions, bn as PrepareAccess, bo as Projection, bp as PublicCreateArgs, bq as PublicCreateOptions, br as PublicErrorResult, bs as PublicListArgs, bt as PublicListOptions, bu as PublicListResult, bv as PublicOutput, bw as PublicReadArgs, bx as PublicReadOptions, by as PublicServiceResult, bz as PublicSingleResult, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bE as PublicUpdateArgs, bF as PublicUpdateOptions, bG as PublicUpsertArgs, bH as PublicUpsertOptions, bI as ReadQueryInput, bJ as RelatedAuthorization, bK as Request, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, bT as RequestSchemas, bU as RootDataListQueryEntry, bV as RootDataOperation, bW as RootDataReadByFilterQueryEntry, bX as RootDataReadByIdQueryEntry, bY as RootModelCountQueryEntry, bZ as RootModelCreateQueryEntry, b_ as RootModelDeleteQueryEntry, b$ as RootModelDistinctQueryEntry, c0 as RootModelListQueryEntry, c1 as RootModelNewQueryEntry, c2 as RootModelOperation, c3 as RootModelReadByFilterQueryEntry, c4 as RootModelReadByIdQueryEntry, c5 as RootModelSubBulkUpdateQueryEntry, c6 as RootModelSubCreateQueryEntry, c7 as RootModelSubDeleteQueryEntry, c8 as RootModelSubListQueryEntry, c9 as RootModelSubReadQueryEntry, ca as RootModelSubUpdateQueryEntry, cb as RootModelUpdateQueryEntry, cc as RootModelUpsertQueryEntry, cd as RootOperationResult, ce as RootQueryEntry, cf as RootRouterOptions, cg as RootSubOperation, ch as RootTarget, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cn as SelectAccess, co as SelectedPopulatedPublicOutput, cp as SelectedPublicOutput, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, ct as ServiceResult, cu as SingleResult, cv as Sort, cw as SortOrder, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cE as StatusCodes, cF as SubListBody, cG as SubOperationAccess, cH as SubPopulate, cI as SubQueryEntry, cJ as SubReadBody, cK as SubRouteGuardOptions, cL as SubdocumentBulkRecord, cM as SubdocumentBulkUpdateInput, cN as SubdocumentCreateAuthorization, cO as SubdocumentCreateInput, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cU as SubdocumentId, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, c$ as SubdocumentParentArgs, d0 as SubdocumentParentOptions, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d3 as SubdocumentRecord, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, d9 as Task, da as TaskType, db as TransformAccess, dc as TypedFilter, dd as UpdateByIdArgs, de as UpdateByIdOptions, df as UpdateOneArgs, dg as UpdateOneOptions, dh as UpdateQueryInput, di as UpsertArgs, dj as UpsertOptions, dk as UpsertQueryInput, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, dq as ValidateAccess, dr as ValidateRule, ds as Validation, dt as ValidationError, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod, dM as parseBody, dN as parseBodyWithSchema, dO as parseNestedBodyWithSchema, dP as parsePathParam, dQ as parseQuery } from './parsers-bP4gXehf.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import 'mongoose';
|
|
4
4
|
import 'express';
|
package/advanced.js
CHANGED
|
@@ -147,6 +147,8 @@ var privateControls = [
|
|
|
147
147
|
"skipParsing",
|
|
148
148
|
"skipAuthorization",
|
|
149
149
|
"alreadyAuthorized",
|
|
150
|
+
"unsafeSkipListDocumentSnapshotChecks",
|
|
151
|
+
"unsafeSkipReadDocumentSnapshotChecks",
|
|
150
152
|
"operation"
|
|
151
153
|
];
|
|
152
154
|
var PublicAdmissionError = class extends import_express_json_router.default.clientErrors.BadRequestError {
|
|
@@ -174,7 +176,7 @@ function assertPublicAdmission(input, kind = "envelope") {
|
|
|
174
176
|
for (const key of privateControls) {
|
|
175
177
|
if (key in record2) {
|
|
176
178
|
throw new PublicAdmissionError(
|
|
177
|
-
`Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
179
|
+
key === "unsafeSkipListDocumentSnapshotChecks" || key === "unsafeSkipReadDocumentSnapshotChecks" ? `Unsupported public control ${path}.${key}; this unsafe flag is server model configuration only` : `Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
178
180
|
);
|
|
179
181
|
}
|
|
180
182
|
}
|
|
@@ -2065,7 +2067,9 @@ var AccessRuntime = class {
|
|
|
2065
2067
|
queryRouteSegment: "__query",
|
|
2066
2068
|
mutationRouteSegment: "__mutation",
|
|
2067
2069
|
operationAccess: false,
|
|
2068
|
-
modelPermissionPrefix: ""
|
|
2070
|
+
modelPermissionPrefix: "",
|
|
2071
|
+
unsafeSkipListDocumentSnapshotChecks: false,
|
|
2072
|
+
unsafeSkipReadDocumentSnapshotChecks: false
|
|
2069
2073
|
}).build();
|
|
2070
2074
|
this.modelOptions = {};
|
|
2071
2075
|
this.modelJsonSchemas = {};
|
|
@@ -2283,11 +2287,23 @@ var AccessRuntime = class {
|
|
|
2283
2287
|
...defaultModelOptions,
|
|
2284
2288
|
modelName
|
|
2285
2289
|
});
|
|
2290
|
+
const snapshotFlagChanged = (newValue, key, target, oldValue) => {
|
|
2291
|
+
target[key] = newValue === true;
|
|
2292
|
+
if (newValue !== true || oldValue === true) return;
|
|
2293
|
+
const operation = key === "unsafeSkipReadDocumentSnapshotChecks" ? "read" : "list";
|
|
2294
|
+
try {
|
|
2295
|
+
this.getGlobalOption("logger")?.warn?.(
|
|
2296
|
+
`UNSAFE: ${operation} document snapshot checks disabled; source mutation can leave stale authorization decisions. Restore ${key}=false after the temporary workaround.`,
|
|
2297
|
+
{ modelName }
|
|
2298
|
+
);
|
|
2299
|
+
} catch {
|
|
2300
|
+
}
|
|
2301
|
+
};
|
|
2286
2302
|
manager.onchange("permissionSchema", function(_newval, _key, target) {
|
|
2287
2303
|
refreshPermissionMetadata(target);
|
|
2288
2304
|
}).onchange("modelPermissionPrefix", function(_newval, _key, target) {
|
|
2289
2305
|
refreshPermissionMetadata(target);
|
|
2290
|
-
}).onchange("basePath", function(newval, key, target) {
|
|
2306
|
+
}).onchange("unsafeSkipListDocumentSnapshotChecks", snapshotFlagChanged).onchange("unsafeSkipReadDocumentSnapshotChecks", snapshotFlagChanged).onchange("basePath", function(newval, key, target) {
|
|
2291
2307
|
target[key] = normalizeBasePath(
|
|
2292
2308
|
modelName,
|
|
2293
2309
|
(0, import_utils13.isString)(newval) || (0, import_utils13.isNil)(newval) ? newval : void 0
|
package/advanced.mjs
CHANGED
|
@@ -65,6 +65,8 @@ var privateControls = [
|
|
|
65
65
|
"skipParsing",
|
|
66
66
|
"skipAuthorization",
|
|
67
67
|
"alreadyAuthorized",
|
|
68
|
+
"unsafeSkipListDocumentSnapshotChecks",
|
|
69
|
+
"unsafeSkipReadDocumentSnapshotChecks",
|
|
68
70
|
"operation"
|
|
69
71
|
];
|
|
70
72
|
var PublicAdmissionError = class extends JsonRouter.clientErrors.BadRequestError {
|
|
@@ -92,7 +94,7 @@ function assertPublicAdmission(input, kind = "envelope") {
|
|
|
92
94
|
for (const key of privateControls) {
|
|
93
95
|
if (key in record2) {
|
|
94
96
|
throw new PublicAdmissionError(
|
|
95
|
-
`Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
97
|
+
key === "unsafeSkipListDocumentSnapshotChecks" || key === "unsafeSkipReadDocumentSnapshotChecks" ? `Unsupported public control ${path}.${key}; this unsafe flag is server model configuration only` : `Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
96
98
|
);
|
|
97
99
|
}
|
|
98
100
|
}
|
|
@@ -1996,7 +1998,9 @@ var AccessRuntime = class {
|
|
|
1996
1998
|
queryRouteSegment: "__query",
|
|
1997
1999
|
mutationRouteSegment: "__mutation",
|
|
1998
2000
|
operationAccess: false,
|
|
1999
|
-
modelPermissionPrefix: ""
|
|
2001
|
+
modelPermissionPrefix: "",
|
|
2002
|
+
unsafeSkipListDocumentSnapshotChecks: false,
|
|
2003
|
+
unsafeSkipReadDocumentSnapshotChecks: false
|
|
2000
2004
|
}).build();
|
|
2001
2005
|
this.modelOptions = {};
|
|
2002
2006
|
this.modelJsonSchemas = {};
|
|
@@ -2214,11 +2218,23 @@ var AccessRuntime = class {
|
|
|
2214
2218
|
...defaultModelOptions,
|
|
2215
2219
|
modelName
|
|
2216
2220
|
});
|
|
2221
|
+
const snapshotFlagChanged = (newValue, key, target, oldValue) => {
|
|
2222
|
+
target[key] = newValue === true;
|
|
2223
|
+
if (newValue !== true || oldValue === true) return;
|
|
2224
|
+
const operation = key === "unsafeSkipReadDocumentSnapshotChecks" ? "read" : "list";
|
|
2225
|
+
try {
|
|
2226
|
+
this.getGlobalOption("logger")?.warn?.(
|
|
2227
|
+
`UNSAFE: ${operation} document snapshot checks disabled; source mutation can leave stale authorization decisions. Restore ${key}=false after the temporary workaround.`,
|
|
2228
|
+
{ modelName }
|
|
2229
|
+
);
|
|
2230
|
+
} catch {
|
|
2231
|
+
}
|
|
2232
|
+
};
|
|
2217
2233
|
manager.onchange("permissionSchema", function(_newval, _key, target) {
|
|
2218
2234
|
refreshPermissionMetadata(target);
|
|
2219
2235
|
}).onchange("modelPermissionPrefix", function(_newval, _key, target) {
|
|
2220
2236
|
refreshPermissionMetadata(target);
|
|
2221
|
-
}).onchange("basePath", function(newval, key, target) {
|
|
2237
|
+
}).onchange("unsafeSkipListDocumentSnapshotChecks", snapshotFlagChanged).onchange("unsafeSkipReadDocumentSnapshotChecks", snapshotFlagChanged).onchange("basePath", function(newval, key, target) {
|
|
2222
2238
|
target[key] = normalizeBasePath(
|
|
2223
2239
|
modelName,
|
|
2224
2240
|
isString3(newval) || isNil2(newval) ? newval : void 0
|
package/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose, { Schema } from 'mongoose';
|
|
2
2
|
import { Response, NextFunction, RequestHandler, Router } from 'express';
|
|
3
|
-
import { A as AccessRouterBaseRequest, aq as GuardHook, aT as ModelRequest, dR as AccessRuntime, _ as DataRouterOptions, Y as DataRequest, dS as DataService, aa as ExtendedDataRouterOptions, af as Filter, bo as Projection, cv as Sort, bk as Populate, aU as ModelRouterOptions, dT as Service, dU as PublicService, b3 as ModelVirtualRecordAccess, aZ as ModelVirtualDescriptor, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, ac as ExtendedModelRouterOptions, ds as Validation, cf as RootRouterOptions, dV as OpenApiRouterOptions, dW as OpenApiRegistryOptions, dX as OpenApiRouteDescriptor, dY as OpenApiDocumentOptions, dZ as OpenApiParameter, d_ as OpenApiSchema, d$ as OpenApiResponses, ao as GlobalOptions, a2 as DefaultModelRouterOptions, ab as ExtendedDefaultModelRouterOptions } from './parsers-
|
|
4
|
-
export { e0 as AccessRouterPermissionMap, e1 as AccessRouterPermissions, c as AccessRouterRequest, d as AccessRouterRequestExtensions, l as AjvErrorObjectLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, s as AuthorizedListResult, t as AuthorizedSingleResult, H as CreateAuthorization, N as DataFieldOptions, a7 as DocumentAuthorization, ad as FieldAuthorization, ae as FieldOperationAccess, ap as GlobalPermissionValue, ar as HydrationMode, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aG as MaybePromise, aH as ModelBaseFilterHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aM as ModelDocumentHook, aN as ModelHook, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, a_ as ModelVirtualDoc, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, e2 as OpenApiMethod, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, bg as PairedRouteAccess, bj as PermissionSchema, e3 as Permissions, bm as PopulatePlanningOptions, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bJ as RelatedAuthorization, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cG as SubOperationAccess, cK as SubRouteGuardOptions, cN as SubdocumentCreateAuthorization, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, e4 as defaultRuntime, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod } from './parsers-
|
|
3
|
+
import { A as AccessRouterBaseRequest, aq as GuardHook, aT as ModelRequest, dR as AccessRuntime, _ as DataRouterOptions, Y as DataRequest, dS as DataService, aa as ExtendedDataRouterOptions, af as Filter, bo as Projection, cv as Sort, bk as Populate, aU as ModelRouterOptions, dT as Service, dU as PublicService, b3 as ModelVirtualRecordAccess, aZ as ModelVirtualDescriptor, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, ac as ExtendedModelRouterOptions, ds as Validation, cf as RootRouterOptions, dV as OpenApiRouterOptions, dW as OpenApiRegistryOptions, dX as OpenApiRouteDescriptor, dY as OpenApiDocumentOptions, dZ as OpenApiParameter, d_ as OpenApiSchema, d$ as OpenApiResponses, ao as GlobalOptions, a2 as DefaultModelRouterOptions, ab as ExtendedDefaultModelRouterOptions } from './parsers-bP4gXehf.mjs';
|
|
4
|
+
export { e0 as AccessRouterPermissionMap, e1 as AccessRouterPermissions, c as AccessRouterRequest, d as AccessRouterRequestExtensions, l as AjvErrorObjectLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, s as AuthorizedListResult, t as AuthorizedSingleResult, H as CreateAuthorization, N as DataFieldOptions, a7 as DocumentAuthorization, ad as FieldAuthorization, ae as FieldOperationAccess, ap as GlobalPermissionValue, ar as HydrationMode, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aG as MaybePromise, aH as ModelBaseFilterHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aM as ModelDocumentHook, aN as ModelHook, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, a_ as ModelVirtualDoc, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, e2 as OpenApiMethod, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, bg as PairedRouteAccess, bj as PermissionSchema, e3 as Permissions, bm as PopulatePlanningOptions, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bJ as RelatedAuthorization, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cG as SubOperationAccess, cK as SubRouteGuardOptions, cN as SubdocumentCreateAuthorization, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, e4 as defaultRuntime, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod } from './parsers-bP4gXehf.mjs';
|
|
5
5
|
import JsonRouter from '@web-ts-toolkit/express-json-router';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose, { Schema } from 'mongoose';
|
|
2
2
|
import { Response, NextFunction, RequestHandler, Router } from 'express';
|
|
3
|
-
import { A as AccessRouterBaseRequest, aq as GuardHook, aT as ModelRequest, dR as AccessRuntime, _ as DataRouterOptions, Y as DataRequest, dS as DataService, aa as ExtendedDataRouterOptions, af as Filter, bo as Projection, cv as Sort, bk as Populate, aU as ModelRouterOptions, dT as Service, dU as PublicService, b3 as ModelVirtualRecordAccess, aZ as ModelVirtualDescriptor, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, ac as ExtendedModelRouterOptions, ds as Validation, cf as RootRouterOptions, dV as OpenApiRouterOptions, dW as OpenApiRegistryOptions, dX as OpenApiRouteDescriptor, dY as OpenApiDocumentOptions, dZ as OpenApiParameter, d_ as OpenApiSchema, d$ as OpenApiResponses, ao as GlobalOptions, a2 as DefaultModelRouterOptions, ab as ExtendedDefaultModelRouterOptions } from './parsers-
|
|
4
|
-
export { e0 as AccessRouterPermissionMap, e1 as AccessRouterPermissions, c as AccessRouterRequest, d as AccessRouterRequestExtensions, l as AjvErrorObjectLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, s as AuthorizedListResult, t as AuthorizedSingleResult, H as CreateAuthorization, N as DataFieldOptions, a7 as DocumentAuthorization, ad as FieldAuthorization, ae as FieldOperationAccess, ap as GlobalPermissionValue, ar as HydrationMode, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aG as MaybePromise, aH as ModelBaseFilterHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aM as ModelDocumentHook, aN as ModelHook, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, a_ as ModelVirtualDoc, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, e2 as OpenApiMethod, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, bg as PairedRouteAccess, bj as PermissionSchema, e3 as Permissions, bm as PopulatePlanningOptions, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bJ as RelatedAuthorization, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cG as SubOperationAccess, cK as SubRouteGuardOptions, cN as SubdocumentCreateAuthorization, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, e4 as defaultRuntime, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod } from './parsers-
|
|
3
|
+
import { A as AccessRouterBaseRequest, aq as GuardHook, aT as ModelRequest, dR as AccessRuntime, _ as DataRouterOptions, Y as DataRequest, dS as DataService, aa as ExtendedDataRouterOptions, af as Filter, bo as Projection, cv as Sort, bk as Populate, aU as ModelRouterOptions, dT as Service, dU as PublicService, b3 as ModelVirtualRecordAccess, aZ as ModelVirtualDescriptor, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, ac as ExtendedModelRouterOptions, ds as Validation, cf as RootRouterOptions, dV as OpenApiRouterOptions, dW as OpenApiRegistryOptions, dX as OpenApiRouteDescriptor, dY as OpenApiDocumentOptions, dZ as OpenApiParameter, d_ as OpenApiSchema, d$ as OpenApiResponses, ao as GlobalOptions, a2 as DefaultModelRouterOptions, ab as ExtendedDefaultModelRouterOptions } from './parsers-bP4gXehf.js';
|
|
4
|
+
export { e0 as AccessRouterPermissionMap, e1 as AccessRouterPermissions, c as AccessRouterRequest, d as AccessRouterRequestExtensions, l as AjvErrorObjectLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, s as AuthorizedListResult, t as AuthorizedSingleResult, H as CreateAuthorization, N as DataFieldOptions, a7 as DocumentAuthorization, ad as FieldAuthorization, ae as FieldOperationAccess, ap as GlobalPermissionValue, ar as HydrationMode, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aG as MaybePromise, aH as ModelBaseFilterHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aM as ModelDocumentHook, aN as ModelHook, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, a_ as ModelVirtualDoc, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, e2 as OpenApiMethod, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, bg as PairedRouteAccess, bj as PermissionSchema, e3 as Permissions, bm as PopulatePlanningOptions, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bJ as RelatedAuthorization, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cG as SubOperationAccess, cK as SubRouteGuardOptions, cN as SubdocumentCreateAuthorization, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, e4 as defaultRuntime, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod } from './parsers-bP4gXehf.js';
|
|
5
5
|
import JsonRouter from '@web-ts-toolkit/express-json-router';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
package/index.js
CHANGED
|
@@ -48,7 +48,7 @@ function assertPublicAdmission(input, kind = "envelope") {
|
|
|
48
48
|
for (const key of privateControls) {
|
|
49
49
|
if (key in record3) {
|
|
50
50
|
throw new PublicAdmissionError(
|
|
51
|
-
`Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
51
|
+
key === "unsafeSkipListDocumentSnapshotChecks" || key === "unsafeSkipReadDocumentSnapshotChecks" ? `Unsupported public control ${path}.${key}; this unsafe flag is server model configuration only` : `Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -149,6 +149,8 @@ var init_public_admission = __esm({
|
|
|
149
149
|
"skipParsing",
|
|
150
150
|
"skipAuthorization",
|
|
151
151
|
"alreadyAuthorized",
|
|
152
|
+
"unsafeSkipListDocumentSnapshotChecks",
|
|
153
|
+
"unsafeSkipReadDocumentSnapshotChecks",
|
|
152
154
|
"operation"
|
|
153
155
|
];
|
|
154
156
|
PublicAdmissionError = class extends import_express_json_router.default.clientErrors.BadRequestError {
|
|
@@ -2842,7 +2844,9 @@ var init_runtime = __esm({
|
|
|
2842
2844
|
queryRouteSegment: "__query",
|
|
2843
2845
|
mutationRouteSegment: "__mutation",
|
|
2844
2846
|
operationAccess: false,
|
|
2845
|
-
modelPermissionPrefix: ""
|
|
2847
|
+
modelPermissionPrefix: "",
|
|
2848
|
+
unsafeSkipListDocumentSnapshotChecks: false,
|
|
2849
|
+
unsafeSkipReadDocumentSnapshotChecks: false
|
|
2846
2850
|
}).build();
|
|
2847
2851
|
this.modelOptions = {};
|
|
2848
2852
|
this.modelJsonSchemas = {};
|
|
@@ -3060,11 +3064,23 @@ var init_runtime = __esm({
|
|
|
3060
3064
|
...defaultModelOptions,
|
|
3061
3065
|
modelName
|
|
3062
3066
|
});
|
|
3067
|
+
const snapshotFlagChanged = (newValue, key, target, oldValue) => {
|
|
3068
|
+
target[key] = newValue === true;
|
|
3069
|
+
if (newValue !== true || oldValue === true) return;
|
|
3070
|
+
const operation = key === "unsafeSkipReadDocumentSnapshotChecks" ? "read" : "list";
|
|
3071
|
+
try {
|
|
3072
|
+
this.getGlobalOption("logger")?.warn?.(
|
|
3073
|
+
`UNSAFE: ${operation} document snapshot checks disabled; source mutation can leave stale authorization decisions. Restore ${key}=false after the temporary workaround.`,
|
|
3074
|
+
{ modelName }
|
|
3075
|
+
);
|
|
3076
|
+
} catch {
|
|
3077
|
+
}
|
|
3078
|
+
};
|
|
3063
3079
|
manager.onchange("permissionSchema", function(_newval, _key, target) {
|
|
3064
3080
|
refreshPermissionMetadata(target);
|
|
3065
3081
|
}).onchange("modelPermissionPrefix", function(_newval, _key, target) {
|
|
3066
3082
|
refreshPermissionMetadata(target);
|
|
3067
|
-
}).onchange("basePath", function(newval, key, target) {
|
|
3083
|
+
}).onchange("unsafeSkipListDocumentSnapshotChecks", snapshotFlagChanged).onchange("unsafeSkipReadDocumentSnapshotChecks", snapshotFlagChanged).onchange("basePath", function(newval, key, target) {
|
|
3068
3084
|
target[key] = normalizeBasePath(
|
|
3069
3085
|
modelName,
|
|
3070
3086
|
(0, import_utils17.isString)(newval) || (0, import_utils17.isNil)(newval) ? newval : void 0
|
|
@@ -3733,6 +3749,9 @@ function resolveServiceAuthorization(input) {
|
|
|
3733
3749
|
);
|
|
3734
3750
|
for (const value of Object.values(permissions)) if (value && typeof value === "object") Object.freeze(value);
|
|
3735
3751
|
Object.freeze(permissions);
|
|
3752
|
+
const readAccess = outputAccess.rowAccess;
|
|
3753
|
+
const readResponse = input.readResponse === true && (input.applicability ?? "service") === "service" && scopePath.length === 0 && outputAccess.operation === "read" && (readAccess === "read" || readAccess === "list") && outputAccess.outputAccess === readAccess && outputAccess.virtualAccess === readAccess && outputAccess.docPermissionsAccess === readAccess && (input.parent === void 0 || callRecord(input.parent).readResponse);
|
|
3754
|
+
if (readResponse && input.parent) assertAuthorizationBinding(input.parent, input.binding);
|
|
3736
3755
|
const call = Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
3737
3756
|
calls.set(call, {
|
|
3738
3757
|
binding: Object.freeze({ ...input.binding, scopePath: Object.freeze(scopePath) }),
|
|
@@ -3743,7 +3762,9 @@ function resolveServiceAuthorization(input) {
|
|
|
3743
3762
|
// normalizeFields constructs only mode strings and validated string paths.
|
|
3744
3763
|
output: Object.freeze({ access: outputAccess, catalog, outputFields: policy.outputFields }),
|
|
3745
3764
|
permissions,
|
|
3746
|
-
provenance: input.parent ? callRecord(input.parent).provenance : call
|
|
3765
|
+
provenance: input.parent ? callRecord(input.parent).provenance : call,
|
|
3766
|
+
readResponse,
|
|
3767
|
+
validateDocumentSnapshots: !(input.listResponse === true && input.parent === void 0 && (input.applicability ?? "service") === "service" && outputAccess.operation === "list" && outputAccess.rowAccess === "list" && outputAccess.outputAccess === "list" && scopePath.length === 0 && configuration.unsafeSkipListDocumentSnapshotChecks === true || readResponse && configuration.unsafeSkipReadDocumentSnapshotChecks === true)
|
|
3747
3768
|
});
|
|
3748
3769
|
return call;
|
|
3749
3770
|
}
|
|
@@ -3764,6 +3785,10 @@ function readServiceAuthorizationAccess(call, binding) {
|
|
|
3764
3785
|
assertAuthorizationBinding(call, binding);
|
|
3765
3786
|
return callRecord(call).output.access;
|
|
3766
3787
|
}
|
|
3788
|
+
function requiresDocumentSnapshotChecks(call, binding) {
|
|
3789
|
+
assertAuthorizationBinding(call, binding);
|
|
3790
|
+
return callRecord(call).validateDocumentSnapshots;
|
|
3791
|
+
}
|
|
3767
3792
|
function readServiceAuthorizationHydration(call, binding) {
|
|
3768
3793
|
assertAuthorizationBinding(call, binding);
|
|
3769
3794
|
return copyAuthorizationValue({ hydration: callRecord(call).configuration.hydration }, true);
|
|
@@ -4690,6 +4715,7 @@ function lookupDocumentOwner(handle) {
|
|
|
4690
4715
|
return record3;
|
|
4691
4716
|
}
|
|
4692
4717
|
function validateStageOwner(record3) {
|
|
4718
|
+
if (!record3.validateSnapshot) return;
|
|
4693
4719
|
if (!matchesAuthorizationSnapshot(record3.input, record3.snapshot)) authorizationError("changed document snapshot");
|
|
4694
4720
|
}
|
|
4695
4721
|
function validateDocumentOwner(handle) {
|
|
@@ -4709,7 +4735,8 @@ function createDocumentAuthorizationStage(call, binding, projectedSnapshot) {
|
|
|
4709
4735
|
call,
|
|
4710
4736
|
binding: ownedBinding,
|
|
4711
4737
|
input: projectedSnapshot,
|
|
4712
|
-
snapshot
|
|
4738
|
+
snapshot,
|
|
4739
|
+
validateSnapshot: requiresDocumentSnapshotChecks(call, binding)
|
|
4713
4740
|
});
|
|
4714
4741
|
return stage;
|
|
4715
4742
|
}
|
|
@@ -4717,7 +4744,7 @@ function assertDocumentAuthorizationStage(stage, call, binding, projectedSnapsho
|
|
|
4717
4744
|
const record3 = lookupStageOwner(stage);
|
|
4718
4745
|
validateStageOwner(record3);
|
|
4719
4746
|
assertAuthorizationBinding(record3.call, binding);
|
|
4720
|
-
if (record3.call !== call || record3.input !== projectedSnapshot || !matchesAuthorizationSnapshot(projectedSnapshot, record3.snapshot)) {
|
|
4747
|
+
if (record3.call !== call || record3.input !== projectedSnapshot || record3.validateSnapshot && !matchesAuthorizationSnapshot(projectedSnapshot, record3.snapshot)) {
|
|
4721
4748
|
authorizationError("document call/stage/snapshot mismatch");
|
|
4722
4749
|
}
|
|
4723
4750
|
}
|
|
@@ -5159,6 +5186,8 @@ function captureModelAuthorizationConfiguration(runtime, modelName, options = ru
|
|
|
5159
5186
|
exposedDocPermissionKeys: options.exposedDocPermissionKeys,
|
|
5160
5187
|
stripPermissionsField: options.stripPermissionsField,
|
|
5161
5188
|
disableFieldPermissions: options.disableFieldPermissions,
|
|
5189
|
+
unsafeSkipListDocumentSnapshotChecks: options.unsafeSkipListDocumentSnapshotChecks === true,
|
|
5190
|
+
unsafeSkipReadDocumentSnapshotChecks: options.unsafeSkipReadDocumentSnapshotChecks === true,
|
|
5162
5191
|
overrideFilter: options.overrideFilter,
|
|
5163
5192
|
baseFilter: options.baseFilter,
|
|
5164
5193
|
idField: options.idField,
|
|
@@ -8143,7 +8172,9 @@ function createServiceExecution(receiver, access, authorization, applicability =
|
|
|
8143
8172
|
relatedTargets,
|
|
8144
8173
|
parent,
|
|
8145
8174
|
configuration: configuration ?? registered.configuration(),
|
|
8146
|
-
requestPermissions: requestPermissions ?? registered.permissions()
|
|
8175
|
+
requestPermissions: requestPermissions ?? registered.permissions(),
|
|
8176
|
+
listResponse: access.operation === "list" && parent === void 0,
|
|
8177
|
+
readResponse: access.operation === "read" && parent === void 0
|
|
8147
8178
|
});
|
|
8148
8179
|
const execution = Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
8149
8180
|
executions.set(
|
|
@@ -8197,7 +8228,10 @@ function deriveServiceExecution(receiver, parent, access, applicability = "servi
|
|
|
8197
8228
|
relatedTargets: captured.relatedTargets,
|
|
8198
8229
|
configuration: captured.configuration,
|
|
8199
8230
|
requestPermissions: getAuthorizationPermissions(record3.authorization, record3.binding),
|
|
8200
|
-
parent: record3.authorization
|
|
8231
|
+
parent: record3.authorization,
|
|
8232
|
+
// The resolver authenticates root-read provenance and the unchanged owner tuple.
|
|
8233
|
+
// Effective list access is still a read; write branches cannot inherit this marker.
|
|
8234
|
+
readResponse: record3.access.operation === "read" && access.operation === "read"
|
|
8201
8235
|
});
|
|
8202
8236
|
const execution = Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
8203
8237
|
executions.set(
|
|
@@ -11174,6 +11208,11 @@ var Service = class extends Base {
|
|
|
11174
11208
|
["args", args],
|
|
11175
11209
|
["options", options]
|
|
11176
11210
|
]) {
|
|
11211
|
+
if (value !== null && (typeof value === "object" || typeof value === "function")) {
|
|
11212
|
+
for (const key of ["unsafeSkipListDocumentSnapshotChecks", "unsafeSkipReadDocumentSnapshotChecks"]) {
|
|
11213
|
+
if (key in value) authorizationError(`${slot}.${key} is server model configuration only`);
|
|
11214
|
+
}
|
|
11215
|
+
}
|
|
11177
11216
|
if (value !== null && (typeof value === "object" || typeof value === "function") && "authorization" in value && (slot === "args" || !authorizationOptions)) {
|
|
11178
11217
|
authorizationError(`${slot}.authorization is unsupported here; inputFields requires model mutation options`);
|
|
11179
11218
|
}
|
package/index.mjs
CHANGED
|
@@ -29,7 +29,7 @@ function assertPublicAdmission(input, kind = "envelope") {
|
|
|
29
29
|
for (const key of privateControls) {
|
|
30
30
|
if (key in record3) {
|
|
31
31
|
throw new PublicAdmissionError(
|
|
32
|
-
`Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
32
|
+
key === "unsafeSkipListDocumentSnapshotChecks" || key === "unsafeSkipReadDocumentSnapshotChecks" ? `Unsupported public control ${path}.${key}; this unsafe flag is server model configuration only` : `Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -128,6 +128,8 @@ var init_public_admission = __esm({
|
|
|
128
128
|
"skipParsing",
|
|
129
129
|
"skipAuthorization",
|
|
130
130
|
"alreadyAuthorized",
|
|
131
|
+
"unsafeSkipListDocumentSnapshotChecks",
|
|
132
|
+
"unsafeSkipReadDocumentSnapshotChecks",
|
|
131
133
|
"operation"
|
|
132
134
|
];
|
|
133
135
|
PublicAdmissionError = class extends JsonRouter.clientErrors.BadRequestError {
|
|
@@ -2833,7 +2835,9 @@ var init_runtime = __esm({
|
|
|
2833
2835
|
queryRouteSegment: "__query",
|
|
2834
2836
|
mutationRouteSegment: "__mutation",
|
|
2835
2837
|
operationAccess: false,
|
|
2836
|
-
modelPermissionPrefix: ""
|
|
2838
|
+
modelPermissionPrefix: "",
|
|
2839
|
+
unsafeSkipListDocumentSnapshotChecks: false,
|
|
2840
|
+
unsafeSkipReadDocumentSnapshotChecks: false
|
|
2837
2841
|
}).build();
|
|
2838
2842
|
this.modelOptions = {};
|
|
2839
2843
|
this.modelJsonSchemas = {};
|
|
@@ -3051,11 +3055,23 @@ var init_runtime = __esm({
|
|
|
3051
3055
|
...defaultModelOptions,
|
|
3052
3056
|
modelName
|
|
3053
3057
|
});
|
|
3058
|
+
const snapshotFlagChanged = (newValue, key, target, oldValue) => {
|
|
3059
|
+
target[key] = newValue === true;
|
|
3060
|
+
if (newValue !== true || oldValue === true) return;
|
|
3061
|
+
const operation = key === "unsafeSkipReadDocumentSnapshotChecks" ? "read" : "list";
|
|
3062
|
+
try {
|
|
3063
|
+
this.getGlobalOption("logger")?.warn?.(
|
|
3064
|
+
`UNSAFE: ${operation} document snapshot checks disabled; source mutation can leave stale authorization decisions. Restore ${key}=false after the temporary workaround.`,
|
|
3065
|
+
{ modelName }
|
|
3066
|
+
);
|
|
3067
|
+
} catch {
|
|
3068
|
+
}
|
|
3069
|
+
};
|
|
3054
3070
|
manager.onchange("permissionSchema", function(_newval, _key, target) {
|
|
3055
3071
|
refreshPermissionMetadata(target);
|
|
3056
3072
|
}).onchange("modelPermissionPrefix", function(_newval, _key, target) {
|
|
3057
3073
|
refreshPermissionMetadata(target);
|
|
3058
|
-
}).onchange("basePath", function(newval, key, target) {
|
|
3074
|
+
}).onchange("unsafeSkipListDocumentSnapshotChecks", snapshotFlagChanged).onchange("unsafeSkipReadDocumentSnapshotChecks", snapshotFlagChanged).onchange("basePath", function(newval, key, target) {
|
|
3059
3075
|
target[key] = normalizeBasePath(
|
|
3060
3076
|
modelName,
|
|
3061
3077
|
isString4(newval) || isNil2(newval) ? newval : void 0
|
|
@@ -3724,6 +3740,9 @@ function resolveServiceAuthorization(input) {
|
|
|
3724
3740
|
);
|
|
3725
3741
|
for (const value of Object.values(permissions)) if (value && typeof value === "object") Object.freeze(value);
|
|
3726
3742
|
Object.freeze(permissions);
|
|
3743
|
+
const readAccess = outputAccess.rowAccess;
|
|
3744
|
+
const readResponse = input.readResponse === true && (input.applicability ?? "service") === "service" && scopePath.length === 0 && outputAccess.operation === "read" && (readAccess === "read" || readAccess === "list") && outputAccess.outputAccess === readAccess && outputAccess.virtualAccess === readAccess && outputAccess.docPermissionsAccess === readAccess && (input.parent === void 0 || callRecord(input.parent).readResponse);
|
|
3745
|
+
if (readResponse && input.parent) assertAuthorizationBinding(input.parent, input.binding);
|
|
3727
3746
|
const call = Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
3728
3747
|
calls.set(call, {
|
|
3729
3748
|
binding: Object.freeze({ ...input.binding, scopePath: Object.freeze(scopePath) }),
|
|
@@ -3734,7 +3753,9 @@ function resolveServiceAuthorization(input) {
|
|
|
3734
3753
|
// normalizeFields constructs only mode strings and validated string paths.
|
|
3735
3754
|
output: Object.freeze({ access: outputAccess, catalog, outputFields: policy.outputFields }),
|
|
3736
3755
|
permissions,
|
|
3737
|
-
provenance: input.parent ? callRecord(input.parent).provenance : call
|
|
3756
|
+
provenance: input.parent ? callRecord(input.parent).provenance : call,
|
|
3757
|
+
readResponse,
|
|
3758
|
+
validateDocumentSnapshots: !(input.listResponse === true && input.parent === void 0 && (input.applicability ?? "service") === "service" && outputAccess.operation === "list" && outputAccess.rowAccess === "list" && outputAccess.outputAccess === "list" && scopePath.length === 0 && configuration.unsafeSkipListDocumentSnapshotChecks === true || readResponse && configuration.unsafeSkipReadDocumentSnapshotChecks === true)
|
|
3738
3759
|
});
|
|
3739
3760
|
return call;
|
|
3740
3761
|
}
|
|
@@ -3755,6 +3776,10 @@ function readServiceAuthorizationAccess(call, binding) {
|
|
|
3755
3776
|
assertAuthorizationBinding(call, binding);
|
|
3756
3777
|
return callRecord(call).output.access;
|
|
3757
3778
|
}
|
|
3779
|
+
function requiresDocumentSnapshotChecks(call, binding) {
|
|
3780
|
+
assertAuthorizationBinding(call, binding);
|
|
3781
|
+
return callRecord(call).validateDocumentSnapshots;
|
|
3782
|
+
}
|
|
3758
3783
|
function readServiceAuthorizationHydration(call, binding) {
|
|
3759
3784
|
assertAuthorizationBinding(call, binding);
|
|
3760
3785
|
return copyAuthorizationValue({ hydration: callRecord(call).configuration.hydration }, true);
|
|
@@ -4683,6 +4708,7 @@ function lookupDocumentOwner(handle) {
|
|
|
4683
4708
|
return record3;
|
|
4684
4709
|
}
|
|
4685
4710
|
function validateStageOwner(record3) {
|
|
4711
|
+
if (!record3.validateSnapshot) return;
|
|
4686
4712
|
if (!matchesAuthorizationSnapshot(record3.input, record3.snapshot)) authorizationError("changed document snapshot");
|
|
4687
4713
|
}
|
|
4688
4714
|
function validateDocumentOwner(handle) {
|
|
@@ -4702,7 +4728,8 @@ function createDocumentAuthorizationStage(call, binding, projectedSnapshot) {
|
|
|
4702
4728
|
call,
|
|
4703
4729
|
binding: ownedBinding,
|
|
4704
4730
|
input: projectedSnapshot,
|
|
4705
|
-
snapshot
|
|
4731
|
+
snapshot,
|
|
4732
|
+
validateSnapshot: requiresDocumentSnapshotChecks(call, binding)
|
|
4706
4733
|
});
|
|
4707
4734
|
return stage;
|
|
4708
4735
|
}
|
|
@@ -4710,7 +4737,7 @@ function assertDocumentAuthorizationStage(stage, call, binding, projectedSnapsho
|
|
|
4710
4737
|
const record3 = lookupStageOwner(stage);
|
|
4711
4738
|
validateStageOwner(record3);
|
|
4712
4739
|
assertAuthorizationBinding(record3.call, binding);
|
|
4713
|
-
if (record3.call !== call || record3.input !== projectedSnapshot || !matchesAuthorizationSnapshot(projectedSnapshot, record3.snapshot)) {
|
|
4740
|
+
if (record3.call !== call || record3.input !== projectedSnapshot || record3.validateSnapshot && !matchesAuthorizationSnapshot(projectedSnapshot, record3.snapshot)) {
|
|
4714
4741
|
authorizationError("document call/stage/snapshot mismatch");
|
|
4715
4742
|
}
|
|
4716
4743
|
}
|
|
@@ -5151,6 +5178,8 @@ function captureModelAuthorizationConfiguration(runtime, modelName, options = ru
|
|
|
5151
5178
|
exposedDocPermissionKeys: options.exposedDocPermissionKeys,
|
|
5152
5179
|
stripPermissionsField: options.stripPermissionsField,
|
|
5153
5180
|
disableFieldPermissions: options.disableFieldPermissions,
|
|
5181
|
+
unsafeSkipListDocumentSnapshotChecks: options.unsafeSkipListDocumentSnapshotChecks === true,
|
|
5182
|
+
unsafeSkipReadDocumentSnapshotChecks: options.unsafeSkipReadDocumentSnapshotChecks === true,
|
|
5154
5183
|
overrideFilter: options.overrideFilter,
|
|
5155
5184
|
baseFilter: options.baseFilter,
|
|
5156
5185
|
idField: options.idField,
|
|
@@ -8115,7 +8144,9 @@ function createServiceExecution(receiver, access, authorization, applicability =
|
|
|
8115
8144
|
relatedTargets,
|
|
8116
8145
|
parent,
|
|
8117
8146
|
configuration: configuration ?? registered.configuration(),
|
|
8118
|
-
requestPermissions: requestPermissions ?? registered.permissions()
|
|
8147
|
+
requestPermissions: requestPermissions ?? registered.permissions(),
|
|
8148
|
+
listResponse: access.operation === "list" && parent === void 0,
|
|
8149
|
+
readResponse: access.operation === "read" && parent === void 0
|
|
8119
8150
|
});
|
|
8120
8151
|
const execution = Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
8121
8152
|
executions.set(
|
|
@@ -8169,7 +8200,10 @@ function deriveServiceExecution(receiver, parent, access, applicability = "servi
|
|
|
8169
8200
|
relatedTargets: captured.relatedTargets,
|
|
8170
8201
|
configuration: captured.configuration,
|
|
8171
8202
|
requestPermissions: getAuthorizationPermissions(record3.authorization, record3.binding),
|
|
8172
|
-
parent: record3.authorization
|
|
8203
|
+
parent: record3.authorization,
|
|
8204
|
+
// The resolver authenticates root-read provenance and the unchanged owner tuple.
|
|
8205
|
+
// Effective list access is still a read; write branches cannot inherit this marker.
|
|
8206
|
+
readResponse: record3.access.operation === "read" && access.operation === "read"
|
|
8173
8207
|
});
|
|
8174
8208
|
const execution = Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
8175
8209
|
executions.set(
|
|
@@ -11158,6 +11192,11 @@ var Service = class extends Base {
|
|
|
11158
11192
|
["args", args],
|
|
11159
11193
|
["options", options]
|
|
11160
11194
|
]) {
|
|
11195
|
+
if (value !== null && (typeof value === "object" || typeof value === "function")) {
|
|
11196
|
+
for (const key of ["unsafeSkipListDocumentSnapshotChecks", "unsafeSkipReadDocumentSnapshotChecks"]) {
|
|
11197
|
+
if (key in value) authorizationError(`${slot}.${key} is server model configuration only`);
|
|
11198
|
+
}
|
|
11199
|
+
}
|
|
11161
11200
|
if (value !== null && (typeof value === "object" || typeof value === "function") && "authorization" in value && (slot === "args" || !authorizationOptions)) {
|
|
11162
11201
|
authorizationError(`${slot}.authorization is unsupported here; inputFields requires model mutation options`);
|
|
11163
11202
|
}
|
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.60.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.
|
|
61
|
-
"@web-ts-toolkit/utils": "0.
|
|
60
|
+
"@web-ts-toolkit/express-json-router": "0.60.0",
|
|
61
|
+
"@web-ts-toolkit/utils": "0.60.0",
|
|
62
62
|
"just-diff": "^6.0.2",
|
|
63
63
|
"mongoose-schema-jsonschema": "^4.0.1",
|
|
64
64
|
"sift": "^17.1.3",
|
|
@@ -1022,6 +1022,10 @@ declare const documentAuthorizationBrand: unique symbol;
|
|
|
1022
1022
|
* and permission metadata are trimmed. Use the original unchanged output or a
|
|
1023
1023
|
* package-created helper subset; caller spreads, matching IDs, changed values, another
|
|
1024
1024
|
* row/call/access or pre-/post-write stages cannot establish validity and reject.
|
|
1025
|
+
* A list/read handle with its server unsafeSkipListDocumentSnapshotChecks or
|
|
1026
|
+
* unsafeSkipReadDocumentSnapshotChecks flag enabled retains that weakened source-
|
|
1027
|
+
* mutation policy; output mutation/ownership checks still apply. Turning a setting
|
|
1028
|
+
* off affects new calls, not an existing handle or captured read-to-list retry.
|
|
1025
1029
|
*/
|
|
1026
1030
|
interface DocumentAuthorization {
|
|
1027
1031
|
readonly [documentAuthorizationBrand]: true;
|
|
@@ -1155,6 +1159,9 @@ interface AuthorizationFieldCatalog {
|
|
|
1155
1159
|
}
|
|
1156
1160
|
interface AuthorizationConfiguration {
|
|
1157
1161
|
readonly catalog: AuthorizationFieldCatalog;
|
|
1162
|
+
/** Captured server model option; alone it never issues relaxed document authority. */
|
|
1163
|
+
readonly unsafeSkipListDocumentSnapshotChecks?: boolean;
|
|
1164
|
+
readonly unsafeSkipReadDocumentSnapshotChecks?: boolean;
|
|
1158
1165
|
/** Opaque terminal private-input capture. Never related authority or public document metadata. */
|
|
1159
1166
|
readonly virtualPopulateSnapshot?: VirtualPopulateSnapshotToken;
|
|
1160
1167
|
/** Runtime-owned private input admission mode, not public output/related authority. */
|
|
@@ -3438,6 +3445,37 @@ interface DefaultModelRouterOptions<TModel = unknown> {
|
|
|
3438
3445
|
* `includePermissions`. Defaults to `false`.
|
|
3439
3446
|
*/
|
|
3440
3447
|
disableFieldPermissions?: boolean;
|
|
3448
|
+
/**
|
|
3449
|
+
* TEMPORARY UNSAFE performance escape hatch (default `false`). Only literal `true`
|
|
3450
|
+
* skips repeated projected-document snapshot comparisons for this model's top-level
|
|
3451
|
+
* `find`/public/root list responses. Captured before awaits; list-origin handles keep
|
|
3452
|
+
* that mode. Single reads use the independent unsafeSkipReadDocumentSnapshotChecks
|
|
3453
|
+
* setting. Writes, embedded/related stages and fresh standalone helpers stay strict.
|
|
3454
|
+
*
|
|
3455
|
+
* Row/field permissions, exact ownership/binding, output provenance/mutation checks
|
|
3456
|
+
* and detached callback/grant copies still run. However, source changes during a
|
|
3457
|
+
* callback/await are no longer detected: stale grants/decisions may authorize output.
|
|
3458
|
+
* Use only with trusted non-mutating application hooks, measure before rollout, and
|
|
3459
|
+
* restore `false` as soon as possible. Enabling logs a warning once per model transition.
|
|
3460
|
+
* Server model configuration only, never service.defaults, per-call or wire options.
|
|
3461
|
+
*/
|
|
3462
|
+
unsafeSkipListDocumentSnapshotChecks?: boolean;
|
|
3463
|
+
/**
|
|
3464
|
+
* TEMPORARY UNSAFE single-read escape hatch (default `false`). Only literal `true`
|
|
3465
|
+
* skips repeated projected-document snapshot comparisons in top-level findOne,
|
|
3466
|
+
* findById, public identifier/filter reads and root reads. Read-to-list retries use
|
|
3467
|
+
* this setting, not unsafeSkipListDocumentSnapshotChecks. Captured before awaits;
|
|
3468
|
+
* read-origin handles and retries keep that mode. List operations use their own flag.
|
|
3469
|
+
*
|
|
3470
|
+
* Permission rules, exact ownership/binding, output-mutation/provenance checks and
|
|
3471
|
+
* detached callback/grant copies still run. Source changes during callbacks/awaits
|
|
3472
|
+
* can leave stale grants/decisions and incorrectly authorized output. Use only with
|
|
3473
|
+
* trusted non-mutating hooks, measure before rollout and restore `false` promptly.
|
|
3474
|
+
* Writes (including read-like output), embedded/related stages and fresh helpers
|
|
3475
|
+
* remain strict. Enabling warns once per model/flag transition. Server model or
|
|
3476
|
+
* model-starting-default configuration only; never method defaults or wire options.
|
|
3477
|
+
*/
|
|
3478
|
+
unsafeSkipReadDocumentSnapshotChecks?: boolean;
|
|
3441
3479
|
}
|
|
3442
3480
|
interface ExtendedDefaultModelRouterOptions<TModel = unknown> extends DefaultModelRouterOptions<TModel> {
|
|
3443
3481
|
'hydration.publicList'?: HydrationMode;
|
|
@@ -1022,6 +1022,10 @@ declare const documentAuthorizationBrand: unique symbol;
|
|
|
1022
1022
|
* and permission metadata are trimmed. Use the original unchanged output or a
|
|
1023
1023
|
* package-created helper subset; caller spreads, matching IDs, changed values, another
|
|
1024
1024
|
* row/call/access or pre-/post-write stages cannot establish validity and reject.
|
|
1025
|
+
* A list/read handle with its server unsafeSkipListDocumentSnapshotChecks or
|
|
1026
|
+
* unsafeSkipReadDocumentSnapshotChecks flag enabled retains that weakened source-
|
|
1027
|
+
* mutation policy; output mutation/ownership checks still apply. Turning a setting
|
|
1028
|
+
* off affects new calls, not an existing handle or captured read-to-list retry.
|
|
1025
1029
|
*/
|
|
1026
1030
|
interface DocumentAuthorization {
|
|
1027
1031
|
readonly [documentAuthorizationBrand]: true;
|
|
@@ -1155,6 +1159,9 @@ interface AuthorizationFieldCatalog {
|
|
|
1155
1159
|
}
|
|
1156
1160
|
interface AuthorizationConfiguration {
|
|
1157
1161
|
readonly catalog: AuthorizationFieldCatalog;
|
|
1162
|
+
/** Captured server model option; alone it never issues relaxed document authority. */
|
|
1163
|
+
readonly unsafeSkipListDocumentSnapshotChecks?: boolean;
|
|
1164
|
+
readonly unsafeSkipReadDocumentSnapshotChecks?: boolean;
|
|
1158
1165
|
/** Opaque terminal private-input capture. Never related authority or public document metadata. */
|
|
1159
1166
|
readonly virtualPopulateSnapshot?: VirtualPopulateSnapshotToken;
|
|
1160
1167
|
/** Runtime-owned private input admission mode, not public output/related authority. */
|
|
@@ -3438,6 +3445,37 @@ interface DefaultModelRouterOptions<TModel = unknown> {
|
|
|
3438
3445
|
* `includePermissions`. Defaults to `false`.
|
|
3439
3446
|
*/
|
|
3440
3447
|
disableFieldPermissions?: boolean;
|
|
3448
|
+
/**
|
|
3449
|
+
* TEMPORARY UNSAFE performance escape hatch (default `false`). Only literal `true`
|
|
3450
|
+
* skips repeated projected-document snapshot comparisons for this model's top-level
|
|
3451
|
+
* `find`/public/root list responses. Captured before awaits; list-origin handles keep
|
|
3452
|
+
* that mode. Single reads use the independent unsafeSkipReadDocumentSnapshotChecks
|
|
3453
|
+
* setting. Writes, embedded/related stages and fresh standalone helpers stay strict.
|
|
3454
|
+
*
|
|
3455
|
+
* Row/field permissions, exact ownership/binding, output provenance/mutation checks
|
|
3456
|
+
* and detached callback/grant copies still run. However, source changes during a
|
|
3457
|
+
* callback/await are no longer detected: stale grants/decisions may authorize output.
|
|
3458
|
+
* Use only with trusted non-mutating application hooks, measure before rollout, and
|
|
3459
|
+
* restore `false` as soon as possible. Enabling logs a warning once per model transition.
|
|
3460
|
+
* Server model configuration only, never service.defaults, per-call or wire options.
|
|
3461
|
+
*/
|
|
3462
|
+
unsafeSkipListDocumentSnapshotChecks?: boolean;
|
|
3463
|
+
/**
|
|
3464
|
+
* TEMPORARY UNSAFE single-read escape hatch (default `false`). Only literal `true`
|
|
3465
|
+
* skips repeated projected-document snapshot comparisons in top-level findOne,
|
|
3466
|
+
* findById, public identifier/filter reads and root reads. Read-to-list retries use
|
|
3467
|
+
* this setting, not unsafeSkipListDocumentSnapshotChecks. Captured before awaits;
|
|
3468
|
+
* read-origin handles and retries keep that mode. List operations use their own flag.
|
|
3469
|
+
*
|
|
3470
|
+
* Permission rules, exact ownership/binding, output-mutation/provenance checks and
|
|
3471
|
+
* detached callback/grant copies still run. Source changes during callbacks/awaits
|
|
3472
|
+
* can leave stale grants/decisions and incorrectly authorized output. Use only with
|
|
3473
|
+
* trusted non-mutating hooks, measure before rollout and restore `false` promptly.
|
|
3474
|
+
* Writes (including read-like output), embedded/related stages and fresh helpers
|
|
3475
|
+
* remain strict. Enabling warns once per model/flag transition. Server model or
|
|
3476
|
+
* model-starting-default configuration only; never method defaults or wire options.
|
|
3477
|
+
*/
|
|
3478
|
+
unsafeSkipReadDocumentSnapshotChecks?: boolean;
|
|
3441
3479
|
}
|
|
3442
3480
|
interface ExtendedDefaultModelRouterOptions<TModel = unknown> extends DefaultModelRouterOptions<TModel> {
|
|
3443
3481
|
'hydration.publicList'?: HydrationMode;
|