@web-ts-toolkit/access-router 0.66.0 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +342 -30
- package/README.md +273 -137
- package/advanced.d.mts +1 -1
- package/advanced.d.ts +1 -1
- package/advanced.js +291 -59
- package/advanced.mjs +291 -59
- package/index.d.mts +26 -23
- package/index.d.ts +26 -23
- package/index.js +755 -409
- package/index.mjs +784 -441
- package/llms.txt +3 -1
- package/package.json +4 -4
- package/{parsers-BiFHfrNd.d.mts → parsers-fSBARZSn.d.mts} +245 -170
- package/{parsers-BiFHfrNd.d.ts → parsers-fSBARZSn.d.ts} +245 -170
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 AuthorizationMode, t as AuthorizedListResult, u as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, v as Codes, w as CorrelatedCountInclude, x as CorrelatedFilter, y as CorrelatedInclude, z as CorrelatedIncludeArgs, D as CorrelatedListInclude, E as CorrelatedReadByFilterInclude, F as CorrelatedReadByIdInclude, G as CountBody, H as CreateArgs, I as CreateAuthorization, J as CreateOptions, K as CreateQueryInput, L as CustomHeaders, M as DATA_MIDDLEWARE, N as DataBaseFilterHook, O as DataFieldOptions, P as DataFilter, Q as DataFindArgs, R as DataFindOneArgs, S as DataFindOneOptions, T as DataFindOptions, U as DataHook, V as DataHookContext, W as DataIdentifierHook, X as DataListHook, Y as DataOverrideFilterHook, Z as DataRequest, _ as DataRequestSchemas, $ as DataRouterOptions, a0 as DecorateAccess, a1 as DecorateAllAccess, a2 as DeepFieldPath, a3 as DefaultModelRouterOptions, a4 as Defaults, a5 as DistinctArgs, a6 as DistinctBody, a7 as DocPermissionsAccess, a8 as DocumentGrants, a9 as ErrorResult, aa as ExistsOptions, ab as ExtendedDataRouterOptions, ac as ExtendedDefaultModelRouterOptions, ad as ExtendedModelRouterOptions, ae as FieldAuthorization, af as FieldOperationAccess, ag as FieldPermissionHook, ah as FieldValidation, ai as Filter, aj as FilterOperator, ak as FilteredOutput, al as FindAccess, am as FindArgs, an as FindByIdArgs, ao as FindByIdOptions, ap as FindOneArgs, aq as FindOneOptions, ar as FindOptions, as as GlobalOptions, at as GlobalPermissionValue, au as GuardHook, av as HydrationMode, aw as IdentifierHook, ax as Include, ay as InputFieldAuthorization, az as InputFieldPath, aA as IoTsContextEntryLike, aB as IoTsDecodeErrorLike, aC as IoTsDecoderLike, aD as JoiSchemaLike, aE as JoiValidationErrorDetailLike, aF as KeyValueProjection, aG as LegacyInclude, aH as ListQueryInput, aI as ListResult, aJ as MIDDLEWARE, aK as MaybePromise, aL as ModelBaseFilterHook, aM as ModelChangeHook, aN as ModelDeleteHook, aO as
|
|
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 AuthorizationMode, t as AuthorizedListResult, u as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, v as Codes, w as CorrelatedCountInclude, x as CorrelatedFilter, y as CorrelatedInclude, z as CorrelatedIncludeArgs, D as CorrelatedListInclude, E as CorrelatedReadByFilterInclude, F as CorrelatedReadByIdInclude, G as CountBody, H as CreateArgs, I as CreateAuthorization, J as CreateOptions, K as CreateQueryInput, L as CustomHeaders, M as DATA_MIDDLEWARE, N as DataBaseFilterHook, O as DataFieldOptions, P as DataFilter, Q as DataFindArgs, R as DataFindOneArgs, S as DataFindOneOptions, T as DataFindOptions, U as DataHook, V as DataHookContext, W as DataIdentifierHook, X as DataListHook, Y as DataOverrideFilterHook, Z as DataRequest, _ as DataRequestSchemas, $ as DataRouterOptions, a0 as DecorateAccess, a1 as DecorateAllAccess, a2 as DeepFieldPath, a3 as DefaultModelRouterOptions, a4 as Defaults, a5 as DistinctArgs, a6 as DistinctBody, a7 as DocPermissionsAccess, a8 as DocumentGrants, a9 as ErrorResult, aa as ExistsOptions, ab as ExtendedDataRouterOptions, ac as ExtendedDefaultModelRouterOptions, ad as ExtendedModelRouterOptions, ae as FieldAuthorization, af as FieldOperationAccess, ag as FieldPermissionHook, ah as FieldValidation, ai as Filter, aj as FilterOperator, ak as FilteredOutput, al as FindAccess, am as FindArgs, an as FindByIdArgs, ao as FindByIdOptions, ap as FindOneArgs, aq as FindOneOptions, ar as FindOptions, as as GlobalOptions, at as GlobalPermissionValue, au as GuardHook, av as HydrationMode, aw as IdentifierHook, ax as Include, ay as InputFieldAuthorization, az as InputFieldPath, aA as IoTsContextEntryLike, aB as IoTsDecodeErrorLike, aC as IoTsDecoderLike, aD as JoiSchemaLike, aE as JoiValidationErrorDetailLike, aF as KeyValueProjection, aG as LegacyInclude, aH as ListQueryInput, aI as ListResult, aJ as MIDDLEWARE, aK as MaybePromise, aL as ModelBaseFilterHook, aM as ModelChangeHook, aN as ModelDeleteHook, aO as ModelDocPermissionsAccessRecord, aP as ModelDocPermissionsDefinition, aQ as ModelDocPermissionsDescriptor, aR as ModelDocPermissionsHook, aS as ModelDocument, aT as ModelDocumentHook, aU as ModelHook, aV as ModelHookContext, aW as ModelHydrationOptions, aX as ModelIdentifierHook, aY as ModelListHook, aZ as ModelOutputContext, a_ as ModelOutputHook, a$ as ModelOutputListHook, b0 as ModelOverrideFilterHook, b1 as ModelRequest, b2 as ModelRouterOptions, b3 as ModelValidateHook, b4 as ModelVirtualAccess, b5 as ModelVirtualAccessRecord, b6 as ModelVirtualContext, b7 as ModelVirtualDescriptor, b8 as ModelVirtualDoc, b9 as ModelVirtualGetter, ba as ModelVirtualLeaf, bb as ModelVirtualPopulateDependency, bc as ModelVirtualPopulateInputs, bd as ModelVirtualRecordAccess, be as ModelVirtuals, bf as MutationAuthorization, bg as NewArgs, bh as NewOptions, bi as OperationAccess, bj as OperationAccessContext, bk as OperationAccessPaths, bl as OperationAccessRule, bm as OperationAccessSetter, bn as OperationAccessVariants, bo as OperationAuthorization, bp as OutputAuthorization, bq as OutputFieldOptions, br as OutputFieldPath, bs as OutputPlanningOptions, bt as PERMISSIONS, bu as PERMISSION_KEYS, bv as PairedRouteAccess, bw as ParentRef, bx as PathValue, by as PermissionSchema, bz as Populate, bA as PopulateAccess, bB as PopulatePlanningOptions, bC as PrepareAccess, bD as Projection, bE as PublicCreateArgs, bF as PublicCreateOptions, bG as PublicErrorResult, bH as PublicListArgs, bI as PublicListOptions, bJ as PublicListResult, bK as PublicOutput, bL as PublicReadArgs, bM as PublicReadOptions, bN as PublicServiceResult, bO as PublicSingleResult, bP as PublicSubdocumentCreateOptions, bQ as PublicSubdocumentListOptions, bR as PublicSubdocumentMutationOptions, bS as PublicSubdocumentReadOptions, bT as PublicUpdateArgs, bU as PublicUpdateOptions, bV as PublicUpsertArgs, bW as PublicUpsertOptions, bX as ReadQueryInput, bY as RelatedAuthorization, bZ as Request, b_ as RequestSchemaAdapter, b$ as RequestSchemaFailure, c0 as RequestSchemaIssue, c1 as RequestSchemaLike, c2 as RequestSchemaOptions, c3 as RequestSchemaResult, c4 as RequestSchemaSuccess, c5 as RequestSchemaValidator, c6 as RequestSchemas, c7 as RootDataListQueryEntry, c8 as RootDataOperation, c9 as RootDataReadByFilterQueryEntry, ca as RootDataReadByIdQueryEntry, cb as RootModelCountQueryEntry, cc as RootModelCreateQueryEntry, cd as RootModelDeleteQueryEntry, ce as RootModelDistinctQueryEntry, cf as RootModelListQueryEntry, cg as RootModelNewQueryEntry, ch as RootModelOperation, ci as RootModelReadByFilterQueryEntry, cj as RootModelReadByIdQueryEntry, ck as RootModelSubBulkUpdateQueryEntry, cl as RootModelSubCreateQueryEntry, cm as RootModelSubDeleteQueryEntry, cn as RootModelSubListQueryEntry, co as RootModelSubReadQueryEntry, cp as RootModelSubUpdateQueryEntry, cq as RootModelUpdateQueryEntry, cr as RootModelUpsertQueryEntry, cs as RootOperationResult, ct as RootQueryEntry, cu as RootRouterOptions, cv as RootSubOperation, cw as RootTarget, cx as RouteBaseAccess, cy as RouteGuardAccess, cz as RouteVariant, cA as RowAuthorization, cB as SelectAccess, cC as SelectedPopulatedPublicOutput, cD as SelectedPublicOutput, cE as ServiceAuthorization, cF as ServiceOutputContext, cG as ServiceOutputDecorator, cH as ServiceResult, cI as SingleResult, cJ as Sort, cK as SortOrder, cL as StandardSchemaFailure, cM as StandardSchemaInferOutput, cN as StandardSchemaIssue, cO as StandardSchemaPathSegment, cP as StandardSchemaResult, cQ as StandardSchemaSuccess, cR as StandardSchemaV1, cS as StatusCodes, cT as SubListBody, cU as SubOperationAccess, cV as SubPopulate, cW as SubQueryEntry, cX as SubReadBody, cY as SubRouteGuardOptions, cZ as SubdocumentBulkRecord, c_ as SubdocumentBulkUpdateInput, c$ as SubdocumentCreateAuthorization, d0 as SubdocumentCreateInput, d1 as SubdocumentCreateOptions, d2 as SubdocumentCreateVisibilityAuthorization, d3 as SubdocumentDeleteAuthorization, d4 as SubdocumentDeleteOptions, d5 as SubdocumentGateAuthorization, d6 as SubdocumentId, d7 as SubdocumentInputAuthorization, d8 as SubdocumentListOptions, d9 as SubdocumentModel, da as SubdocumentMutationAuthorization, db as SubdocumentName, dc as SubdocumentOutputAuthorization, dd as SubdocumentParentArgs, de as SubdocumentParentOptions, df as SubdocumentReadAuthorization, dg as SubdocumentReadOptions, dh as SubdocumentRecord, di as SubdocumentUpdateOptions, dj as SubdocumentVirtuals, dk as SubdocumentVisibilityAuthorization, dl as SuperstructFailureLike, dm as SuperstructValidateLike, dn as Task, dp as TaskType, dq as TransformAccess, dr as TypedFilter, ds as UpdateByIdArgs, dt as UpdateByIdOptions, du as UpdateOneArgs, dv as UpdateOneOptions, dw as UpdateQueryInput, dx as UpsertArgs, dy as UpsertOptions, dz as UpsertQueryInput, dA as ValibotIssueLike, dB as ValibotPathItemLike, dC as ValibotSafeParseLike, dD as ValibotSafeParseResult, dE as ValidateAccess, dF as ValidateRule, dG as Validation, dH as ValidationError, dI as VineValidationErrorLike, dJ as VineValidationMessageLike, dK as VineValidatorLike, dL as VirtualSubModel, dM as WithVirtuals, dN as YupSchemaLike, dO as YupValidationErrorLike, dP as defineRequestSchema, dQ as fromAjv, dR as fromArkType, dS as fromIoTs, dT as fromJoi, dU as fromStandardSchema, dV as fromSuperstruct, dW as fromValibot, dX as fromVine, dY as fromYup, dZ as fromZod, d_ as parseBody, d$ as parseBodyWithSchema, e0 as parseNestedBodyWithSchema, e1 as parsePathParam, e2 as parseQuery } from './parsers-fSBARZSn.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 AuthorizationMode, t as AuthorizedListResult, u as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, v as Codes, w as CorrelatedCountInclude, x as CorrelatedFilter, y as CorrelatedInclude, z as CorrelatedIncludeArgs, D as CorrelatedListInclude, E as CorrelatedReadByFilterInclude, F as CorrelatedReadByIdInclude, G as CountBody, H as CreateArgs, I as CreateAuthorization, J as CreateOptions, K as CreateQueryInput, L as CustomHeaders, M as DATA_MIDDLEWARE, N as DataBaseFilterHook, O as DataFieldOptions, P as DataFilter, Q as DataFindArgs, R as DataFindOneArgs, S as DataFindOneOptions, T as DataFindOptions, U as DataHook, V as DataHookContext, W as DataIdentifierHook, X as DataListHook, Y as DataOverrideFilterHook, Z as DataRequest, _ as DataRequestSchemas, $ as DataRouterOptions, a0 as DecorateAccess, a1 as DecorateAllAccess, a2 as DeepFieldPath, a3 as DefaultModelRouterOptions, a4 as Defaults, a5 as DistinctArgs, a6 as DistinctBody, a7 as DocPermissionsAccess, a8 as DocumentGrants, a9 as ErrorResult, aa as ExistsOptions, ab as ExtendedDataRouterOptions, ac as ExtendedDefaultModelRouterOptions, ad as ExtendedModelRouterOptions, ae as FieldAuthorization, af as FieldOperationAccess, ag as FieldPermissionHook, ah as FieldValidation, ai as Filter, aj as FilterOperator, ak as FilteredOutput, al as FindAccess, am as FindArgs, an as FindByIdArgs, ao as FindByIdOptions, ap as FindOneArgs, aq as FindOneOptions, ar as FindOptions, as as GlobalOptions, at as GlobalPermissionValue, au as GuardHook, av as HydrationMode, aw as IdentifierHook, ax as Include, ay as InputFieldAuthorization, az as InputFieldPath, aA as IoTsContextEntryLike, aB as IoTsDecodeErrorLike, aC as IoTsDecoderLike, aD as JoiSchemaLike, aE as JoiValidationErrorDetailLike, aF as KeyValueProjection, aG as LegacyInclude, aH as ListQueryInput, aI as ListResult, aJ as MIDDLEWARE, aK as MaybePromise, aL as ModelBaseFilterHook, aM as ModelChangeHook, aN as ModelDeleteHook, aO as
|
|
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 AuthorizationMode, t as AuthorizedListResult, u as AuthorizedSingleResult, B as BaseFilterAccess, C as Change, v as Codes, w as CorrelatedCountInclude, x as CorrelatedFilter, y as CorrelatedInclude, z as CorrelatedIncludeArgs, D as CorrelatedListInclude, E as CorrelatedReadByFilterInclude, F as CorrelatedReadByIdInclude, G as CountBody, H as CreateArgs, I as CreateAuthorization, J as CreateOptions, K as CreateQueryInput, L as CustomHeaders, M as DATA_MIDDLEWARE, N as DataBaseFilterHook, O as DataFieldOptions, P as DataFilter, Q as DataFindArgs, R as DataFindOneArgs, S as DataFindOneOptions, T as DataFindOptions, U as DataHook, V as DataHookContext, W as DataIdentifierHook, X as DataListHook, Y as DataOverrideFilterHook, Z as DataRequest, _ as DataRequestSchemas, $ as DataRouterOptions, a0 as DecorateAccess, a1 as DecorateAllAccess, a2 as DeepFieldPath, a3 as DefaultModelRouterOptions, a4 as Defaults, a5 as DistinctArgs, a6 as DistinctBody, a7 as DocPermissionsAccess, a8 as DocumentGrants, a9 as ErrorResult, aa as ExistsOptions, ab as ExtendedDataRouterOptions, ac as ExtendedDefaultModelRouterOptions, ad as ExtendedModelRouterOptions, ae as FieldAuthorization, af as FieldOperationAccess, ag as FieldPermissionHook, ah as FieldValidation, ai as Filter, aj as FilterOperator, ak as FilteredOutput, al as FindAccess, am as FindArgs, an as FindByIdArgs, ao as FindByIdOptions, ap as FindOneArgs, aq as FindOneOptions, ar as FindOptions, as as GlobalOptions, at as GlobalPermissionValue, au as GuardHook, av as HydrationMode, aw as IdentifierHook, ax as Include, ay as InputFieldAuthorization, az as InputFieldPath, aA as IoTsContextEntryLike, aB as IoTsDecodeErrorLike, aC as IoTsDecoderLike, aD as JoiSchemaLike, aE as JoiValidationErrorDetailLike, aF as KeyValueProjection, aG as LegacyInclude, aH as ListQueryInput, aI as ListResult, aJ as MIDDLEWARE, aK as MaybePromise, aL as ModelBaseFilterHook, aM as ModelChangeHook, aN as ModelDeleteHook, aO as ModelDocPermissionsAccessRecord, aP as ModelDocPermissionsDefinition, aQ as ModelDocPermissionsDescriptor, aR as ModelDocPermissionsHook, aS as ModelDocument, aT as ModelDocumentHook, aU as ModelHook, aV as ModelHookContext, aW as ModelHydrationOptions, aX as ModelIdentifierHook, aY as ModelListHook, aZ as ModelOutputContext, a_ as ModelOutputHook, a$ as ModelOutputListHook, b0 as ModelOverrideFilterHook, b1 as ModelRequest, b2 as ModelRouterOptions, b3 as ModelValidateHook, b4 as ModelVirtualAccess, b5 as ModelVirtualAccessRecord, b6 as ModelVirtualContext, b7 as ModelVirtualDescriptor, b8 as ModelVirtualDoc, b9 as ModelVirtualGetter, ba as ModelVirtualLeaf, bb as ModelVirtualPopulateDependency, bc as ModelVirtualPopulateInputs, bd as ModelVirtualRecordAccess, be as ModelVirtuals, bf as MutationAuthorization, bg as NewArgs, bh as NewOptions, bi as OperationAccess, bj as OperationAccessContext, bk as OperationAccessPaths, bl as OperationAccessRule, bm as OperationAccessSetter, bn as OperationAccessVariants, bo as OperationAuthorization, bp as OutputAuthorization, bq as OutputFieldOptions, br as OutputFieldPath, bs as OutputPlanningOptions, bt as PERMISSIONS, bu as PERMISSION_KEYS, bv as PairedRouteAccess, bw as ParentRef, bx as PathValue, by as PermissionSchema, bz as Populate, bA as PopulateAccess, bB as PopulatePlanningOptions, bC as PrepareAccess, bD as Projection, bE as PublicCreateArgs, bF as PublicCreateOptions, bG as PublicErrorResult, bH as PublicListArgs, bI as PublicListOptions, bJ as PublicListResult, bK as PublicOutput, bL as PublicReadArgs, bM as PublicReadOptions, bN as PublicServiceResult, bO as PublicSingleResult, bP as PublicSubdocumentCreateOptions, bQ as PublicSubdocumentListOptions, bR as PublicSubdocumentMutationOptions, bS as PublicSubdocumentReadOptions, bT as PublicUpdateArgs, bU as PublicUpdateOptions, bV as PublicUpsertArgs, bW as PublicUpsertOptions, bX as ReadQueryInput, bY as RelatedAuthorization, bZ as Request, b_ as RequestSchemaAdapter, b$ as RequestSchemaFailure, c0 as RequestSchemaIssue, c1 as RequestSchemaLike, c2 as RequestSchemaOptions, c3 as RequestSchemaResult, c4 as RequestSchemaSuccess, c5 as RequestSchemaValidator, c6 as RequestSchemas, c7 as RootDataListQueryEntry, c8 as RootDataOperation, c9 as RootDataReadByFilterQueryEntry, ca as RootDataReadByIdQueryEntry, cb as RootModelCountQueryEntry, cc as RootModelCreateQueryEntry, cd as RootModelDeleteQueryEntry, ce as RootModelDistinctQueryEntry, cf as RootModelListQueryEntry, cg as RootModelNewQueryEntry, ch as RootModelOperation, ci as RootModelReadByFilterQueryEntry, cj as RootModelReadByIdQueryEntry, ck as RootModelSubBulkUpdateQueryEntry, cl as RootModelSubCreateQueryEntry, cm as RootModelSubDeleteQueryEntry, cn as RootModelSubListQueryEntry, co as RootModelSubReadQueryEntry, cp as RootModelSubUpdateQueryEntry, cq as RootModelUpdateQueryEntry, cr as RootModelUpsertQueryEntry, cs as RootOperationResult, ct as RootQueryEntry, cu as RootRouterOptions, cv as RootSubOperation, cw as RootTarget, cx as RouteBaseAccess, cy as RouteGuardAccess, cz as RouteVariant, cA as RowAuthorization, cB as SelectAccess, cC as SelectedPopulatedPublicOutput, cD as SelectedPublicOutput, cE as ServiceAuthorization, cF as ServiceOutputContext, cG as ServiceOutputDecorator, cH as ServiceResult, cI as SingleResult, cJ as Sort, cK as SortOrder, cL as StandardSchemaFailure, cM as StandardSchemaInferOutput, cN as StandardSchemaIssue, cO as StandardSchemaPathSegment, cP as StandardSchemaResult, cQ as StandardSchemaSuccess, cR as StandardSchemaV1, cS as StatusCodes, cT as SubListBody, cU as SubOperationAccess, cV as SubPopulate, cW as SubQueryEntry, cX as SubReadBody, cY as SubRouteGuardOptions, cZ as SubdocumentBulkRecord, c_ as SubdocumentBulkUpdateInput, c$ as SubdocumentCreateAuthorization, d0 as SubdocumentCreateInput, d1 as SubdocumentCreateOptions, d2 as SubdocumentCreateVisibilityAuthorization, d3 as SubdocumentDeleteAuthorization, d4 as SubdocumentDeleteOptions, d5 as SubdocumentGateAuthorization, d6 as SubdocumentId, d7 as SubdocumentInputAuthorization, d8 as SubdocumentListOptions, d9 as SubdocumentModel, da as SubdocumentMutationAuthorization, db as SubdocumentName, dc as SubdocumentOutputAuthorization, dd as SubdocumentParentArgs, de as SubdocumentParentOptions, df as SubdocumentReadAuthorization, dg as SubdocumentReadOptions, dh as SubdocumentRecord, di as SubdocumentUpdateOptions, dj as SubdocumentVirtuals, dk as SubdocumentVisibilityAuthorization, dl as SuperstructFailureLike, dm as SuperstructValidateLike, dn as Task, dp as TaskType, dq as TransformAccess, dr as TypedFilter, ds as UpdateByIdArgs, dt as UpdateByIdOptions, du as UpdateOneArgs, dv as UpdateOneOptions, dw as UpdateQueryInput, dx as UpsertArgs, dy as UpsertOptions, dz as UpsertQueryInput, dA as ValibotIssueLike, dB as ValibotPathItemLike, dC as ValibotSafeParseLike, dD as ValibotSafeParseResult, dE as ValidateAccess, dF as ValidateRule, dG as Validation, dH as ValidationError, dI as VineValidationErrorLike, dJ as VineValidationMessageLike, dK as VineValidatorLike, dL as VirtualSubModel, dM as WithVirtuals, dN as YupSchemaLike, dO as YupValidationErrorLike, dP as defineRequestSchema, dQ as fromAjv, dR as fromArkType, dS as fromIoTs, dT as fromJoi, dU as fromStandardSchema, dV as fromSuperstruct, dW as fromValibot, dX as fromVine, dY as fromYup, dZ as fromZod, d_ as parseBody, d$ as parseBodyWithSchema, e0 as parseNestedBodyWithSchema, e1 as parsePathParam, e2 as parseQuery } from './parsers-fSBARZSn.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import 'mongoose';
|
|
4
4
|
import 'express';
|
package/advanced.js
CHANGED
|
@@ -1055,7 +1055,18 @@ var retiredAuthorizationOptions = [
|
|
|
1055
1055
|
"unsafeUseListAuthorizationFastPath",
|
|
1056
1056
|
"unsafeUseReadAuthorizationFastPath"
|
|
1057
1057
|
];
|
|
1058
|
-
var authorizationModeKeys = [
|
|
1058
|
+
var authorizationModeKeys = [
|
|
1059
|
+
"readAuthorizationMode",
|
|
1060
|
+
"listAuthorizationMode",
|
|
1061
|
+
"createAuthorizationMode",
|
|
1062
|
+
"updateAuthorizationMode"
|
|
1063
|
+
];
|
|
1064
|
+
var authorizationModeOperations = {
|
|
1065
|
+
readAuthorizationMode: "read",
|
|
1066
|
+
listAuthorizationMode: "list",
|
|
1067
|
+
createAuthorizationMode: "create",
|
|
1068
|
+
updateAuthorizationMode: "update"
|
|
1069
|
+
};
|
|
1059
1070
|
var serverAuthorizationControls = [...retiredAuthorizationOptions, ...authorizationModeKeys];
|
|
1060
1071
|
function authorizationControlError(key) {
|
|
1061
1072
|
return retiredAuthorizationOptions.includes(key) ? `${key} was removed; migrate to readAuthorizationMode/listAuthorizationMode on server model/default-model options` : `${key} is server model/default-model configuration only`;
|
|
@@ -2204,6 +2215,146 @@ var DataOptionsManager = class extends OptionsManager {
|
|
|
2204
2215
|
}
|
|
2205
2216
|
};
|
|
2206
2217
|
|
|
2218
|
+
// src/operation-access.ts
|
|
2219
|
+
var operations = /* @__PURE__ */ new Set(["new", "list", "read", "create", "update", "upsert", "delete", "count", "distinct"]);
|
|
2220
|
+
var subOperations = /* @__PURE__ */ new Set(["list", "read", "create", "update", "delete"]);
|
|
2221
|
+
var members = /* @__PURE__ */ new Set(["default", "basic", "advanced", "root"]);
|
|
2222
|
+
var removedAccesses = new Set(
|
|
2223
|
+
["List", "Read", "Create", "Update", "Upsert", "Count", "Distinct"].flatMap((operation) => [
|
|
2224
|
+
`basic${operation}`,
|
|
2225
|
+
`advanced${operation}`
|
|
2226
|
+
])
|
|
2227
|
+
);
|
|
2228
|
+
var isRemovedOperationAccess = (access) => typeof access === "string" && removedAccesses.has(access);
|
|
2229
|
+
function isOperationAccessMemberPath(access) {
|
|
2230
|
+
const keys2 = access.split(".");
|
|
2231
|
+
if (operations.has(keys2[0]) && members.has(keys2[1])) return true;
|
|
2232
|
+
return keys2[0] === "subs" && keys2[1] !== "" && subOperations.has(keys2[2]) && members.has(keys2[3]);
|
|
2233
|
+
}
|
|
2234
|
+
var isRecord = (value) => value !== null && typeof value === "object" && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
|
|
2235
|
+
function readOwnOption(root, key) {
|
|
2236
|
+
let value = root;
|
|
2237
|
+
for (const part of key.split(".")) {
|
|
2238
|
+
if (value === null || typeof value !== "object") return void 0;
|
|
2239
|
+
const slot = Object.getOwnPropertyDescriptor(value, part);
|
|
2240
|
+
if (!slot || !("value" in slot)) return void 0;
|
|
2241
|
+
value = slot.value;
|
|
2242
|
+
}
|
|
2243
|
+
return value;
|
|
2244
|
+
}
|
|
2245
|
+
function createOperationAccessReaders(options, defaults2) {
|
|
2246
|
+
return {
|
|
2247
|
+
readOption: (key) => readOwnOption(options, key),
|
|
2248
|
+
readDefaultOption: defaults2 === void 0 ? void 0 : (key) => readOwnOption(defaults2, key)
|
|
2249
|
+
};
|
|
2250
|
+
}
|
|
2251
|
+
var scalarGuard = (value) => {
|
|
2252
|
+
if (value === void 0) return void 0;
|
|
2253
|
+
if (typeof value === "boolean" || typeof value === "string" || typeof value === "function")
|
|
2254
|
+
return value;
|
|
2255
|
+
if (Array.isArray(value) && value.every((entry) => typeof entry === "string")) return value;
|
|
2256
|
+
return false;
|
|
2257
|
+
};
|
|
2258
|
+
function operationDefault(value) {
|
|
2259
|
+
if (!isRecord(value)) return scalarGuard(value);
|
|
2260
|
+
if (Reflect.ownKeys(value).some((key) => typeof key !== "string" || !members.has(key))) return false;
|
|
2261
|
+
return scalarGuard(readOwnOption(value, "default"));
|
|
2262
|
+
}
|
|
2263
|
+
function selectOperationAccessGuard({
|
|
2264
|
+
baseAccess,
|
|
2265
|
+
context,
|
|
2266
|
+
readOption,
|
|
2267
|
+
readDefaultOption,
|
|
2268
|
+
subdocuments = false
|
|
2269
|
+
}) {
|
|
2270
|
+
const keys2 = baseAccess.split(".");
|
|
2271
|
+
if (isRemovedOperationAccess(baseAccess) || isOperationAccessMemberPath(baseAccess) || keys2[0] === "subs" && isRemovedOperationAccess(keys2[2]))
|
|
2272
|
+
return false;
|
|
2273
|
+
if (context !== void 0 && !["basic", "advanced", "root"].includes(context)) return false;
|
|
2274
|
+
const exact = (key) => {
|
|
2275
|
+
const value = readOption(key);
|
|
2276
|
+
return value === void 0 ? readDefaultOption?.(key) : value;
|
|
2277
|
+
};
|
|
2278
|
+
const contextGuard = (key, supported) => context === void 0 || !supported ? void 0 : scalarGuard(exact(`${key}.${context}`));
|
|
2279
|
+
let access = baseAccess;
|
|
2280
|
+
if (subdocuments && keys2[0] === "subs") {
|
|
2281
|
+
if (keys2.length < 3 || keys2[1] === "") return false;
|
|
2282
|
+
const fieldKey = `operationAccess.subs.${keys2[1]}`;
|
|
2283
|
+
const operationKey2 = `operationAccess.${baseAccess}`;
|
|
2284
|
+
const selected2 = contextGuard(operationKey2, keys2.length === 3 && subOperations.has(keys2[2]));
|
|
2285
|
+
if (selected2 !== void 0) return selected2;
|
|
2286
|
+
const operation2 = exact(operationKey2);
|
|
2287
|
+
if (operation2 !== void 0) {
|
|
2288
|
+
const guard = keys2.length === 3 && subOperations.has(keys2[2]) ? operationDefault(operation2) : scalarGuard(operation2);
|
|
2289
|
+
if (guard !== void 0) return guard;
|
|
2290
|
+
}
|
|
2291
|
+
const field = exact(fieldKey);
|
|
2292
|
+
if (field !== void 0) return scalarGuard(field);
|
|
2293
|
+
access = keys2[2];
|
|
2294
|
+
}
|
|
2295
|
+
const operationKey = `operationAccess.${access}`;
|
|
2296
|
+
const selected = contextGuard(operationKey, operations.has(access));
|
|
2297
|
+
if (selected !== void 0) return selected;
|
|
2298
|
+
const operation = readOption(operationKey);
|
|
2299
|
+
if (operation !== void 0) {
|
|
2300
|
+
const guard = operations.has(access) ? operationDefault(operation) : scalarGuard(operation);
|
|
2301
|
+
if (guard !== void 0) return guard;
|
|
2302
|
+
}
|
|
2303
|
+
const outerDefault = readOption("operationAccess.default");
|
|
2304
|
+
if (outerDefault !== void 0) return scalarGuard(outerDefault);
|
|
2305
|
+
const outer = readOption("operationAccess");
|
|
2306
|
+
if (outer !== void 0) return scalarGuard(outer);
|
|
2307
|
+
const inherited = readDefaultOption?.(operationKey);
|
|
2308
|
+
return operations.has(access) ? operationDefault(inherited) : scalarGuard(inherited);
|
|
2309
|
+
}
|
|
2310
|
+
function rejectRemovedKey(key, prefix) {
|
|
2311
|
+
const context = key.startsWith("basic") ? "basic" : "advanced";
|
|
2312
|
+
const operation = key.slice(context.length);
|
|
2313
|
+
const replacement = `${operation[0].toLowerCase()}${operation.slice(1)}.${context}`;
|
|
2314
|
+
throw new TypeError(
|
|
2315
|
+
`Removed operation-access key "${prefix}${key}"; use "${prefix}${replacement}" instead. Move the operation's former scalar guard to its "default" member when using an object.`
|
|
2316
|
+
);
|
|
2317
|
+
}
|
|
2318
|
+
function assertOperationNode(node, prefix) {
|
|
2319
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) return;
|
|
2320
|
+
for (const key of removedAccesses) if (key in node) rejectRemovedKey(key, prefix);
|
|
2321
|
+
for (const key of Object.getOwnPropertyNames(node)) {
|
|
2322
|
+
const [operation] = key.split(".");
|
|
2323
|
+
if (isRemovedOperationAccess(operation)) rejectRemovedKey(operation, prefix);
|
|
2324
|
+
}
|
|
2325
|
+
}
|
|
2326
|
+
function assertOperationAccessOptions(options) {
|
|
2327
|
+
if (!options || typeof options !== "object") return;
|
|
2328
|
+
for (const key of Object.getOwnPropertyNames(options)) {
|
|
2329
|
+
if (key === "operationAccess" || key.startsWith("operationAccess.")) {
|
|
2330
|
+
assertOperationAccessUpdate(key, options[key]);
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2333
|
+
}
|
|
2334
|
+
function assertOperationAccessUpdate(key, value) {
|
|
2335
|
+
const path = key.split(".");
|
|
2336
|
+
if (path[0] !== "operationAccess") return;
|
|
2337
|
+
if (isRemovedOperationAccess(path[1])) rejectRemovedKey(path[1], "operationAccess.");
|
|
2338
|
+
if (path[1] === "subs" && path.length >= 4 && isRemovedOperationAccess(path[3]))
|
|
2339
|
+
rejectRemovedKey(path[3], `operationAccess.subs.${path[2]}.`);
|
|
2340
|
+
if (path.length === 1) {
|
|
2341
|
+
assertOperationNode(value, "operationAccess.");
|
|
2342
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2343
|
+
for (const property of Object.getOwnPropertyNames(value)) {
|
|
2344
|
+
if (property === "subs" || property.startsWith("subs."))
|
|
2345
|
+
assertOperationAccessUpdate(`operationAccess.${property}`, value[property]);
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
} else if (path.length === 2 && path[1] === "subs") {
|
|
2349
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
2350
|
+
for (const field of Object.getOwnPropertyNames(value))
|
|
2351
|
+
assertOperationAccessUpdate(`operationAccess.subs.${field}`, value[field]);
|
|
2352
|
+
}
|
|
2353
|
+
} else if (path.length === 3 && path[1] === "subs") {
|
|
2354
|
+
assertOperationNode(value, `${key}.`);
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2207
2358
|
// src/request-complexity.ts
|
|
2208
2359
|
var import_utils10 = require("@web-ts-toolkit/utils");
|
|
2209
2360
|
var defaultRequestComplexity = {
|
|
@@ -2574,7 +2725,12 @@ function captureVirtualPopulateDependencies(runtime, modelName, options, populat
|
|
|
2574
2725
|
populatePolicyDefaults,
|
|
2575
2726
|
...resolvePopulatePolicy(targetOptions, populatePolicyDefaults),
|
|
2576
2727
|
permissionSchema: targetOptions.permissionSchema,
|
|
2577
|
-
operationAccess: {
|
|
2728
|
+
operationAccess: {
|
|
2729
|
+
read: selectOperationAccessGuard({
|
|
2730
|
+
...createOperationAccessReaders(targetOptions, defaults2),
|
|
2731
|
+
baseAccess: "read"
|
|
2732
|
+
})
|
|
2733
|
+
},
|
|
2578
2734
|
baseFilter: { read: readOption("baseFilter.read") },
|
|
2579
2735
|
overrideFilter: { read: readOption("overrideFilter.read") },
|
|
2580
2736
|
hydration: targetOptions.hydration
|
|
@@ -2654,6 +2810,86 @@ function captureVirtualPopulateDependencies(runtime, modelName, options, populat
|
|
|
2654
2810
|
return Object.freeze({ scopes: Object.freeze(scopes) });
|
|
2655
2811
|
}
|
|
2656
2812
|
|
|
2813
|
+
// src/acl/document-permissions-definition.ts
|
|
2814
|
+
var import_node_util10 = require("util");
|
|
2815
|
+
|
|
2816
|
+
// src/acl/persisted-dependencies.ts
|
|
2817
|
+
var import_node_util9 = require("util");
|
|
2818
|
+
function collectPersistedTopLevel(schema) {
|
|
2819
|
+
return /* @__PURE__ */ new Set([
|
|
2820
|
+
...Object.keys(schema?.paths ?? {}).map((path) => path.split(".")[0]),
|
|
2821
|
+
...Object.keys(schema?.obj ?? {})
|
|
2822
|
+
]);
|
|
2823
|
+
}
|
|
2824
|
+
function capturePersistedDependencies(value, label, storedFields, virtualNames = /* @__PURE__ */ new Set()) {
|
|
2825
|
+
if (value === void 0) return Object.freeze([]);
|
|
2826
|
+
if (!Array.isArray(value) || import_node_util9.types.isProxy(value) || Object.getPrototypeOf(value) !== Array.prototype)
|
|
2827
|
+
throw new TypeError(`${label}: dependsOn must be an array of top-level persisted field names`);
|
|
2828
|
+
const length = Object.getOwnPropertyDescriptor(value, "length").value;
|
|
2829
|
+
if (length > 2e4 || Reflect.ownKeys(value).length !== length + 1)
|
|
2830
|
+
throw new TypeError(`${label}: dependsOn must be a dense array of persisted field names`);
|
|
2831
|
+
const result = [];
|
|
2832
|
+
for (let index = 0; index < length; index++) {
|
|
2833
|
+
const slot = Object.getOwnPropertyDescriptor(value, String(index));
|
|
2834
|
+
if (!slot || !("value" in slot) || typeof slot.value !== "string" || !slot.value)
|
|
2835
|
+
throw new TypeError(`${label}: dependsOn entries must be non-empty strings`);
|
|
2836
|
+
const dep = slot.value;
|
|
2837
|
+
if (dep.includes("."))
|
|
2838
|
+
throw new TypeError(`${label}: dependsOn "${dep}" must be a top-level persisted name (dotted paths rejected)`);
|
|
2839
|
+
if (!isSafeOutputPath(dep)) throw new TypeError(`${label}: unsafe dependsOn field "${dep}"`);
|
|
2840
|
+
if (virtualNames.has(dep)) throw new TypeError(`${label}: dependsOn "${dep}" must not reference another virtual`);
|
|
2841
|
+
if (storedFields && !storedFields.has(dep))
|
|
2842
|
+
throw new TypeError(`${label}: dependsOn "${dep}" is not a persisted field in its scope`);
|
|
2843
|
+
result.push(dep);
|
|
2844
|
+
}
|
|
2845
|
+
return Object.freeze([...new Set(result)]);
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
// src/acl/document-permissions-definition.ts
|
|
2849
|
+
function dataRecord(value, label) {
|
|
2850
|
+
if (!value || typeof value !== "object" || import_node_util10.types.isProxy(value))
|
|
2851
|
+
throw new TypeError(`${label}: expected a function, { get, dependsOn? }, or per-access record`);
|
|
2852
|
+
const prototype = Object.getPrototypeOf(value);
|
|
2853
|
+
if (prototype !== Object.prototype && prototype !== null)
|
|
2854
|
+
throw new TypeError(`${label}: definition must be a plain object`);
|
|
2855
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
2856
|
+
const keys2 = Reflect.ownKeys(value);
|
|
2857
|
+
if (keys2.length > 2e4) throw new TypeError(`${label}: too many definition entries`);
|
|
2858
|
+
for (const key of keys2) {
|
|
2859
|
+
if (typeof key !== "string" || ["__proto__", "constructor", "prototype"].includes(key))
|
|
2860
|
+
throw new TypeError(`${label}: unsafe definition key`);
|
|
2861
|
+
const slot = Object.getOwnPropertyDescriptor(value, key);
|
|
2862
|
+
if (!slot.enumerable || !("value" in slot))
|
|
2863
|
+
throw new TypeError(`${label}: definition entries must be enumerable data properties`);
|
|
2864
|
+
Object.defineProperty(result, key, { value: slot.value, enumerable: true });
|
|
2865
|
+
}
|
|
2866
|
+
return result;
|
|
2867
|
+
}
|
|
2868
|
+
function captureLeaf(value, label, scope) {
|
|
2869
|
+
if (typeof value === "function") return value;
|
|
2870
|
+
const record2 = dataRecord(value, label);
|
|
2871
|
+
if (typeof record2.get !== "function") throw new TypeError(`${label}: descriptor.get must be callable`);
|
|
2872
|
+
if (Object.keys(record2).some((key) => key !== "get" && key !== "dependsOn"))
|
|
2873
|
+
throw new TypeError(`${label}: descriptor accepts only get/dependsOn; cannot mix per-access keys`);
|
|
2874
|
+
return Object.freeze({
|
|
2875
|
+
get: record2.get,
|
|
2876
|
+
dependsOn: capturePersistedDependencies(record2.dependsOn, label, scope.storedFields, scope.virtualNames)
|
|
2877
|
+
});
|
|
2878
|
+
}
|
|
2879
|
+
function captureDocumentPermissionsDefinition(value, scope = {}) {
|
|
2880
|
+
if (value === void 0) return void 0;
|
|
2881
|
+
if (typeof value === "function") return value;
|
|
2882
|
+
const record2 = dataRecord(value, "docPermissions");
|
|
2883
|
+
if (Object.hasOwn(record2, "get") || Object.hasOwn(record2, "dependsOn"))
|
|
2884
|
+
return captureLeaf(record2, "docPermissions", scope);
|
|
2885
|
+
const entries = Object.entries(record2).map(([access, leaf]) => {
|
|
2886
|
+
if (!/^[A-Za-z_][A-Za-z0-9_$]*$/.test(access))
|
|
2887
|
+
throw new TypeError(`docPermissions: unsafe or dotted access "${access}"`);
|
|
2888
|
+
return [access, leaf === void 0 ? void 0 : captureLeaf(leaf, `docPermissions.${access}`, scope)];
|
|
2889
|
+
});
|
|
2890
|
+
return Object.freeze(Object.fromEntries(entries));
|
|
2891
|
+
}
|
|
2892
|
+
|
|
2657
2893
|
// src/runtime.ts
|
|
2658
2894
|
var mongooseJsonSchemaInitialized = false;
|
|
2659
2895
|
var ensureMongooseJsonSchemaInitialized = () => {
|
|
@@ -2664,8 +2900,7 @@ var ensureMongooseJsonSchemaInitialized = () => {
|
|
|
2664
2900
|
var pluralize = import_mongoose4.default.pluralize();
|
|
2665
2901
|
var FIELD_ACCESS_KEYS = ["list", "create", "read", "update"];
|
|
2666
2902
|
var defaultModelOptions = {
|
|
2667
|
-
basePath: null
|
|
2668
|
-
alwaysSelectFields: []
|
|
2903
|
+
basePath: null
|
|
2669
2904
|
};
|
|
2670
2905
|
var modelOverrides = (options) => {
|
|
2671
2906
|
const result = Object.fromEntries(
|
|
@@ -2763,22 +2998,7 @@ var virtualPathsOverlap = (virtualPath, permissionField) => {
|
|
|
2763
2998
|
}
|
|
2764
2999
|
return false;
|
|
2765
3000
|
};
|
|
2766
|
-
var collectStoredTopLevel =
|
|
2767
|
-
const fields = /* @__PURE__ */ new Set();
|
|
2768
|
-
if (!schema) return fields;
|
|
2769
|
-
const paths = schema.paths;
|
|
2770
|
-
if (paths) {
|
|
2771
|
-
for (const p of Object.keys(paths)) {
|
|
2772
|
-
const top = p.split(".")[0];
|
|
2773
|
-
if (top) fields.add(top);
|
|
2774
|
-
}
|
|
2775
|
-
}
|
|
2776
|
-
const obj = schema.obj;
|
|
2777
|
-
if (obj) {
|
|
2778
|
-
for (const k of Object.keys(obj)) fields.add(k);
|
|
2779
|
-
}
|
|
2780
|
-
return fields;
|
|
2781
|
-
};
|
|
3001
|
+
var collectStoredTopLevel = collectPersistedTopLevel;
|
|
2782
3002
|
var getChildSchemaForField = (parentSchema, fieldName) => {
|
|
2783
3003
|
if (!parentSchema) return null;
|
|
2784
3004
|
try {
|
|
@@ -2817,32 +3037,7 @@ var cloneModelOptionForUpdate = (value) => {
|
|
|
2817
3037
|
);
|
|
2818
3038
|
};
|
|
2819
3039
|
var validateVirtualDependsOn = (dependsOn, entryLabel, storedFields, siblingVirtualNames) => {
|
|
2820
|
-
|
|
2821
|
-
if (!(0, import_utils14.isArray)(dependsOn)) {
|
|
2822
|
-
throw new Error(`Virtual ${entryLabel}: dependsOn must be an array of top-level persisted field names`);
|
|
2823
|
-
}
|
|
2824
|
-
const list = dependsOn;
|
|
2825
|
-
for (const dep of list) {
|
|
2826
|
-
if (!(0, import_utils14.isString)(dep) || dep.length === 0) {
|
|
2827
|
-
throw new Error(`Virtual ${entryLabel}: dependsOn entries must be non-empty strings`);
|
|
2828
|
-
}
|
|
2829
|
-
if (dep.includes(".")) {
|
|
2830
|
-
throw new Error(
|
|
2831
|
-
`Virtual ${entryLabel}: dependsOn "${dep}" must be a top-level persisted name relative to its scope (dotted paths rejected)`
|
|
2832
|
-
);
|
|
2833
|
-
}
|
|
2834
|
-
if (siblingVirtualNames.has(dep)) {
|
|
2835
|
-
throw new Error(
|
|
2836
|
-
`Virtual ${entryLabel}: dependsOn "${dep}" must not reference another virtual (virtual-to-virtual rejected)`
|
|
2837
|
-
);
|
|
2838
|
-
}
|
|
2839
|
-
if (!storedFields.has(dep)) {
|
|
2840
|
-
throw new Error(
|
|
2841
|
-
`Virtual ${entryLabel}: dependsOn "${dep}" is not a persisted field in its scope (validated against the receiving Mongoose schema/child scope)`
|
|
2842
|
-
);
|
|
2843
|
-
}
|
|
2844
|
-
}
|
|
2845
|
-
return list;
|
|
3040
|
+
return [...capturePersistedDependencies(dependsOn, `Virtual ${entryLabel}`, storedFields, siblingVirtualNames)];
|
|
2846
3041
|
};
|
|
2847
3042
|
var validateVirtualLeafValue = (value, entryLabel, storedFields, siblingVirtualNames, sharedDependsOn) => {
|
|
2848
3043
|
if ((0, import_utils14.isFunction)(value)) return;
|
|
@@ -3017,6 +3212,7 @@ var AccessRuntime = class {
|
|
|
3017
3212
|
this.defaultModelOptions = new OptionsManager({
|
|
3018
3213
|
listHardLimit: DEFAULT_LIST_HARD_LIMIT,
|
|
3019
3214
|
documentPermissionField: "_permissions",
|
|
3215
|
+
disableFieldPermissions: true,
|
|
3020
3216
|
idParam: "id",
|
|
3021
3217
|
idField: "_id",
|
|
3022
3218
|
parentPath: "/",
|
|
@@ -3027,7 +3223,9 @@ var AccessRuntime = class {
|
|
|
3027
3223
|
requireOperationAccessForPopulateDependencies: true,
|
|
3028
3224
|
modelPermissionPrefix: "",
|
|
3029
3225
|
readAuthorizationMode: "isolated",
|
|
3030
|
-
listAuthorizationMode: "isolated"
|
|
3226
|
+
listAuthorizationMode: "isolated",
|
|
3227
|
+
createAuthorizationMode: "isolated",
|
|
3228
|
+
updateAuthorizationMode: "isolated"
|
|
3031
3229
|
}).build();
|
|
3032
3230
|
this.modelOptions = {};
|
|
3033
3231
|
this.modelOptionOverrides = {};
|
|
@@ -3168,15 +3366,18 @@ var AccessRuntime = class {
|
|
|
3168
3366
|
assertAuthorizationModeOptions(snapshot.globalOptions, false);
|
|
3169
3367
|
assertNoServerModelControls(snapshot.globalOptions, reject);
|
|
3170
3368
|
assertAuthorizationModeOptions(snapshot.defaultModelOptions, true);
|
|
3369
|
+
assertOperationAccessOptions(snapshot.defaultModelOptions);
|
|
3171
3370
|
assertNoServerModelControls(snapshot.defaultModelOptions, reject, "model-options");
|
|
3172
3371
|
assertPublicDefaults(snapshot.defaultModelOptions.defaults);
|
|
3173
3372
|
for (const options of [...Object.values(snapshot.modelOptions), ...Object.values(snapshot.modelOptionOverrides)]) {
|
|
3174
3373
|
assertAuthorizationModeOptions(options, true);
|
|
3374
|
+
assertOperationAccessOptions(options);
|
|
3175
3375
|
assertNoServerModelControls(options, reject, "model-options");
|
|
3176
3376
|
assertPublicDefaults(options.defaults);
|
|
3177
3377
|
}
|
|
3178
3378
|
for (const options of Object.values(snapshot.dataOptions)) {
|
|
3179
3379
|
assertAuthorizationModeOptions(options, false);
|
|
3380
|
+
assertOperationAccessOptions(options);
|
|
3180
3381
|
assertNoServerModelControls(options, reject, "data-options");
|
|
3181
3382
|
}
|
|
3182
3383
|
this.globalOptions.restore(snapshot.globalOptions);
|
|
@@ -3264,6 +3465,7 @@ var AccessRuntime = class {
|
|
|
3264
3465
|
/** Update inherited model defaults shallowly. Explicit model values and captured calls are unchanged. */
|
|
3265
3466
|
setDefaultModelOptions(options) {
|
|
3266
3467
|
assertAuthorizationModeOptions(options, true);
|
|
3468
|
+
assertOperationAccessOptions(options);
|
|
3267
3469
|
assertNoServerModelControls(
|
|
3268
3470
|
options,
|
|
3269
3471
|
(detail) => {
|
|
@@ -3285,6 +3487,7 @@ var AccessRuntime = class {
|
|
|
3285
3487
|
setDefaultModelOption(key, value) {
|
|
3286
3488
|
assertAuthorizationModeKey(key, true);
|
|
3287
3489
|
const keyStr = key;
|
|
3490
|
+
assertOperationAccessUpdate(keyStr, value);
|
|
3288
3491
|
if (authorizationModeKeys.includes(keyStr)) {
|
|
3289
3492
|
this.setDefaultModelOptions({ [keyStr]: value });
|
|
3290
3493
|
return;
|
|
@@ -3338,15 +3541,20 @@ var AccessRuntime = class {
|
|
|
3338
3541
|
return cloneOptionsSnapshot(effective);
|
|
3339
3542
|
}
|
|
3340
3543
|
validateModelOptions(modelName, options, proposed) {
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3544
|
+
assertOperationAccessOptions(options);
|
|
3545
|
+
const model = this.getModelInstance(modelName);
|
|
3546
|
+
validateVirtualsTree(model, options.virtuals, options.documentPermissionField ?? "_permissions", modelName);
|
|
3547
|
+
captureDocumentPermissionsDefinition(options.docPermissions, {
|
|
3548
|
+
storedFields: collectPersistedTopLevel(model?.schema),
|
|
3549
|
+
virtualNames: /* @__PURE__ */ new Set([
|
|
3550
|
+
...Object.keys(model?.schema.virtuals ?? {}),
|
|
3551
|
+
...Object.entries(options.virtuals ?? {}).filter(([, value]) => value !== void 0 && !isVirtualContainerValue2(value)).map(([name]) => name)
|
|
3552
|
+
])
|
|
3553
|
+
});
|
|
3347
3554
|
captureVirtualPopulateDependencies(this, modelName, options, void 0, proposed);
|
|
3348
3555
|
}
|
|
3349
3556
|
publishDefaultModelOptions(options) {
|
|
3557
|
+
assertOperationAccessOptions(options);
|
|
3350
3558
|
const next = { ...options };
|
|
3351
3559
|
const defaults2 = cloneOptionsSnapshot(next);
|
|
3352
3560
|
const models = new Map(
|
|
@@ -3379,10 +3587,10 @@ var AccessRuntime = class {
|
|
|
3379
3587
|
if (options[key] !== "trusted" || before.get(modelName)?.[key] === "trusted") continue;
|
|
3380
3588
|
try {
|
|
3381
3589
|
this.getGlobalOption("logger")?.warn?.(
|
|
3382
|
-
"Trusted authorization source mode enabled;
|
|
3590
|
+
"Trusted authorization output source mode enabled; admitted source/document-hook input may be borrowed. Write input is unchanged. Actor, policy, facts, getter views and selected output bounds remain owned.",
|
|
3383
3591
|
{
|
|
3384
3592
|
modelName,
|
|
3385
|
-
access: key
|
|
3593
|
+
access: authorizationModeOperations[key],
|
|
3386
3594
|
category: "trustedAuthorizationSource"
|
|
3387
3595
|
}
|
|
3388
3596
|
);
|
|
@@ -3434,6 +3642,7 @@ var AccessRuntime = class {
|
|
|
3434
3642
|
*/
|
|
3435
3643
|
setModelOptions(modelName, options) {
|
|
3436
3644
|
assertAuthorizationModeOptions(options, true);
|
|
3645
|
+
assertOperationAccessOptions(options);
|
|
3437
3646
|
assertNoServerModelControls(
|
|
3438
3647
|
options,
|
|
3439
3648
|
(detail) => {
|
|
@@ -3442,6 +3651,12 @@ var AccessRuntime = class {
|
|
|
3442
3651
|
"model-options"
|
|
3443
3652
|
);
|
|
3444
3653
|
assertPublicDefaults(options.defaults);
|
|
3654
|
+
if ("docPermissions" in options) {
|
|
3655
|
+
const slot = Object.getOwnPropertyDescriptor(options, "docPermissions");
|
|
3656
|
+
if (!slot || !("value" in slot) || !slot.enumerable)
|
|
3657
|
+
throw new TypeError("docPermissions must be an enumerable data property");
|
|
3658
|
+
options = { ...options, docPermissions: captureDocumentPermissionsDefinition(slot.value) };
|
|
3659
|
+
}
|
|
3445
3660
|
options = normalizePopulatePolicyOptions(options);
|
|
3446
3661
|
if ("hydration" in options) options = { ...options, hydration: normalizeHydration(options.hydration) };
|
|
3447
3662
|
const overrides = modelOverrides({ ...this.modelOptionOverrides[modelName], ...options });
|
|
@@ -3457,6 +3672,17 @@ var AccessRuntime = class {
|
|
|
3457
3672
|
setModelOption(modelName, key, value) {
|
|
3458
3673
|
assertAuthorizationModeKey(key, true);
|
|
3459
3674
|
const keyStr = key;
|
|
3675
|
+
assertOperationAccessUpdate(keyStr, value);
|
|
3676
|
+
if (keyStr === "docPermissions") {
|
|
3677
|
+
value = captureDocumentPermissionsDefinition(value);
|
|
3678
|
+
} else if (keyStr.startsWith("docPermissions.")) {
|
|
3679
|
+
const path2 = keyStr.slice("docPermissions.".length);
|
|
3680
|
+
if (path2.includes(".") || path2 === "get" || path2 === "dependsOn")
|
|
3681
|
+
throw new TypeError(
|
|
3682
|
+
"docPermissions dotted setters replace an access definition; set { get, dependsOn? } together"
|
|
3683
|
+
);
|
|
3684
|
+
captureDocumentPermissionsDefinition({ [path2]: value });
|
|
3685
|
+
}
|
|
3460
3686
|
if (keyStr === "hydration" || keyStr.startsWith("hydration.")) {
|
|
3461
3687
|
const hydration = normalizeHydrationUpdate(this.resolveModelOptions(modelName).hydration, keyStr, value);
|
|
3462
3688
|
this.setModelOptions(modelName, { hydration });
|
|
@@ -3489,7 +3715,10 @@ var AccessRuntime = class {
|
|
|
3489
3715
|
return;
|
|
3490
3716
|
}
|
|
3491
3717
|
const current = this.resolveModelOptions(modelName);
|
|
3492
|
-
const
|
|
3718
|
+
const directDocumentPermissions = root === "docPermissions" && current[root] && typeof current[root] === "object" && Object.hasOwn(current[root], "get");
|
|
3719
|
+
const nested = cloneModelOptionForUpdate(
|
|
3720
|
+
(0, import_utils14.isPlainObject)(current[root]) && !directDocumentPermissions ? current[root] : {}
|
|
3721
|
+
);
|
|
3493
3722
|
if (root === "virtuals" && value === void 0) {
|
|
3494
3723
|
const parent = path.length === 1 ? nested : (0, import_utils14.get)(nested, path.slice(0, -1));
|
|
3495
3724
|
if ((0, import_utils14.isPlainObject)(parent)) delete parent[path[path.length - 1]];
|
|
@@ -3504,8 +3733,9 @@ var AccessRuntime = class {
|
|
|
3504
3733
|
/**
|
|
3505
3734
|
* Generic stored exact → parent.default → parent lookup; only undefined falls through.
|
|
3506
3735
|
* The exact runtime-model-default path is the final fallback if the stored parent is
|
|
3507
|
-
* absent. This is not the
|
|
3508
|
-
*
|
|
3736
|
+
* absent. This raw generic lookup is not the final nested operation-entry resolver;
|
|
3737
|
+
* it may return an operation object. getExactModelOption inspects a member including
|
|
3738
|
+
* its same-owner exact model-default fallback, without resolving entry policy.
|
|
3509
3739
|
*/
|
|
3510
3740
|
getModelOption(modelName, key, defaultValue) {
|
|
3511
3741
|
const manager = this.getOrCreateModelOptions(modelName);
|
|
@@ -3515,7 +3745,7 @@ var AccessRuntime = class {
|
|
|
3515
3745
|
);
|
|
3516
3746
|
return getNestedOption(manager, key, defaultModelValue);
|
|
3517
3747
|
}
|
|
3518
|
-
/** Exact stored path, then the same runtime-model-default path; no parent/default or
|
|
3748
|
+
/** Exact stored path, then the same runtime-model-default path; no parent/default or final entry resolution. */
|
|
3519
3749
|
getExactModelOption(modelName, key) {
|
|
3520
3750
|
const manager = this.getOrCreateModelOptions(modelName);
|
|
3521
3751
|
const defaultModelValue = this.getDefaultModelOption(key);
|
|
@@ -3598,6 +3828,7 @@ var AccessRuntime = class {
|
|
|
3598
3828
|
}
|
|
3599
3829
|
setDataOptions(dataName, options) {
|
|
3600
3830
|
assertAuthorizationModeOptions(options, false);
|
|
3831
|
+
assertOperationAccessOptions(options);
|
|
3601
3832
|
assertNoServerModelControls(
|
|
3602
3833
|
options,
|
|
3603
3834
|
(detail) => {
|
|
@@ -3610,6 +3841,7 @@ var AccessRuntime = class {
|
|
|
3610
3841
|
}
|
|
3611
3842
|
setDataOption(dataName, key, value) {
|
|
3612
3843
|
assertAuthorizationModeKey(key, false);
|
|
3844
|
+
assertOperationAccessUpdate(key, value);
|
|
3613
3845
|
const proposed = {};
|
|
3614
3846
|
(0, import_utils14.set)(proposed, key, value);
|
|
3615
3847
|
assertNoServerModelControls(
|