@web-ts-toolkit/access-router 0.61.0 → 0.62.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 +320 -56
- package/advanced.d.mts +1 -1
- package/advanced.d.ts +1 -1
- package/advanced.js +253 -129
- package/advanced.mjs +253 -129
- package/index.d.mts +25 -17
- package/index.d.ts +25 -17
- package/index.js +724 -412
- package/index.mjs +667 -355
- package/llms.txt +4 -2
- package/package.json +3 -3
- package/{parsers-DFZ_6fGl.d.mts → parsers-Bdq0jg69.d.mts} +197 -79
- package/{parsers-DFZ_6fGl.d.ts → parsers-Bdq0jg69.d.ts} +197 -79
package/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import mongoose__default, { 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-Bdq0jg69.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-Bdq0jg69.mjs';
|
|
5
5
|
import JsonRouter from '@web-ts-toolkit/express-json-router';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
|
@@ -95,19 +95,19 @@ interface FindOneProps {
|
|
|
95
95
|
}
|
|
96
96
|
declare class Model {
|
|
97
97
|
modelName: string;
|
|
98
|
-
mongooseModel:
|
|
98
|
+
mongooseModel: mongoose__default.Model<any>;
|
|
99
99
|
runtime: AccessRuntime | null;
|
|
100
100
|
constructor(modelName: string, runtime?: AccessRuntime);
|
|
101
101
|
new(): any;
|
|
102
102
|
create(data: unknown): Promise<any>;
|
|
103
|
-
find({ filter, select, sort, populate, limit, hardLimit, skip, lean }: FindProps):
|
|
104
|
-
findOne({ filter, select, sort, populate, lean }: FindOneProps):
|
|
103
|
+
find({ filter, select, sort, populate, limit, hardLimit, skip, lean }: FindProps): mongoose__default.Query<any[], any>;
|
|
104
|
+
findOne({ filter, select, sort, populate, lean }: FindOneProps): mongoose__default.Query<any, any>;
|
|
105
105
|
exists(filter: Filter): ReturnType<typeof Model.prototype.findOne> | null;
|
|
106
|
-
countDocuments(filter?: {}):
|
|
106
|
+
countDocuments(filter?: {}): mongoose__default.Query<number, any>;
|
|
107
107
|
/** Cast a copy using this model's query schema/setters, without executing query middleware or persistence. */
|
|
108
108
|
castFilter(filter: Record<string, unknown>): Record<string, unknown>;
|
|
109
|
-
distinct(field: string, conditions?: {}):
|
|
110
|
-
aggregate(pipeline: unknown[]):
|
|
109
|
+
distinct(field: string, conditions?: {}): mongoose__default.Query<any[], any>;
|
|
110
|
+
aggregate(pipeline: unknown[]): mongoose__default.Aggregate<any[]>;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
type SetTargetOption<TRouter, TOption> = {
|
|
@@ -123,7 +123,7 @@ declare class ModelRouter<TModel = unknown, TVirtuals extends object = Record<ne
|
|
|
123
123
|
readonly options: ModelRouterOptions<TModel, TVirtuals>;
|
|
124
124
|
readonly fullBasePath: string;
|
|
125
125
|
constructor(modelName: string, initialOptions: ModelRouterOptions<TModel, TVirtuals>, runtime?: AccessRuntime);
|
|
126
|
-
static fromModel<TModel, TVirtuals extends object = Record<never, never>>(model:
|
|
126
|
+
static fromModel<TModel, TVirtuals extends object = Record<never, never>>(model: mongoose__default.Model<TModel>, initialOptions: ModelRouterOptions<TModel, TVirtuals>, runtime?: AccessRuntime): ModelRouter<TModel, TVirtuals>;
|
|
127
127
|
private getRequestSchema;
|
|
128
128
|
/**
|
|
129
129
|
* Acquire the model-generic internal service after this runtime's middleware
|
|
@@ -442,11 +442,19 @@ declare const getModelOptions: <TModel = unknown, TVirtuals extends object = Rec
|
|
|
442
442
|
declare const getModelOption: <K extends keyof ExtendedModelRouterOptions<TModel, TVirtuals>, TModel = unknown, TVirtuals extends object = Record<never, never>>(modelName: string, key: K | string, defaultValue?: ExtendedModelRouterOptions<TModel, TVirtuals>[K]) => ExtendedModelRouterOptions<TModel, TVirtuals>[K];
|
|
443
443
|
declare const getModelNames: () => string[];
|
|
444
444
|
declare const getModelJsonSchema: (modelName: string) => Record<string, unknown>;
|
|
445
|
-
declare const registerModelInstance: <TModel>(modelName: string, model:
|
|
445
|
+
declare const registerModelInstance: <TModel>(modelName: string, model: mongoose__default.Model<TModel>) => void;
|
|
446
446
|
declare const hasModelInstance: (modelName: string) => boolean;
|
|
447
|
-
declare const getModelInstance: <TModel = unknown>(modelName: string) =>
|
|
447
|
+
declare const getModelInstance: <TModel = unknown>(modelName: string) => mongoose__default.Model<TModel> | null;
|
|
448
448
|
|
|
449
|
+
/**
|
|
450
|
+
* Update inherited model defaults shallowly. Unspecified model options follow these
|
|
451
|
+
* updates for new calls, including existing models; explicit model values (even false
|
|
452
|
+
* or empty objects/arrays) win. Model undefined restores inheritance. Existing calls,
|
|
453
|
+
* handles, router.options snapshots and mounted route paths are not rewritten.
|
|
454
|
+
* Explicitly cleared operationAccess keeps its existing exact-key-only default fallback.
|
|
455
|
+
*/
|
|
449
456
|
declare const setDefaultModelOptions: (options: DefaultModelRouterOptions) => void;
|
|
457
|
+
/** Update one inherited model default, with the same precedence as setDefaultModelOptions. */
|
|
450
458
|
declare const setDefaultModelOption: <K extends keyof ExtendedDefaultModelRouterOptions>(key: K, value: ExtendedDefaultModelRouterOptions[K]) => void;
|
|
451
459
|
declare const getDefaultModelOptions: () => DefaultModelRouterOptions<unknown>;
|
|
452
460
|
declare const getDefaultModelOption: <K extends keyof ExtendedDefaultModelRouterOptions>(key: K, defaultValue?: ExtendedDefaultModelRouterOptions[K]) => ExtendedDefaultModelRouterOptions<unknown>[K];
|
|
@@ -499,7 +507,7 @@ type CreateRouter = {
|
|
|
499
507
|
* mount the returned `.routes` in Express after express.json(). Route middleware
|
|
500
508
|
* initializes req.macl; field enforcement does not require permissionsPlugin.
|
|
501
509
|
*/
|
|
502
|
-
<TModel, TVirtuals extends object = Record<never, never>>(model:
|
|
510
|
+
<TModel, TVirtuals extends object = Record<never, never>>(model: mongoose__default.Model<TModel>, options: ModelRouterOptions<TModel, TVirtuals>): ModelRouter<TModel, TVirtuals>;
|
|
503
511
|
/**
|
|
504
512
|
* Create a router for an already-registered model name. Isolated runtimes require
|
|
505
513
|
* registerModelInstance(name, model) first; default acl also adopts mongoose.model(name).
|
|
@@ -521,9 +529,9 @@ type CreateDataRouter = {
|
|
|
521
529
|
/** Runtime-bound OpenAPI factory; returns an Express router mounted directly with app.use(). */
|
|
522
530
|
type CreateRuntimeOpenApiRouter = (options?: OpenApiRouterOptions) => Router;
|
|
523
531
|
type WttSet = {
|
|
524
|
-
/** Set one global option
|
|
532
|
+
/** Set one global option. Populate flags use setModelOption/setDefaultModelOption; stale global placement throws migration guidance. */
|
|
525
533
|
<K extends keyof GlobalOptions>(key: K, value: GlobalOptions[K]): void;
|
|
526
|
-
/** Shallowly replace supplied
|
|
534
|
+
/** Shallowly replace supplied globals; populate flags belong to setModelOptions/setDefaultModelOptions. */
|
|
527
535
|
(options: {
|
|
528
536
|
[K in keyof GlobalOptions]: GlobalOptions[K];
|
|
529
537
|
}): void;
|
|
@@ -553,9 +561,9 @@ interface Wtt {
|
|
|
553
561
|
setDefaultModelOption: typeof setDefaultModelOption;
|
|
554
562
|
getDefaultModelOptions: typeof getDefaultModelOptions;
|
|
555
563
|
getDefaultModelOption: typeof getDefaultModelOption;
|
|
556
|
-
registerModelInstance: <TModel>(modelName: string, model:
|
|
564
|
+
registerModelInstance: <TModel>(modelName: string, model: mongoose__default.Model<TModel>) => void;
|
|
557
565
|
hasModelInstance: (modelName: string) => boolean;
|
|
558
|
-
getModelInstance: <TModel = unknown>(modelName: string) =>
|
|
566
|
+
getModelInstance: <TModel = unknown>(modelName: string) => mongoose__default.Model<TModel> | null;
|
|
559
567
|
RootRouter: typeof RootRouter;
|
|
560
568
|
ModelRouter: typeof ModelRouter;
|
|
561
569
|
DataRouter: typeof DataRouter;
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import mongoose__default, { 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-Bdq0jg69.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-Bdq0jg69.js';
|
|
5
5
|
import JsonRouter from '@web-ts-toolkit/express-json-router';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
|
@@ -95,19 +95,19 @@ interface FindOneProps {
|
|
|
95
95
|
}
|
|
96
96
|
declare class Model {
|
|
97
97
|
modelName: string;
|
|
98
|
-
mongooseModel:
|
|
98
|
+
mongooseModel: mongoose__default.Model<any>;
|
|
99
99
|
runtime: AccessRuntime | null;
|
|
100
100
|
constructor(modelName: string, runtime?: AccessRuntime);
|
|
101
101
|
new(): any;
|
|
102
102
|
create(data: unknown): Promise<any>;
|
|
103
|
-
find({ filter, select, sort, populate, limit, hardLimit, skip, lean }: FindProps):
|
|
104
|
-
findOne({ filter, select, sort, populate, lean }: FindOneProps):
|
|
103
|
+
find({ filter, select, sort, populate, limit, hardLimit, skip, lean }: FindProps): mongoose__default.Query<any[], any>;
|
|
104
|
+
findOne({ filter, select, sort, populate, lean }: FindOneProps): mongoose__default.Query<any, any>;
|
|
105
105
|
exists(filter: Filter): ReturnType<typeof Model.prototype.findOne> | null;
|
|
106
|
-
countDocuments(filter?: {}):
|
|
106
|
+
countDocuments(filter?: {}): mongoose__default.Query<number, any>;
|
|
107
107
|
/** Cast a copy using this model's query schema/setters, without executing query middleware or persistence. */
|
|
108
108
|
castFilter(filter: Record<string, unknown>): Record<string, unknown>;
|
|
109
|
-
distinct(field: string, conditions?: {}):
|
|
110
|
-
aggregate(pipeline: unknown[]):
|
|
109
|
+
distinct(field: string, conditions?: {}): mongoose__default.Query<any[], any>;
|
|
110
|
+
aggregate(pipeline: unknown[]): mongoose__default.Aggregate<any[]>;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
type SetTargetOption<TRouter, TOption> = {
|
|
@@ -123,7 +123,7 @@ declare class ModelRouter<TModel = unknown, TVirtuals extends object = Record<ne
|
|
|
123
123
|
readonly options: ModelRouterOptions<TModel, TVirtuals>;
|
|
124
124
|
readonly fullBasePath: string;
|
|
125
125
|
constructor(modelName: string, initialOptions: ModelRouterOptions<TModel, TVirtuals>, runtime?: AccessRuntime);
|
|
126
|
-
static fromModel<TModel, TVirtuals extends object = Record<never, never>>(model:
|
|
126
|
+
static fromModel<TModel, TVirtuals extends object = Record<never, never>>(model: mongoose__default.Model<TModel>, initialOptions: ModelRouterOptions<TModel, TVirtuals>, runtime?: AccessRuntime): ModelRouter<TModel, TVirtuals>;
|
|
127
127
|
private getRequestSchema;
|
|
128
128
|
/**
|
|
129
129
|
* Acquire the model-generic internal service after this runtime's middleware
|
|
@@ -442,11 +442,19 @@ declare const getModelOptions: <TModel = unknown, TVirtuals extends object = Rec
|
|
|
442
442
|
declare const getModelOption: <K extends keyof ExtendedModelRouterOptions<TModel, TVirtuals>, TModel = unknown, TVirtuals extends object = Record<never, never>>(modelName: string, key: K | string, defaultValue?: ExtendedModelRouterOptions<TModel, TVirtuals>[K]) => ExtendedModelRouterOptions<TModel, TVirtuals>[K];
|
|
443
443
|
declare const getModelNames: () => string[];
|
|
444
444
|
declare const getModelJsonSchema: (modelName: string) => Record<string, unknown>;
|
|
445
|
-
declare const registerModelInstance: <TModel>(modelName: string, model:
|
|
445
|
+
declare const registerModelInstance: <TModel>(modelName: string, model: mongoose__default.Model<TModel>) => void;
|
|
446
446
|
declare const hasModelInstance: (modelName: string) => boolean;
|
|
447
|
-
declare const getModelInstance: <TModel = unknown>(modelName: string) =>
|
|
447
|
+
declare const getModelInstance: <TModel = unknown>(modelName: string) => mongoose__default.Model<TModel> | null;
|
|
448
448
|
|
|
449
|
+
/**
|
|
450
|
+
* Update inherited model defaults shallowly. Unspecified model options follow these
|
|
451
|
+
* updates for new calls, including existing models; explicit model values (even false
|
|
452
|
+
* or empty objects/arrays) win. Model undefined restores inheritance. Existing calls,
|
|
453
|
+
* handles, router.options snapshots and mounted route paths are not rewritten.
|
|
454
|
+
* Explicitly cleared operationAccess keeps its existing exact-key-only default fallback.
|
|
455
|
+
*/
|
|
449
456
|
declare const setDefaultModelOptions: (options: DefaultModelRouterOptions) => void;
|
|
457
|
+
/** Update one inherited model default, with the same precedence as setDefaultModelOptions. */
|
|
450
458
|
declare const setDefaultModelOption: <K extends keyof ExtendedDefaultModelRouterOptions>(key: K, value: ExtendedDefaultModelRouterOptions[K]) => void;
|
|
451
459
|
declare const getDefaultModelOptions: () => DefaultModelRouterOptions<unknown>;
|
|
452
460
|
declare const getDefaultModelOption: <K extends keyof ExtendedDefaultModelRouterOptions>(key: K, defaultValue?: ExtendedDefaultModelRouterOptions[K]) => ExtendedDefaultModelRouterOptions<unknown>[K];
|
|
@@ -499,7 +507,7 @@ type CreateRouter = {
|
|
|
499
507
|
* mount the returned `.routes` in Express after express.json(). Route middleware
|
|
500
508
|
* initializes req.macl; field enforcement does not require permissionsPlugin.
|
|
501
509
|
*/
|
|
502
|
-
<TModel, TVirtuals extends object = Record<never, never>>(model:
|
|
510
|
+
<TModel, TVirtuals extends object = Record<never, never>>(model: mongoose__default.Model<TModel>, options: ModelRouterOptions<TModel, TVirtuals>): ModelRouter<TModel, TVirtuals>;
|
|
503
511
|
/**
|
|
504
512
|
* Create a router for an already-registered model name. Isolated runtimes require
|
|
505
513
|
* registerModelInstance(name, model) first; default acl also adopts mongoose.model(name).
|
|
@@ -521,9 +529,9 @@ type CreateDataRouter = {
|
|
|
521
529
|
/** Runtime-bound OpenAPI factory; returns an Express router mounted directly with app.use(). */
|
|
522
530
|
type CreateRuntimeOpenApiRouter = (options?: OpenApiRouterOptions) => Router;
|
|
523
531
|
type WttSet = {
|
|
524
|
-
/** Set one global option
|
|
532
|
+
/** Set one global option. Populate flags use setModelOption/setDefaultModelOption; stale global placement throws migration guidance. */
|
|
525
533
|
<K extends keyof GlobalOptions>(key: K, value: GlobalOptions[K]): void;
|
|
526
|
-
/** Shallowly replace supplied
|
|
534
|
+
/** Shallowly replace supplied globals; populate flags belong to setModelOptions/setDefaultModelOptions. */
|
|
527
535
|
(options: {
|
|
528
536
|
[K in keyof GlobalOptions]: GlobalOptions[K];
|
|
529
537
|
}): void;
|
|
@@ -553,9 +561,9 @@ interface Wtt {
|
|
|
553
561
|
setDefaultModelOption: typeof setDefaultModelOption;
|
|
554
562
|
getDefaultModelOptions: typeof getDefaultModelOptions;
|
|
555
563
|
getDefaultModelOption: typeof getDefaultModelOption;
|
|
556
|
-
registerModelInstance: <TModel>(modelName: string, model:
|
|
564
|
+
registerModelInstance: <TModel>(modelName: string, model: mongoose__default.Model<TModel>) => void;
|
|
557
565
|
hasModelInstance: (modelName: string) => boolean;
|
|
558
|
-
getModelInstance: <TModel = unknown>(modelName: string) =>
|
|
566
|
+
getModelInstance: <TModel = unknown>(modelName: string) => mongoose__default.Model<TModel> | null;
|
|
559
567
|
RootRouter: typeof RootRouter;
|
|
560
568
|
ModelRouter: typeof ModelRouter;
|
|
561
569
|
DataRouter: typeof DataRouter;
|