@web-ts-toolkit/access-router 0.65.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +777 -0
- package/README.md +229 -550
- package/advanced.d.mts +2 -1
- package/advanced.d.ts +2 -1
- package/advanced.js +1322 -497
- package/advanced.mjs +1210 -385
- package/index.d.mts +14 -5
- package/index.d.ts +14 -5
- package/index.js +11482 -11188
- package/index.mjs +11206 -10914
- package/llms.txt +6 -3
- package/package.json +3 -3
- package/{parsers-h_oU4bB0.d.mts → parsers-BiFHfrNd.d.mts} +2608 -2929
- package/{parsers-h_oU4bB0.d.ts → parsers-BiFHfrNd.d.ts} +2608 -2929
- package/processors.js +13 -1
- package/processors.mjs +13 -1
package/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import mongoose__default, { Schema } from 'mongoose';
|
|
2
2
|
import { Response, NextFunction, RequestHandler, Router } from 'express';
|
|
3
|
-
import { A as AccessRouterBaseRequest,
|
|
4
|
-
export {
|
|
3
|
+
import { A as AccessRouterBaseRequest, au as GuardHook, a_ as ModelRequest, dY as AccessRuntime, $ as DataRouterOptions, Z as DataRequest, dZ as DataService, ab as ExtendedDataRouterOptions, ai as Filter, bv as Projection, cC as Sort, br as Populate, a$ as ModelRouterOptions, d_ as Service, d$ as PublicService, ba as ModelVirtualRecordAccess, b4 as ModelVirtualDescriptor, b6 as ModelVirtualGetter, b7 as ModelVirtualLeaf, ad as ExtendedModelRouterOptions, dz as Validation, cm as RootRouterOptions, e0 as OpenApiRouterOptions, e1 as OpenApiRegistryOptions, e2 as OpenApiRouteDescriptor, e3 as OpenApiDocumentOptions, e4 as OpenApiParameter, e5 as OpenApiSchema, e6 as OpenApiResponses, as as GlobalOptions, a3 as DefaultModelRouterOptions, ac as ExtendedDefaultModelRouterOptions } from './parsers-BiFHfrNd.mjs';
|
|
4
|
+
export { e7 as AccessRouterPermissionMap, e8 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 AuthorizationMode, t as AuthorizedListResult, u as AuthorizedSingleResult, I as CreateAuthorization, O as DataFieldOptions, a8 as DocumentGrants, ae as FieldAuthorization, af as FieldOperationAccess, ag as FieldPermissionHook, ah as FieldValidation, ak as FilteredOutput, at as GlobalPermissionValue, av as HydrationMode, ay as InputFieldAuthorization, az as InputFieldPath, aA as IoTsContextEntryLike, aB as IoTsDecodeErrorLike, aC as IoTsDecoderLike, aD as JoiSchemaLike, aE as JoiValidationErrorDetailLike, aK as MaybePromise, aL as ModelBaseFilterHook, aN as ModelDeleteHook, aO as ModelDocPermissionsHook, aQ as ModelDocumentHook, aR as ModelHook, aT as ModelHydrationOptions, aU as ModelIdentifierHook, aV as ModelListHook, aW as ModelOutputContext, aX as ModelOutputHook, aY as ModelOutputListHook, aZ as ModelOverrideFilterHook, b0 as ModelValidateHook, b1 as ModelVirtualAccess, b2 as ModelVirtualAccessRecord, b3 as ModelVirtualContext, b5 as ModelVirtualDoc, b8 as ModelVirtualPopulateDependency, b9 as ModelVirtualPopulateInputs, bb as ModelVirtuals, bc as MutationAuthorization, bd as NewArgs, be as NewOptions, e9 as OpenApiMethod, bf as OperationAccess, bg as OperationAuthorization, bh as OutputAuthorization, bi as OutputFieldOptions, bj as OutputFieldPath, bk as OutputPlanningOptions, bn as PairedRouteAccess, bq as PermissionSchema, ea as Permissions, bt as PopulatePlanningOptions, bH as PublicSubdocumentCreateOptions, bI as PublicSubdocumentListOptions, bJ as PublicSubdocumentMutationOptions, bK as PublicSubdocumentReadOptions, bQ as RelatedAuthorization, bS as RequestSchemaAdapter, bT as RequestSchemaFailure, bU as RequestSchemaIssue, bV as RequestSchemaLike, bW as RequestSchemaOptions, bX as RequestSchemaResult, bY as RequestSchemaSuccess, bZ as RequestSchemaValidator, cp as RouteBaseAccess, cq as RouteGuardAccess, cr as RouteVariant, cs as RouteVariantAccess, ct as RowAuthorization, cx as ServiceAuthorization, cy as ServiceOutputContext, cz as ServiceOutputDecorator, cE as StandardSchemaFailure, cF as StandardSchemaInferOutput, cG as StandardSchemaIssue, cH as StandardSchemaPathSegment, cI as StandardSchemaResult, cJ as StandardSchemaSuccess, cK as StandardSchemaV1, cN as SubOperationAccess, cR as SubRouteGuardOptions, cU as SubdocumentCreateAuthorization, cW as SubdocumentCreateOptions, cX as SubdocumentCreateVisibilityAuthorization, cY as SubdocumentDeleteAuthorization, cZ as SubdocumentDeleteOptions, c_ as SubdocumentGateAuthorization, d0 as SubdocumentInputAuthorization, d1 as SubdocumentListOptions, d2 as SubdocumentModel, d3 as SubdocumentMutationAuthorization, d4 as SubdocumentName, d5 as SubdocumentOutputAuthorization, d8 as SubdocumentReadAuthorization, d9 as SubdocumentReadOptions, db as SubdocumentUpdateOptions, dc as SubdocumentVirtuals, dd as SubdocumentVisibilityAuthorization, de as SuperstructFailureLike, df as SuperstructValidateLike, dt as ValibotIssueLike, du as ValibotPathItemLike, dv as ValibotSafeParseLike, dw as ValibotSafeParseResult, dB as VineValidationErrorLike, dC as VineValidationMessageLike, dD as VineValidatorLike, dE as VirtualSubModel, dF as WithVirtuals, dG as YupSchemaLike, dH as YupValidationErrorLike, eb as defaultRuntime, dI as defineRequestSchema, dJ as fromAjv, dK as fromArkType, dL as fromIoTs, dM as fromJoi, dN as fromStandardSchema, dO as fromSuperstruct, dP as fromValibot, dQ as fromVine, dR as fromYup, dS as fromZod } from './parsers-BiFHfrNd.mjs';
|
|
5
5
|
import JsonRouter from '@web-ts-toolkit/express-json-router';
|
|
6
6
|
import 'zod';
|
|
7
|
+
import 'node:buffer';
|
|
7
8
|
|
|
8
9
|
declare function macl(): (req: AccessRouterBaseRequest, res: Response, next: NextFunction) => Promise<void>;
|
|
9
10
|
interface GuardModelConditionID {
|
|
@@ -15,6 +16,14 @@ interface GuardModelCondition {
|
|
|
15
16
|
id: string | GuardModelConditionID;
|
|
16
17
|
condition: string | string[];
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Request permission middleware. Model conditions require a visible row and fresh
|
|
21
|
+
* document facts, but publish no DTO: field/virtual/include output, decorate/tasks
|
|
22
|
+
* and `_read` overrides do not run or veto the condition. Source/fact errors remain
|
|
23
|
+
* BadRequest. This request-only read does not imply the generated HTTP READ gate;
|
|
24
|
+
* an admitted miss may retry once under captured LIST admission and READ mode.
|
|
25
|
+
* Put security in operation/row/fact hooks; use a separate normal read for a DTO.
|
|
26
|
+
*/
|
|
18
27
|
declare function guard(condition: string): RequestHandler;
|
|
19
28
|
declare function guard(conditions: string[]): RequestHandler;
|
|
20
29
|
declare function guard(conditionFunc: GuardHook<ModelRequest>): RequestHandler;
|
|
@@ -128,8 +137,8 @@ declare class ModelRouter<TModel = unknown, TVirtuals extends object = Record<ne
|
|
|
128
137
|
/**
|
|
129
138
|
* Acquire the model-generic internal service after this runtime's middleware
|
|
130
139
|
* initializes req.macl. Supply trusted per-call authorization in service options;
|
|
131
|
-
* selection/query args stay separate. Successful results carry
|
|
132
|
-
*
|
|
140
|
+
* selection/query args stay separate. Successful results carry immutable diagnostic
|
|
141
|
+
* context(s), never reusable authority on data. Use getPublicService for request-only wrappers.
|
|
133
142
|
*/
|
|
134
143
|
getService(req: ModelRequest): Service<TModel, TVirtuals>;
|
|
135
144
|
getPublicService(req: ModelRequest): PublicService<TModel, TVirtuals>;
|
|
@@ -450,7 +459,7 @@ declare const getModelInstance: <TModel = unknown>(modelName: string) => mongoos
|
|
|
450
459
|
* Update inherited model defaults shallowly. Unspecified model options follow these
|
|
451
460
|
* updates for new calls, including existing models; explicit model values (even false
|
|
452
461
|
* or empty objects/arrays) win. Model undefined restores inheritance. Existing calls,
|
|
453
|
-
*
|
|
462
|
+
* router.options snapshots and mounted route paths are not rewritten.
|
|
454
463
|
* Explicitly cleared operationAccess keeps its existing exact-key-only default fallback.
|
|
455
464
|
*/
|
|
456
465
|
declare const setDefaultModelOptions: (options: DefaultModelRouterOptions) => void;
|
package/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import mongoose__default, { Schema } from 'mongoose';
|
|
2
2
|
import { Response, NextFunction, RequestHandler, Router } from 'express';
|
|
3
|
-
import { A as AccessRouterBaseRequest,
|
|
4
|
-
export {
|
|
3
|
+
import { A as AccessRouterBaseRequest, au as GuardHook, a_ as ModelRequest, dY as AccessRuntime, $ as DataRouterOptions, Z as DataRequest, dZ as DataService, ab as ExtendedDataRouterOptions, ai as Filter, bv as Projection, cC as Sort, br as Populate, a$ as ModelRouterOptions, d_ as Service, d$ as PublicService, ba as ModelVirtualRecordAccess, b4 as ModelVirtualDescriptor, b6 as ModelVirtualGetter, b7 as ModelVirtualLeaf, ad as ExtendedModelRouterOptions, dz as Validation, cm as RootRouterOptions, e0 as OpenApiRouterOptions, e1 as OpenApiRegistryOptions, e2 as OpenApiRouteDescriptor, e3 as OpenApiDocumentOptions, e4 as OpenApiParameter, e5 as OpenApiSchema, e6 as OpenApiResponses, as as GlobalOptions, a3 as DefaultModelRouterOptions, ac as ExtendedDefaultModelRouterOptions } from './parsers-BiFHfrNd.js';
|
|
4
|
+
export { e7 as AccessRouterPermissionMap, e8 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 AuthorizationMode, t as AuthorizedListResult, u as AuthorizedSingleResult, I as CreateAuthorization, O as DataFieldOptions, a8 as DocumentGrants, ae as FieldAuthorization, af as FieldOperationAccess, ag as FieldPermissionHook, ah as FieldValidation, ak as FilteredOutput, at as GlobalPermissionValue, av as HydrationMode, ay as InputFieldAuthorization, az as InputFieldPath, aA as IoTsContextEntryLike, aB as IoTsDecodeErrorLike, aC as IoTsDecoderLike, aD as JoiSchemaLike, aE as JoiValidationErrorDetailLike, aK as MaybePromise, aL as ModelBaseFilterHook, aN as ModelDeleteHook, aO as ModelDocPermissionsHook, aQ as ModelDocumentHook, aR as ModelHook, aT as ModelHydrationOptions, aU as ModelIdentifierHook, aV as ModelListHook, aW as ModelOutputContext, aX as ModelOutputHook, aY as ModelOutputListHook, aZ as ModelOverrideFilterHook, b0 as ModelValidateHook, b1 as ModelVirtualAccess, b2 as ModelVirtualAccessRecord, b3 as ModelVirtualContext, b5 as ModelVirtualDoc, b8 as ModelVirtualPopulateDependency, b9 as ModelVirtualPopulateInputs, bb as ModelVirtuals, bc as MutationAuthorization, bd as NewArgs, be as NewOptions, e9 as OpenApiMethod, bf as OperationAccess, bg as OperationAuthorization, bh as OutputAuthorization, bi as OutputFieldOptions, bj as OutputFieldPath, bk as OutputPlanningOptions, bn as PairedRouteAccess, bq as PermissionSchema, ea as Permissions, bt as PopulatePlanningOptions, bH as PublicSubdocumentCreateOptions, bI as PublicSubdocumentListOptions, bJ as PublicSubdocumentMutationOptions, bK as PublicSubdocumentReadOptions, bQ as RelatedAuthorization, bS as RequestSchemaAdapter, bT as RequestSchemaFailure, bU as RequestSchemaIssue, bV as RequestSchemaLike, bW as RequestSchemaOptions, bX as RequestSchemaResult, bY as RequestSchemaSuccess, bZ as RequestSchemaValidator, cp as RouteBaseAccess, cq as RouteGuardAccess, cr as RouteVariant, cs as RouteVariantAccess, ct as RowAuthorization, cx as ServiceAuthorization, cy as ServiceOutputContext, cz as ServiceOutputDecorator, cE as StandardSchemaFailure, cF as StandardSchemaInferOutput, cG as StandardSchemaIssue, cH as StandardSchemaPathSegment, cI as StandardSchemaResult, cJ as StandardSchemaSuccess, cK as StandardSchemaV1, cN as SubOperationAccess, cR as SubRouteGuardOptions, cU as SubdocumentCreateAuthorization, cW as SubdocumentCreateOptions, cX as SubdocumentCreateVisibilityAuthorization, cY as SubdocumentDeleteAuthorization, cZ as SubdocumentDeleteOptions, c_ as SubdocumentGateAuthorization, d0 as SubdocumentInputAuthorization, d1 as SubdocumentListOptions, d2 as SubdocumentModel, d3 as SubdocumentMutationAuthorization, d4 as SubdocumentName, d5 as SubdocumentOutputAuthorization, d8 as SubdocumentReadAuthorization, d9 as SubdocumentReadOptions, db as SubdocumentUpdateOptions, dc as SubdocumentVirtuals, dd as SubdocumentVisibilityAuthorization, de as SuperstructFailureLike, df as SuperstructValidateLike, dt as ValibotIssueLike, du as ValibotPathItemLike, dv as ValibotSafeParseLike, dw as ValibotSafeParseResult, dB as VineValidationErrorLike, dC as VineValidationMessageLike, dD as VineValidatorLike, dE as VirtualSubModel, dF as WithVirtuals, dG as YupSchemaLike, dH as YupValidationErrorLike, eb as defaultRuntime, dI as defineRequestSchema, dJ as fromAjv, dK as fromArkType, dL as fromIoTs, dM as fromJoi, dN as fromStandardSchema, dO as fromSuperstruct, dP as fromValibot, dQ as fromVine, dR as fromYup, dS as fromZod } from './parsers-BiFHfrNd.js';
|
|
5
5
|
import JsonRouter from '@web-ts-toolkit/express-json-router';
|
|
6
6
|
import 'zod';
|
|
7
|
+
import 'node:buffer';
|
|
7
8
|
|
|
8
9
|
declare function macl(): (req: AccessRouterBaseRequest, res: Response, next: NextFunction) => Promise<void>;
|
|
9
10
|
interface GuardModelConditionID {
|
|
@@ -15,6 +16,14 @@ interface GuardModelCondition {
|
|
|
15
16
|
id: string | GuardModelConditionID;
|
|
16
17
|
condition: string | string[];
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Request permission middleware. Model conditions require a visible row and fresh
|
|
21
|
+
* document facts, but publish no DTO: field/virtual/include output, decorate/tasks
|
|
22
|
+
* and `_read` overrides do not run or veto the condition. Source/fact errors remain
|
|
23
|
+
* BadRequest. This request-only read does not imply the generated HTTP READ gate;
|
|
24
|
+
* an admitted miss may retry once under captured LIST admission and READ mode.
|
|
25
|
+
* Put security in operation/row/fact hooks; use a separate normal read for a DTO.
|
|
26
|
+
*/
|
|
18
27
|
declare function guard(condition: string): RequestHandler;
|
|
19
28
|
declare function guard(conditions: string[]): RequestHandler;
|
|
20
29
|
declare function guard(conditionFunc: GuardHook<ModelRequest>): RequestHandler;
|
|
@@ -128,8 +137,8 @@ declare class ModelRouter<TModel = unknown, TVirtuals extends object = Record<ne
|
|
|
128
137
|
/**
|
|
129
138
|
* Acquire the model-generic internal service after this runtime's middleware
|
|
130
139
|
* initializes req.macl. Supply trusted per-call authorization in service options;
|
|
131
|
-
* selection/query args stay separate. Successful results carry
|
|
132
|
-
*
|
|
140
|
+
* selection/query args stay separate. Successful results carry immutable diagnostic
|
|
141
|
+
* context(s), never reusable authority on data. Use getPublicService for request-only wrappers.
|
|
133
142
|
*/
|
|
134
143
|
getService(req: ModelRequest): Service<TModel, TVirtuals>;
|
|
135
144
|
getPublicService(req: ModelRequest): PublicService<TModel, TVirtuals>;
|
|
@@ -450,7 +459,7 @@ declare const getModelInstance: <TModel = unknown>(modelName: string) => mongoos
|
|
|
450
459
|
* Update inherited model defaults shallowly. Unspecified model options follow these
|
|
451
460
|
* updates for new calls, including existing models; explicit model values (even false
|
|
452
461
|
* or empty objects/arrays) win. Model undefined restores inheritance. Existing calls,
|
|
453
|
-
*
|
|
462
|
+
* router.options snapshots and mounted route paths are not rewritten.
|
|
454
463
|
* Explicitly cleared operationAccess keeps its existing exact-key-only default fallback.
|
|
455
464
|
*/
|
|
456
465
|
declare const setDefaultModelOptions: (options: DefaultModelRouterOptions) => void;
|