@web-ts-toolkit/access-router 0.3.0 → 0.5.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.
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import express from 'express';
3
2
  import mongoose from 'mongoose';
4
3
  import { Diff } from 'deep-diff';
4
+ import express from 'express';
5
5
 
6
6
  interface BooleanObject {
7
7
  [key: string]: boolean;
@@ -26,8 +26,8 @@ type Permissions = Permission;
26
26
  type AccessRouterPermissions = Permission;
27
27
 
28
28
  declare class Base<TModel = unknown> {
29
- req: ModelRequest;
30
- modelName: string;
29
+ protected req: ModelRequest;
30
+ protected modelName: string;
31
31
  constructor(req: ModelRequest, modelName: string);
32
32
  decorate<T>(doc: T, access: DecorateAccess, context: ModelHookContext): Promise<T>;
33
33
  decorateAll<T>(docs: T[], access: DecorateAllAccess, context: ModelHookContext): Promise<T[]>;
@@ -98,19 +98,17 @@ declare class Model {
98
98
  find({ filter, select, sort, populate, limit, skip, lean }: FindProps): mongoose.Query<any[], any, {}, any, "find", {}>;
99
99
  validateSort(sort: SortType, logError?: (msg: string, ...args: unknown[]) => void): boolean;
100
100
  findOne({ filter, select, sort, populate, lean }: FindOneProps): mongoose.Query<any, any, {}, any, "findOne", {}>;
101
- findOneAndDelete(filter: any): mongoose.Query<any, any, {}, any, "findOneAndDelete", {}>;
102
101
  exists(filter: any): mongoose.Query<any, any, {}, any, "findOne", {}>;
103
102
  countDocuments(filter?: {}): mongoose.Query<number, any, {}, any, "countDocuments", {}>;
104
- estimatedDocumentCount(): mongoose.Query<number, any, {}, any, "estimatedDocumentCount", {}>;
105
103
  distinct(field: string, conditions?: {}): mongoose.Query<any[], any, {}, any, "distinct", {}>;
106
104
  }
107
105
 
108
106
  declare class Service<TModel = unknown> extends Base<TModel> {
109
- model: Model;
110
- options: ModelRouterOptions<TModel>;
107
+ protected model: Model;
108
+ protected options: ModelRouterOptions<TModel>;
111
109
  defaults: Defaults<TModel>;
112
- baseFields: string[];
113
- baseFieldsExt: string[];
110
+ protected baseFields: string[];
111
+ protected baseFieldsExt: string[];
114
112
  private asServiceHookContext;
115
113
  constructor(req: ModelRequest, modelName: string);
116
114
  findOne(filter: Filter<TModel>, args?: FindOneArgs<TModel>, options?: FindOneOptions): Promise<SingleResult<TModel> | ErrorResult>;
@@ -210,10 +208,10 @@ declare class PublicService<TModel = unknown> extends Service<TModel> {
210
208
  }
211
209
 
212
210
  declare class DataService<T> {
213
- req: DataRequest;
214
- dataName: string;
215
- options: DataRouterOptions<T>;
216
- data: T[];
211
+ protected req: DataRequest;
212
+ protected dataName: string;
213
+ protected options: DataRouterOptions<T>;
214
+ protected data: T[];
217
215
  constructor(req: DataRequest, dataName: string);
218
216
  findOne<TSelect extends Projection | undefined = undefined>(filter: DataFilter<T>, args?: DataFindOneArgs<T, TSelect>, options?: DataFindOneOptions): Promise<SingleResult<SelectedPublicOutput<T, TSelect>> | ErrorResult>;
219
217
  findById<TSelect extends Projection | undefined = undefined>(id: string, args?: DataFindOneArgs<T, TSelect>, options?: DataFindOneOptions): Promise<SingleResult<SelectedPublicOutput<T, TSelect>> | ErrorResult>;
@@ -865,39 +863,327 @@ type ModelListHook<TValue = unknown> = HookChain<TValue[], ModelHookContext, Mod
865
863
  type DataHook<TValue = unknown> = HookChain<TValue, DataHookContext, DataRequest>;
866
864
  type DataListHook<TValue = unknown> = HookChain<TValue[], DataHookContext, DataRequest>;
867
865
 
866
+ type ValidationError = {
867
+ detail: string;
868
+ pointer?: string;
869
+ parameter?: string;
870
+ };
871
+ type RequestSchemaIssue = {
872
+ message: string;
873
+ path?: Array<string | number>;
874
+ };
875
+ type RequestSchemaSuccess<T = unknown> = {
876
+ success: true;
877
+ data: T;
878
+ };
879
+ type RequestSchemaFailure = {
880
+ success: false;
881
+ issues: RequestSchemaIssue[];
882
+ };
883
+ type RequestSchemaResult<T = unknown> = RequestSchemaSuccess<T> | RequestSchemaFailure;
884
+ type RequestSchemaValidator<T = unknown> = (value: unknown) => RequestSchemaResult<T> | Promise<RequestSchemaResult<T>>;
885
+ type RequestSchemaAdapter<T = unknown> = {
886
+ validate: RequestSchemaValidator<T>;
887
+ openapi?: Record<string, unknown>;
888
+ };
889
+ type RequestSchemaOptions = {
890
+ openapi?: Record<string, unknown>;
891
+ };
892
+ type StandardSchemaPathSegment = {
893
+ key: PropertyKey;
894
+ };
895
+ type StandardSchemaIssue = {
896
+ message: string;
897
+ path?: ReadonlyArray<PropertyKey | StandardSchemaPathSegment>;
898
+ };
899
+ type StandardSchemaSuccess<T = unknown> = {
900
+ value: T;
901
+ issues?: undefined;
902
+ };
903
+ type StandardSchemaFailure = {
904
+ issues: ReadonlyArray<StandardSchemaIssue>;
905
+ };
906
+ type StandardSchemaResult<T = unknown> = StandardSchemaSuccess<T> | StandardSchemaFailure;
907
+ type StandardSchemaV1<Input = unknown, Output = Input> = {
908
+ readonly '~standard': {
909
+ readonly version: 1;
910
+ readonly vendor: string;
911
+ readonly validate: (value: unknown, options?: {
912
+ readonly libraryOptions?: Record<string, unknown> | undefined;
913
+ }) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
914
+ readonly types?: {
915
+ readonly input: Input;
916
+ readonly output: Output;
917
+ };
918
+ };
919
+ };
920
+ type StandardSchemaInferOutput<TSchema extends StandardSchemaV1> = NonNullable<TSchema['~standard']['types']>['output'];
921
+ type RequestSchemaLike<T = unknown> = RequestSchemaValidator<T> | RequestSchemaAdapter<T> | StandardSchemaV1;
922
+ type YupValidationErrorLike = {
923
+ message: string;
924
+ path?: string;
925
+ inner?: ReadonlyArray<YupValidationErrorLike>;
926
+ };
927
+ type YupSchemaLike<T = unknown> = {
928
+ validate: (value: unknown, options?: {
929
+ abortEarly?: boolean;
930
+ stripUnknown?: boolean;
931
+ }) => Promise<T> | T;
932
+ };
933
+ type JoiValidationErrorDetailLike = {
934
+ message: string;
935
+ path?: ReadonlyArray<string | number>;
936
+ };
937
+ type JoiSchemaLike<T = unknown> = {
938
+ validate: (value: unknown, options?: {
939
+ abortEarly?: boolean;
940
+ stripUnknown?: boolean;
941
+ }) => {
942
+ value: T;
943
+ error?: {
944
+ details?: ReadonlyArray<JoiValidationErrorDetailLike>;
945
+ };
946
+ } | Promise<{
947
+ value: T;
948
+ error?: {
949
+ details?: ReadonlyArray<JoiValidationErrorDetailLike>;
950
+ };
951
+ }>;
952
+ };
953
+ type AjvErrorObjectLike = {
954
+ message?: string;
955
+ instancePath?: string;
956
+ schemaPath?: string;
957
+ params?: {
958
+ missingProperty?: string;
959
+ };
960
+ };
961
+ type AjvValidatorLike<T = unknown> = {
962
+ (value: unknown): boolean | Promise<boolean>;
963
+ errors?: ReadonlyArray<AjvErrorObjectLike> | null;
964
+ };
965
+ type ValibotPathItemLike = {
966
+ key?: unknown;
967
+ };
968
+ type ValibotIssueLike = {
969
+ message: string;
970
+ path?: ReadonlyArray<ValibotPathItemLike>;
971
+ };
972
+ type ValibotSafeParseResult<T = unknown> = {
973
+ success: true;
974
+ output: T;
975
+ issues?: undefined;
976
+ } | {
977
+ success: false;
978
+ output?: undefined;
979
+ issues: ReadonlyArray<ValibotIssueLike>;
980
+ };
981
+ type ValibotSafeParseLike = <TSchema, TOutput = unknown>(schema: TSchema, value: unknown, config?: {
982
+ abortEarly?: boolean;
983
+ }) => ValibotSafeParseResult<TOutput> | Promise<ValibotSafeParseResult<TOutput>>;
984
+ type ArkTypeProblemLike = {
985
+ path?: ReadonlyArray<string | number>;
986
+ message?: string;
987
+ problem?: string;
988
+ };
989
+ type ArkTypeErrorsLike = ReadonlyArray<ArkTypeProblemLike> & {
990
+ summary?: string;
991
+ };
992
+ type ArkTypeLike<T = unknown> = {
993
+ (value: unknown): T | ArkTypeErrorsLike;
994
+ errors?: unknown;
995
+ };
996
+ type IoTsContextEntryLike = {
997
+ key: string;
998
+ };
999
+ type IoTsDecodeErrorLike = {
1000
+ message?: string;
1001
+ context: ReadonlyArray<IoTsContextEntryLike>;
1002
+ };
1003
+ type IoTsDecoderLike<T = unknown> = {
1004
+ decode: (value: unknown) => {
1005
+ _tag: 'Left';
1006
+ left: ReadonlyArray<IoTsDecodeErrorLike>;
1007
+ } | {
1008
+ _tag: 'Right';
1009
+ right: T;
1010
+ };
1011
+ };
1012
+ type SuperstructFailureLike = {
1013
+ message?: string;
1014
+ path?: ReadonlyArray<string | number>;
1015
+ key?: string | number;
1016
+ branch?: ReadonlyArray<unknown>;
1017
+ failures?: () => ReadonlyArray<SuperstructFailureLike>;
1018
+ };
1019
+ type SuperstructValidateLike = <TStruct, TOutput = unknown>(value: unknown, struct: TStruct) => readonly [failure: SuperstructFailureLike, value: undefined] | readonly [failure: undefined, value: TOutput] | Promise<readonly [failure: SuperstructFailureLike, value: undefined] | readonly [failure: undefined, value: TOutput]>;
1020
+ type VineValidationMessageLike = {
1021
+ field: string;
1022
+ message: string;
1023
+ index?: number;
1024
+ };
1025
+ type VineValidationErrorLike = {
1026
+ messages: ReadonlyArray<VineValidationMessageLike>;
1027
+ };
1028
+ type VineValidatorLike<T = unknown> = {
1029
+ validate: (value: unknown) => Promise<T> | T;
1030
+ };
1031
+ type ListQueryInput = {
1032
+ skip?: string;
1033
+ limit?: string;
1034
+ page?: string;
1035
+ page_size?: string;
1036
+ skim?: 'true' | 'false';
1037
+ include_permissions?: 'true' | 'false';
1038
+ include_count?: 'true' | 'false';
1039
+ include_extra_headers?: 'true' | 'false';
1040
+ };
1041
+ type CreateQueryInput = {
1042
+ include_permissions?: 'true' | 'false';
1043
+ };
1044
+ type ReadQueryInput = {
1045
+ include_permissions?: 'true' | 'false';
1046
+ try_list?: 'true' | 'false';
1047
+ };
1048
+ type UpdateQueryInput = {
1049
+ returning_all?: 'true' | 'false';
1050
+ };
1051
+ type UpsertQueryInput = {
1052
+ returning_all?: 'true' | 'false';
1053
+ include_permissions?: 'true' | 'false';
1054
+ };
1055
+ type AdvancedListBody = {
1056
+ filter?: Filter | unknown[];
1057
+ select?: Projection;
1058
+ sort?: Sort;
1059
+ populate?: Populate[] | string;
1060
+ include?: Include | Include[];
1061
+ tasks?: Task | Task[];
1062
+ skip?: string | number;
1063
+ limit?: string | number;
1064
+ page?: string | number;
1065
+ pageSize?: string | number;
1066
+ options?: {
1067
+ skim?: boolean;
1068
+ includePermissions?: boolean;
1069
+ includeCount?: boolean;
1070
+ includeExtraHeaders?: boolean;
1071
+ populateAccess?: unknown;
1072
+ };
1073
+ };
1074
+ type CountBody = {
1075
+ filter?: Filter | unknown[];
1076
+ options?: {
1077
+ access?: unknown;
1078
+ };
1079
+ };
1080
+ type AdvancedReadFilterBody = {
1081
+ filter?: Filter | unknown[];
1082
+ select?: Projection;
1083
+ sort?: Sort;
1084
+ populate?: Populate[] | string;
1085
+ include?: Include | Include[];
1086
+ tasks?: Task | Task[];
1087
+ options?: {
1088
+ skim?: boolean;
1089
+ includePermissions?: boolean;
1090
+ tryList?: boolean;
1091
+ populateAccess?: unknown;
1092
+ };
1093
+ };
1094
+ type AdvancedReadBody = {
1095
+ select?: Projection;
1096
+ populate?: Populate[] | string;
1097
+ include?: Include | Include[];
1098
+ tasks?: Task | Task[];
1099
+ options?: {
1100
+ skim?: boolean;
1101
+ includePermissions?: boolean;
1102
+ tryList?: boolean;
1103
+ populateAccess?: unknown;
1104
+ };
1105
+ };
1106
+ type AdvancedCreateBody = {
1107
+ data: unknown;
1108
+ select?: Projection;
1109
+ populate?: Populate[] | string;
1110
+ tasks?: Task | Task[];
1111
+ options?: {
1112
+ includePermissions?: boolean;
1113
+ populateAccess?: unknown;
1114
+ };
1115
+ };
1116
+ type AdvancedUpdateBody = {
1117
+ data: unknown;
1118
+ select?: Projection;
1119
+ populate?: Populate[] | string;
1120
+ tasks?: Task | Task[];
1121
+ options?: {
1122
+ returningAll?: boolean;
1123
+ includePermissions?: boolean;
1124
+ populateAccess?: unknown;
1125
+ };
1126
+ };
1127
+ type AdvancedUpsertBody = {
1128
+ data: Record<string, unknown>;
1129
+ select?: Projection;
1130
+ populate?: Populate[] | string;
1131
+ tasks?: Task | Task[];
1132
+ options?: {
1133
+ returningAll?: boolean;
1134
+ includePermissions?: boolean;
1135
+ populateAccess?: unknown;
1136
+ };
1137
+ };
1138
+ type DistinctBody = {
1139
+ filter?: Filter | unknown[];
1140
+ };
1141
+ type SubListBody = {
1142
+ filter?: Filter;
1143
+ select?: string[];
1144
+ };
1145
+ type SubReadBody = {
1146
+ select?: string[];
1147
+ populate?: SubPopulate | SubPopulate[] | string | string[];
1148
+ };
1149
+
868
1150
  interface DefaultFindOneArgs<TModel = unknown> extends Omit<FindOneArgs<TModel>, 'overrides'> {
869
1151
  }
870
1152
  interface DefaultFindByIdArgs<TModel = unknown> extends Omit<FindByIdArgs<TModel>, 'overrides'> {
871
1153
  }
872
1154
  interface DefaultFindArgs<TModel = unknown> extends Omit<FindArgs<TModel>, 'overrides'> {
873
1155
  }
874
- type RequestZodSchema = z.ZodTypeAny;
1156
+ type RequestSchema = RequestSchemaLike;
1157
+ type NestedRequestSchema = {
1158
+ default?: RequestSchema;
1159
+ data?: RequestSchema;
1160
+ };
875
1161
  type SubRouteGuardOptions = Record<string, Validation | Record<string, Validation>>;
876
1162
  interface RequestSchemas {
877
- create?: RequestZodSchema;
878
- update?: RequestZodSchema;
879
- upsert?: RequestZodSchema;
880
- count?: RequestZodSchema;
881
- distinct?: RequestZodSchema;
882
- advancedList?: RequestZodSchema;
883
- advancedReadFilter?: RequestZodSchema;
884
- advancedRead?: RequestZodSchema;
885
- advancedCreate?: RequestZodSchema;
886
- advancedCreateData?: RequestZodSchema;
887
- advancedUpdate?: RequestZodSchema;
888
- advancedUpdateData?: RequestZodSchema;
889
- advancedUpsert?: RequestZodSchema;
890
- advancedUpsertData?: RequestZodSchema;
891
- subList?: RequestZodSchema;
892
- subRead?: RequestZodSchema;
893
- subCreate?: RequestZodSchema;
894
- subUpdate?: RequestZodSchema;
895
- subBulkUpdate?: RequestZodSchema;
1163
+ create?: RequestSchema;
1164
+ update?: RequestSchema;
1165
+ upsert?: RequestSchema;
1166
+ count?: RequestSchema;
1167
+ distinct?: RequestSchema;
1168
+ advancedList?: RequestSchema;
1169
+ advancedReadFilter?: RequestSchema;
1170
+ advancedRead?: RequestSchema;
1171
+ advancedCreate?: RequestSchema | NestedRequestSchema;
1172
+ advancedCreateData?: RequestSchema;
1173
+ advancedUpdate?: RequestSchema | NestedRequestSchema;
1174
+ advancedUpdateData?: RequestSchema;
1175
+ advancedUpsert?: RequestSchema | NestedRequestSchema;
1176
+ advancedUpsertData?: RequestSchema;
1177
+ subList?: RequestSchema;
1178
+ subRead?: RequestSchema;
1179
+ subCreate?: RequestSchema;
1180
+ subUpdate?: RequestSchema;
1181
+ subBulkUpdate?: RequestSchema;
896
1182
  }
897
1183
  interface DataRequestSchemas {
898
- advancedList?: RequestZodSchema;
899
- advancedReadFilter?: RequestZodSchema;
900
- advancedRead?: RequestZodSchema;
1184
+ advancedList?: RequestSchema;
1185
+ advancedReadFilter?: RequestSchema;
1186
+ advancedRead?: RequestSchema;
901
1187
  }
902
1188
  interface Defaults<TModel = unknown> {
903
1189
  findOneArgs?: DefaultFindOneArgs<TModel>;
@@ -1061,26 +1347,26 @@ interface ExtendedModelRouterOptions<TModel = unknown> extends ModelRouterOption
1061
1347
  'afterPersist.create'?: ModelDocumentHook;
1062
1348
  'afterPersist.update'?: ModelDocumentHook;
1063
1349
  onChange?: Record<string, ModelChangeHook>;
1064
- 'requestSchemas.create'?: RequestZodSchema;
1065
- 'requestSchemas.update'?: RequestZodSchema;
1066
- 'requestSchemas.upsert'?: RequestZodSchema;
1067
- 'requestSchemas.count'?: RequestZodSchema;
1068
- 'requestSchemas.distinct'?: RequestZodSchema;
1069
- 'requestSchemas.advancedList'?: RequestZodSchema;
1070
- 'requestSchemas.advancedReadFilter'?: RequestZodSchema;
1071
- 'requestSchemas.advancedRead'?: RequestZodSchema;
1072
- 'requestSchemas.advancedCreate.default'?: RequestZodSchema;
1073
- 'requestSchemas.advancedCreate.data'?: RequestZodSchema;
1074
- 'requestSchemas.advancedUpdate'?: RequestZodSchema;
1075
- 'requestSchemas.advancedUpdate.default'?: RequestZodSchema;
1076
- 'requestSchemas.advancedUpdate.data'?: RequestZodSchema;
1077
- 'requestSchemas.advancedUpsert.default'?: RequestZodSchema;
1078
- 'requestSchemas.advancedUpsert.data'?: RequestZodSchema;
1079
- 'requestSchemas.subList'?: RequestZodSchema;
1080
- 'requestSchemas.subRead'?: RequestZodSchema;
1081
- 'requestSchemas.subCreate'?: RequestZodSchema;
1082
- 'requestSchemas.subUpdate'?: RequestZodSchema;
1083
- 'requestSchemas.subBulkUpdate'?: RequestZodSchema;
1350
+ 'requestSchemas.create'?: RequestSchema;
1351
+ 'requestSchemas.update'?: RequestSchema;
1352
+ 'requestSchemas.upsert'?: RequestSchema;
1353
+ 'requestSchemas.count'?: RequestSchema;
1354
+ 'requestSchemas.distinct'?: RequestSchema;
1355
+ 'requestSchemas.advancedList'?: RequestSchema;
1356
+ 'requestSchemas.advancedReadFilter'?: RequestSchema;
1357
+ 'requestSchemas.advancedRead'?: RequestSchema;
1358
+ 'requestSchemas.advancedCreate.default'?: RequestSchema;
1359
+ 'requestSchemas.advancedCreate.data'?: RequestSchema;
1360
+ 'requestSchemas.advancedUpdate'?: RequestSchema;
1361
+ 'requestSchemas.advancedUpdate.default'?: RequestSchema;
1362
+ 'requestSchemas.advancedUpdate.data'?: RequestSchema;
1363
+ 'requestSchemas.advancedUpsert.default'?: RequestSchema;
1364
+ 'requestSchemas.advancedUpsert.data'?: RequestSchema;
1365
+ 'requestSchemas.subList'?: RequestSchema;
1366
+ 'requestSchemas.subRead'?: RequestSchema;
1367
+ 'requestSchemas.subCreate'?: RequestSchema;
1368
+ 'requestSchemas.subUpdate'?: RequestSchema;
1369
+ 'requestSchemas.subBulkUpdate'?: RequestSchema;
1084
1370
  'defaults.findOneArgs'?: DefaultFindOneArgs<TModel>;
1085
1371
  'defaults.findOneOptions'?: FindOneOptions;
1086
1372
  'defaults.findByIdArgs'?: DefaultFindByIdArgs<TModel>;
@@ -1105,13 +1391,30 @@ interface ExtendedModelRouterOptions<TModel = unknown> extends ModelRouterOption
1105
1391
  'defaults.publicUpdateOptions'?: PublicUpdateOptions;
1106
1392
  }
1107
1393
  interface ExtendedDataRouterOptions<TData = unknown> extends DataRouterOptions<TData> {
1108
- 'requestSchemas.advancedList'?: RequestZodSchema;
1109
- 'requestSchemas.advancedReadFilter'?: RequestZodSchema;
1110
- 'requestSchemas.advancedRead'?: RequestZodSchema;
1394
+ 'requestSchemas.advancedList'?: RequestSchema;
1395
+ 'requestSchemas.advancedReadFilter'?: RequestSchema;
1396
+ 'requestSchemas.advancedRead'?: RequestSchema;
1111
1397
  }
1112
1398
 
1113
1399
  interface DistinctArgs<T = unknown> {
1114
1400
  filter?: Filter<T>;
1115
1401
  }
1116
1402
 
1117
- export { type GlobalPermissionValue as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, Codes as C, type DataBaseFilterHook as D, type DefaultModelRouterOptions as E, type Filter as F, type Defaults as G, type DistinctArgs as H, type Include as I, type DocPermissionsAccess as J, type ErrorResult as K, type ExistsOptions as L, type ExtendedDataRouterOptions as M, type ExtendedDefaultModelRouterOptions as N, type ExtendedModelRouterOptions as O, type Projection as P, FilterOperator as Q, type FindAccess as R, type Sort as S, type Task as T, type FindArgs as U, type FindByIdArgs as V, type FindByIdOptions as W, type FindOneArgs as X, type FindOneOptions as Y, type FindOptions as Z, type GlobalOptions as _, type Populate as a, type SelectAccess as a$, type GuardHook as a0, type IdentifierHook as a1, type KeyValueProjection as a2, type ListResult as a3, type MaybePromise as a4, type ModelBaseFilterHook as a5, type ModelChangeHook as a6, type ModelDeleteHook as a7, type ModelDocPermissionsHook as a8, type ModelDocument as a9, type RootDataListQueryEntry as aA, type RootDataOperation as aB, type RootDataReadByFilterQueryEntry as aC, type RootDataReadByIdQueryEntry as aD, type RootModelCountQueryEntry as aE, type RootModelCreateQueryEntry as aF, type RootModelDeleteQueryEntry as aG, type RootModelDistinctQueryEntry as aH, type RootModelListQueryEntry as aI, type RootModelNewQueryEntry as aJ, type RootModelOperation as aK, type RootModelReadByFilterQueryEntry as aL, type RootModelReadByIdQueryEntry as aM, type RootModelSubBulkUpdateQueryEntry as aN, type RootModelSubCreateQueryEntry as aO, type RootModelSubDeleteQueryEntry as aP, type RootModelSubListQueryEntry as aQ, type RootModelSubReadQueryEntry as aR, type RootModelSubUpdateQueryEntry as aS, type RootModelUpdateQueryEntry as aT, type RootModelUpsertQueryEntry as aU, type RootOperationResult as aV, type RootQueryEntry as aW, type RootRouterOptions as aX, type RootSubOperation as aY, type RootTarget as aZ, type RouteGuardAccess as a_, type ModelDocumentHook as aa, type ModelHook as ab, type ModelHookContext as ac, type ModelIdentifierHook as ad, type ModelListHook as ae, type ModelOverrideFilterHook as af, type ModelRequest as ag, type ModelRouterOptions as ah, type ModelValidateHook as ai, type PathValue as aj, type PermissionSchema as ak, type PopulateAccess as al, type PrepareAccess as am, type PublicCreateArgs as an, type PublicCreateOptions as ao, type PublicListArgs as ap, type PublicListOptions as aq, type PublicOutput as ar, type PublicReadArgs as as, type PublicReadOptions as at, type PublicUpdateArgs as au, type PublicUpdateOptions as av, type PublicUpsertArgs as aw, type PublicUpsertOptions as ax, type Request as ay, type RequestSchemas as az, type SubPopulate as b, type SelectedPopulatedPublicOutput as b0, type SelectedPublicOutput as b1, type ServiceResult as b2, type SingleResult as b3, type SortOrder as b4, StatusCodes as b5, type SubQueryEntry as b6, type TransformAccess as b7, type TypedFilter as b8, type UpdateByIdArgs as b9, type UpdateByIdOptions as ba, type UpdateOneArgs as bb, type UpdateOneOptions as bc, type UpsertArgs as bd, type UpsertOptions as be, type ValidateAccess as bf, type ValidateRule as bg, type Validation as bh, DataService as bi, Model as bj, Service as bk, PublicService as bl, type AccessRouterPermissionMap as bm, type AccessRouterPermissions as bn, type Permissions as bo, type AccessRouterFieldKey as c, type AccessRouterLogger as d, type AccessRouterRequest as e, type AccessRouterRequestExtensions as f, type AfterPersistAccess as g, type CreateArgs as h, type CreateOptions as i, CustomHeaders as j, type DataFilter as k, type DataFindArgs as l, type DataFindOneArgs as m, type DataFindOneOptions as n, type DataFindOptions as o, type DataHook as p, type DataHookContext as q, type DataIdentifierHook as r, type DataListHook as s, type DataOverrideFilterHook as t, type DataRequest as u, type DataRequestSchemas as v, type DataRouterOptions as w, type DecorateAccess as x, type DecorateAllAccess as y, type DeepFieldPath as z };
1403
+ declare function parsePathParam(value: string | string[] | undefined, parameter: string): string;
1404
+ declare function parseQuery<TSchema extends z.ZodTypeAny>(schema: TSchema, value: unknown): z.output<TSchema>;
1405
+ declare function parseBody<TSchema extends z.ZodTypeAny>(schema: TSchema, value: unknown): z.output<TSchema>;
1406
+ declare function parseBodyWithSchema<TSchema extends z.ZodTypeAny>(schema: TSchema, value: unknown, userSchema?: RequestSchemaLike): Promise<z.output<TSchema>>;
1407
+ declare function parseNestedBodyWithSchema(schema: z.ZodTypeAny, value: unknown, nestedKey: string, userSchema?: RequestSchemaLike): Promise<Record<string, unknown>>;
1408
+ declare function defineRequestSchema<T = unknown>(validator: RequestSchemaValidator<T>, options?: RequestSchemaOptions): RequestSchemaAdapter<T>;
1409
+ declare function fromZod<TSchema extends z.ZodTypeAny>(schema: TSchema): RequestSchemaValidator<z.output<TSchema>>;
1410
+ declare function fromStandardSchema<TSchema extends StandardSchemaV1>(schema: TSchema): RequestSchemaValidator<StandardSchemaInferOutput<TSchema>>;
1411
+ declare function fromYup<TSchema extends YupSchemaLike>(schema: TSchema): RequestSchemaValidator;
1412
+ declare function fromJoi<TSchema extends JoiSchemaLike>(schema: TSchema): RequestSchemaValidator;
1413
+ declare function fromAjv<TValue = unknown>(validator: AjvValidatorLike<TValue>): RequestSchemaValidator<TValue>;
1414
+ declare function fromValibot<TSchema, TOutput = unknown>(schema: TSchema, safeParse: ValibotSafeParseLike): RequestSchemaValidator<TOutput>;
1415
+ declare function fromArkType<TValue = unknown>(type: ArkTypeLike<TValue>): RequestSchemaValidator<TValue>;
1416
+ declare function fromIoTs<TValue = unknown>(decoder: IoTsDecoderLike<TValue>): RequestSchemaValidator<TValue>;
1417
+ declare function fromSuperstruct<TStruct, TOutput = unknown>(struct: TStruct, validate: SuperstructValidateLike): RequestSchemaValidator<TOutput>;
1418
+ declare function fromVine<TValue = unknown>(validator: VineValidatorLike<TValue>): RequestSchemaValidator<TValue>;
1419
+
1420
+ export { type FindAccess as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, Codes as C, type DataBaseFilterHook as D, type DataHook as E, type DataHookContext as F, type DataIdentifierHook as G, type DataListHook as H, type DataOverrideFilterHook as I, type DataRequest as J, type DataRequestSchemas as K, type DataRouterOptions as L, type DecorateAccess as M, type DecorateAllAccess as N, type DeepFieldPath as O, type DefaultModelRouterOptions as P, type Defaults as Q, type DistinctArgs as R, type DistinctBody as S, type DocPermissionsAccess as T, type ErrorResult as U, type ExistsOptions as V, type ExtendedDataRouterOptions as W, type ExtendedDefaultModelRouterOptions as X, type ExtendedModelRouterOptions as Y, type Filter as Z, FilterOperator as _, type AccessRouterFieldKey as a, type RootDataOperation as a$, type FindArgs as a0, type FindByIdArgs as a1, type FindByIdOptions as a2, type FindOneArgs as a3, type FindOneOptions as a4, type FindOptions as a5, type GlobalOptions as a6, type GlobalPermissionValue as a7, type GuardHook as a8, type IdentifierHook as a9, type Populate as aA, type PopulateAccess as aB, type PrepareAccess as aC, type Projection as aD, type PublicCreateArgs as aE, type PublicCreateOptions as aF, type PublicListArgs as aG, type PublicListOptions as aH, type PublicOutput as aI, type PublicReadArgs as aJ, type PublicReadOptions as aK, type PublicUpdateArgs as aL, type PublicUpdateOptions as aM, type PublicUpsertArgs as aN, type PublicUpsertOptions as aO, type ReadQueryInput as aP, type Request as aQ, type RequestSchemaAdapter as aR, type RequestSchemaFailure as aS, type RequestSchemaIssue as aT, type RequestSchemaLike as aU, type RequestSchemaOptions as aV, type RequestSchemaResult as aW, type RequestSchemaSuccess as aX, type RequestSchemaValidator as aY, type RequestSchemas as aZ, type RootDataListQueryEntry as a_, type Include as aa, type IoTsContextEntryLike as ab, type IoTsDecodeErrorLike as ac, type IoTsDecoderLike as ad, type JoiSchemaLike as ae, type JoiValidationErrorDetailLike as af, type KeyValueProjection as ag, type ListQueryInput as ah, type ListResult as ai, type MaybePromise as aj, type ModelBaseFilterHook as ak, type ModelChangeHook as al, type ModelDeleteHook as am, type ModelDocPermissionsHook as an, type ModelDocument as ao, type ModelDocumentHook as ap, type ModelHook as aq, type ModelHookContext as ar, type ModelIdentifierHook as as, type ModelListHook as at, type ModelOverrideFilterHook as au, type ModelRequest as av, type ModelRouterOptions as aw, type ModelValidateHook as ax, type PathValue as ay, type PermissionSchema as az, type AccessRouterLogger as b, type Validation as b$, type RootDataReadByFilterQueryEntry as b0, type RootDataReadByIdQueryEntry as b1, type RootModelCountQueryEntry as b2, type RootModelCreateQueryEntry as b3, type RootModelDeleteQueryEntry as b4, type RootModelDistinctQueryEntry as b5, type RootModelListQueryEntry as b6, type RootModelNewQueryEntry as b7, type RootModelOperation as b8, type RootModelReadByFilterQueryEntry as b9, type StandardSchemaResult as bA, type StandardSchemaSuccess as bB, type StandardSchemaV1 as bC, StatusCodes as bD, type SubListBody as bE, type SubPopulate as bF, type SubQueryEntry as bG, type SubReadBody as bH, type SuperstructFailureLike as bI, type SuperstructValidateLike as bJ, type Task as bK, type TransformAccess as bL, type TypedFilter as bM, type UpdateByIdArgs as bN, type UpdateByIdOptions as bO, type UpdateOneArgs as bP, type UpdateOneOptions as bQ, type UpdateQueryInput as bR, type UpsertArgs as bS, type UpsertOptions as bT, type UpsertQueryInput as bU, type ValibotIssueLike as bV, type ValibotPathItemLike as bW, type ValibotSafeParseLike as bX, type ValibotSafeParseResult as bY, type ValidateAccess as bZ, type ValidateRule as b_, type RootModelReadByIdQueryEntry as ba, type RootModelSubBulkUpdateQueryEntry as bb, type RootModelSubCreateQueryEntry as bc, type RootModelSubDeleteQueryEntry as bd, type RootModelSubListQueryEntry as be, type RootModelSubReadQueryEntry as bf, type RootModelSubUpdateQueryEntry as bg, type RootModelUpdateQueryEntry as bh, type RootModelUpsertQueryEntry as bi, type RootOperationResult as bj, type RootQueryEntry as bk, type RootRouterOptions as bl, type RootSubOperation as bm, type RootTarget as bn, type RouteGuardAccess as bo, type SelectAccess as bp, type SelectedPopulatedPublicOutput as bq, type SelectedPublicOutput as br, type ServiceResult as bs, type SingleResult as bt, type Sort as bu, type SortOrder as bv, type StandardSchemaFailure as bw, type StandardSchemaInferOutput as bx, type StandardSchemaIssue as by, type StandardSchemaPathSegment as bz, type AccessRouterRequest as c, type ValidationError as c0, type VineValidationErrorLike as c1, type VineValidationMessageLike as c2, type VineValidatorLike as c3, type YupSchemaLike as c4, type YupValidationErrorLike as c5, defineRequestSchema as c6, fromAjv as c7, fromArkType as c8, fromIoTs as c9, fromJoi as ca, fromStandardSchema as cb, fromSuperstruct as cc, fromValibot as cd, fromVine as ce, fromYup as cf, fromZod as cg, parseBody as ch, parseBodyWithSchema as ci, parseNestedBodyWithSchema as cj, parsePathParam as ck, parseQuery as cl, DataService as cm, Model as cn, Service as co, PublicService as cp, type AccessRouterPermissionMap as cq, type AccessRouterPermissions as cr, type Permissions as cs, type AccessRouterRequestExtensions as d, type AdvancedCreateBody as e, type AdvancedListBody as f, type AdvancedReadBody as g, type AdvancedReadFilterBody as h, type AdvancedUpdateBody as i, type AdvancedUpsertBody as j, type AfterPersistAccess as k, type AjvErrorObjectLike as l, type AjvValidatorLike as m, type ArkTypeErrorsLike as n, type ArkTypeLike as o, type ArkTypeProblemLike as p, type CountBody as q, type CreateArgs as r, type CreateOptions as s, type CreateQueryInput as t, CustomHeaders as u, type DataFilter as v, type DataFindArgs as w, type DataFindOneArgs as x, type DataFindOneOptions as y, type DataFindOptions as z };