@web-ts-toolkit/access-router 0.30.0 → 0.31.1
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/advanced.d.mts +1433 -4
- package/advanced.d.ts +1433 -4
- package/index.d.mts +1157 -14
- package/index.d.ts +1157 -14
- package/index.js +7 -5
- package/index.mjs +7 -5
- package/package.json +3 -3
- package/parsers-B8bwUDPv.d.mts +0 -1436
- package/parsers-B8bwUDPv.d.ts +0 -1436
package/parsers-B8bwUDPv.d.mts
DELETED
|
@@ -1,1436 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
import express from 'express';
|
|
4
|
-
|
|
5
|
-
interface BooleanObject {
|
|
6
|
-
[key: string]: boolean;
|
|
7
|
-
}
|
|
8
|
-
interface AccessRouterPermissionMap {
|
|
9
|
-
}
|
|
10
|
-
type AccessRouterPermissionKey = Extract<keyof AccessRouterPermissionMap, string>;
|
|
11
|
-
type PermissionName = AccessRouterPermissionKey | (string & {});
|
|
12
|
-
declare class Permission {
|
|
13
|
-
private readonly permissions;
|
|
14
|
-
private readonly permissionKeys;
|
|
15
|
-
constructor(permissions: BooleanObject);
|
|
16
|
-
get keys(): readonly string[];
|
|
17
|
-
private normalizePermissionArgs;
|
|
18
|
-
hasKey(permission: PermissionName): boolean;
|
|
19
|
-
has(permission: PermissionName): boolean;
|
|
20
|
-
hasAny(permissionOrPermissions: PermissionName | readonly PermissionName[], ...permissions: PermissionName[]): boolean;
|
|
21
|
-
hasAll(permissionOrPermissions: PermissionName | readonly PermissionName[], ...permissions: PermissionName[]): boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
type Permissions = Permission;
|
|
25
|
-
type AccessRouterPermissions = Permission;
|
|
26
|
-
|
|
27
|
-
declare class Base<TModel = unknown> {
|
|
28
|
-
protected req: ModelRequest;
|
|
29
|
-
protected modelName: string;
|
|
30
|
-
constructor(req: ModelRequest, modelName: string);
|
|
31
|
-
decorate<T>(doc: T, access: DecorateAccess, context: ModelHookContext): Promise<T>;
|
|
32
|
-
decorateAll<T>(docs: T[], access: DecorateAllAccess, context: ModelHookContext): Promise<T[]>;
|
|
33
|
-
genAllowedFields(doc: unknown, access: SelectAccess, baseFields?: string[]): Promise<string[]>;
|
|
34
|
-
genDocPermissions(doc: unknown, access: DocPermissionsAccess, context: ModelHookContext): Promise<Record<string, unknown>>;
|
|
35
|
-
genFilter(access?: BaseFilterAccess, filter?: Filter<TModel>): Promise<Filter<TModel>>;
|
|
36
|
-
getIdentifier(): string | null;
|
|
37
|
-
genIDFilter(id: string): Promise<Filter<TModel>>;
|
|
38
|
-
genPopulate(access?: SelectAccess, populate?: Populate | Populate[] | string | null): Promise<Populate[]>;
|
|
39
|
-
genSelect(access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: string[]): Promise<string[]>;
|
|
40
|
-
genQuerySelect(access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: string[]): Promise<string[]>;
|
|
41
|
-
addEmptyPermissions<T>(doc: T): T;
|
|
42
|
-
addDocPermissions<T>(doc: T, access: DocPermissionsAccess, context: ModelHookContext): Promise<T>;
|
|
43
|
-
addFieldPermissions<T extends {
|
|
44
|
-
_id?: unknown;
|
|
45
|
-
}>(doc: T, access: DocPermissionsAccess, context: ModelHookContext): Promise<T>;
|
|
46
|
-
pickAllowedFields<T>(doc: T, access: SelectAccess, baseFields?: string[]): Promise<T>;
|
|
47
|
-
trimOutputFields<T>(doc: T, access: SelectAccess, baseFields?: string[]): Promise<T>;
|
|
48
|
-
prepare<T>(allowedData: T, access: PrepareAccess, context: ModelHookContext): Promise<T>;
|
|
49
|
-
runTasks<T extends object>(docObject: T, tasks: Task | Task[]): T;
|
|
50
|
-
transform<T>(doc: T, access: TransformAccess, context: ModelHookContext): Promise<T>;
|
|
51
|
-
afterPersist<T>(doc: T, access: AfterPersistAccess, context: ModelHookContext): Promise<T>;
|
|
52
|
-
changes(doc: Record<string, unknown>, context: ModelHookContext): Promise<void>;
|
|
53
|
-
beforeDelete<T>(doc: T, context: ModelHookContext): Promise<void>;
|
|
54
|
-
afterDelete<T>(doc: T, context: ModelHookContext): Promise<void>;
|
|
55
|
-
validate(allowedData: unknown, access: ValidateAccess, context: ModelHookContext): Promise<boolean | unknown[]>;
|
|
56
|
-
checkIfModelPermissionExists(accesses: DocPermissionsAccess[]): boolean;
|
|
57
|
-
protected validateClientFilter(filter: Filter | null | undefined): string[];
|
|
58
|
-
protected processInclude(include: Include | Include[]): {
|
|
59
|
-
includes: Include[];
|
|
60
|
-
includeLocalFields: any[];
|
|
61
|
-
includePaths: any[];
|
|
62
|
-
};
|
|
63
|
-
protected includeDocs(docs: any, include: Include | Include[]): Promise<any>;
|
|
64
|
-
private includeDocsList;
|
|
65
|
-
private includeDocsCount;
|
|
66
|
-
protected parseClientData<TValue>(filter: TValue): Promise<TValue>;
|
|
67
|
-
private handleSubQuery;
|
|
68
|
-
private handleDate;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
interface FindProps {
|
|
72
|
-
filter: Filter;
|
|
73
|
-
select?: Projection;
|
|
74
|
-
sort?: Sort;
|
|
75
|
-
populate?: Populate[] | string;
|
|
76
|
-
limit?: string | number;
|
|
77
|
-
skip?: string | number;
|
|
78
|
-
lean?: boolean;
|
|
79
|
-
}
|
|
80
|
-
interface FindOneProps {
|
|
81
|
-
filter: Filter;
|
|
82
|
-
select?: Projection;
|
|
83
|
-
sort?: Sort;
|
|
84
|
-
populate?: Populate[] | string;
|
|
85
|
-
lean?: boolean;
|
|
86
|
-
}
|
|
87
|
-
type SortValue = 1 | -1 | 'asc' | 'ascending' | 'desc' | 'descending';
|
|
88
|
-
type SortType = string | [string, SortValue][] | {
|
|
89
|
-
[key: string]: SortValue;
|
|
90
|
-
} | Map<string, SortValue> | null | undefined;
|
|
91
|
-
declare class Model {
|
|
92
|
-
modelName: string;
|
|
93
|
-
model: mongoose.Model<any>;
|
|
94
|
-
constructor(modelName: string);
|
|
95
|
-
new(): any;
|
|
96
|
-
create(data: any): Promise<any>;
|
|
97
|
-
find({ filter, select, sort, populate, limit, skip, lean }: FindProps): mongoose.Query<any[], any, {}, any, "find", {}>;
|
|
98
|
-
validateSort(sort: SortType, logError?: (msg: string, ...args: unknown[]) => void): boolean;
|
|
99
|
-
findOne({ filter, select, sort, populate, lean }: FindOneProps): mongoose.Query<any, any, {}, any, "findOne", {}>;
|
|
100
|
-
exists(filter: any): mongoose.Query<any, any, {}, any, "findOne", {}>;
|
|
101
|
-
countDocuments(filter?: {}): mongoose.Query<number, any, {}, any, "countDocuments", {}>;
|
|
102
|
-
distinct(field: string, conditions?: {}): mongoose.Query<any[], any, {}, any, "distinct", {}>;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
declare class Service<TModel = unknown> extends Base<TModel> {
|
|
106
|
-
protected model: Model;
|
|
107
|
-
protected options: ModelRouterOptions<TModel>;
|
|
108
|
-
defaults: Defaults<TModel>;
|
|
109
|
-
protected baseFields: string[];
|
|
110
|
-
protected baseFieldsExt: string[];
|
|
111
|
-
private asServiceHookContext;
|
|
112
|
-
constructor(req: ModelRequest, modelName: string);
|
|
113
|
-
findOne(filter: Filter<TModel>, args?: FindOneArgs<TModel>, options?: FindOneOptions): Promise<SingleResult<TModel> | ErrorResult>;
|
|
114
|
-
findById(id: string, args?: FindByIdArgs<TModel>, options?: FindByIdOptions): Promise<SingleResult<TModel> | ErrorResult>;
|
|
115
|
-
find(filter: Filter<TModel>, args?: FindArgs<TModel>, options?: FindOptions, decorate?: Function): Promise<ListResult<TModel> | ErrorResult>;
|
|
116
|
-
create(data: any, args?: CreateArgs, options?: CreateOptions, decorate?: Function): Promise<ListResult<TModel> | ErrorResult>;
|
|
117
|
-
new(): Promise<SingleResult<TModel>>;
|
|
118
|
-
updateOne(filter: Filter<TModel>, data: any, args?: UpdateOneArgs<TModel>, options?: UpdateOneOptions, decorate?: Function): Promise<SingleResult<TModel> | ErrorResult>;
|
|
119
|
-
updateById(id: string, data: any, args?: UpdateByIdArgs<TModel>, options?: UpdateByIdOptions, decorate?: Function): Promise<SingleResult<TModel> | ErrorResult>;
|
|
120
|
-
upsert(filter: Filter<TModel>, data: any, args?: UpsertArgs<TModel>, options?: UpsertOptions, decorate?: Function): Promise<ServiceResult<TModel>>;
|
|
121
|
-
delete(id: string): Promise<SingleResult<unknown> | ErrorResult>;
|
|
122
|
-
exists(filter: Filter<TModel>, options: ExistsOptions & {
|
|
123
|
-
includeId: true;
|
|
124
|
-
}): Promise<SingleResult<unknown> | ErrorResult>;
|
|
125
|
-
exists(filter: Filter<TModel>, options?: ExistsOptions): Promise<SingleResult<boolean> | ErrorResult>;
|
|
126
|
-
distinct(field: string, args?: DistinctArgs<TModel>): Promise<ListResult<unknown> | ErrorResult>;
|
|
127
|
-
count(filter: Filter<TModel>, access?: BaseFilterAccess): Promise<SingleResult<number> | ErrorResult>;
|
|
128
|
-
getDocPermissions(doc: any): unknown;
|
|
129
|
-
private resolveFindOneArgs;
|
|
130
|
-
private resolveFindOneOptions;
|
|
131
|
-
private resolveFindByIdArgs;
|
|
132
|
-
private resolveFindByIdOptions;
|
|
133
|
-
private resolveFindArgs;
|
|
134
|
-
private resolveFindOptions;
|
|
135
|
-
private resolveCreateArgs;
|
|
136
|
-
private resolveCreateOptions;
|
|
137
|
-
private resolveUpdateOneArgs;
|
|
138
|
-
private resolveUpdateOneOptions;
|
|
139
|
-
private resolveUpdateByIdArgs;
|
|
140
|
-
private resolveUpdateByIdOptions;
|
|
141
|
-
private resolveUpsertArgs;
|
|
142
|
-
private resolveUpsertOptions;
|
|
143
|
-
private resolveExistsOptions;
|
|
144
|
-
private getFieldPermissionAccess;
|
|
145
|
-
private getAccessibleIdSet;
|
|
146
|
-
listSub(id: any, sub: any, options?: {
|
|
147
|
-
filter: Filter;
|
|
148
|
-
select: string[];
|
|
149
|
-
}): Promise<ListResult | ErrorResult>;
|
|
150
|
-
readSub(id: any, sub: any, subId: any, options?: {
|
|
151
|
-
select: string[];
|
|
152
|
-
populate: SubPopulate | SubPopulate[];
|
|
153
|
-
}): Promise<SingleResult | ErrorResult>;
|
|
154
|
-
updateSub(id: any, sub: any, subId: any, data: any): Promise<SingleResult | ErrorResult>;
|
|
155
|
-
bulkUpdateSub(id: any, sub: any, data: any): Promise<ListResult | ErrorResult>;
|
|
156
|
-
createSub(id: any, sub: any, data: any, options?: {
|
|
157
|
-
addFirst: boolean;
|
|
158
|
-
}): Promise<ListResult | ErrorResult>;
|
|
159
|
-
deleteSub(id: any, sub: any, subId: any): Promise<SingleResult | ErrorResult>;
|
|
160
|
-
getParentDoc(id: any, sub: any, args?: {
|
|
161
|
-
populate?: SubPopulate | SubPopulate[];
|
|
162
|
-
}, options?: {
|
|
163
|
-
access?: BaseFilterAccess;
|
|
164
|
-
lean?: boolean;
|
|
165
|
-
}): Promise<any>;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
declare class PublicService<TModel = unknown> extends Service<TModel> {
|
|
169
|
-
_list<TSelect extends Projection | undefined = undefined, TPopulate extends Populate[] | string | undefined = undefined>(filter: Filter<TModel>, args?: Omit<PublicListArgs, 'select' | 'populate'> & {
|
|
170
|
-
select?: TSelect;
|
|
171
|
-
populate?: TPopulate;
|
|
172
|
-
}, options?: PublicListOptions): Promise<ListResult<SelectedPopulatedPublicOutput<TModel, TSelect, TPopulate>> | ErrorResult>;
|
|
173
|
-
_create<TSelect extends Projection | undefined = undefined, TPopulate extends Populate[] | string | undefined = undefined>(data: any, args?: Omit<PublicCreateArgs, 'select' | 'populate'> & {
|
|
174
|
-
select?: TSelect;
|
|
175
|
-
populate?: TPopulate;
|
|
176
|
-
}, options?: PublicCreateOptions): Promise<ListResult<SelectedPopulatedPublicOutput<TModel, TSelect, TPopulate>> | ErrorResult>;
|
|
177
|
-
_new(): Promise<SingleResult<PublicOutput<TModel>>>;
|
|
178
|
-
_read<TSelect extends Projection | undefined = undefined, TPopulate extends Populate[] | string | undefined = undefined>(id: string, args?: Omit<PublicReadArgs, 'select' | 'populate'> & {
|
|
179
|
-
select?: TSelect;
|
|
180
|
-
populate?: TPopulate;
|
|
181
|
-
}, options?: PublicReadOptions): Promise<SingleResult<SelectedPopulatedPublicOutput<TModel, TSelect, TPopulate>> | ErrorResult>;
|
|
182
|
-
_readFilter<TSelect extends Projection | undefined = undefined, TPopulate extends Populate[] | string | undefined = undefined>(filter: Filter<TModel>, args?: Omit<PublicReadArgs, 'select' | 'populate'> & {
|
|
183
|
-
select?: TSelect;
|
|
184
|
-
populate?: TPopulate;
|
|
185
|
-
sort?: Sort;
|
|
186
|
-
}, options?: PublicReadOptions): Promise<SingleResult<SelectedPopulatedPublicOutput<TModel, TSelect, TPopulate>> | ErrorResult>;
|
|
187
|
-
_update<TSelect extends Projection | undefined = undefined, TPopulate extends Populate[] | string | undefined = undefined>(id: string, data: any, args?: Omit<PublicUpdateArgs, 'select' | 'populate'> & {
|
|
188
|
-
select?: TSelect;
|
|
189
|
-
populate?: TPopulate;
|
|
190
|
-
}, options?: PublicUpdateOptions): Promise<SingleResult<SelectedPopulatedPublicOutput<TModel, TSelect, TPopulate>> | ErrorResult>;
|
|
191
|
-
_upsert<TSelect extends Projection | undefined = undefined, TPopulate extends Populate[] | string | undefined = undefined>(data: Record<string, unknown>, args?: Omit<PublicUpsertArgs, 'select' | 'populate'> & {
|
|
192
|
-
select?: TSelect;
|
|
193
|
-
populate?: TPopulate;
|
|
194
|
-
}, options?: PublicUpsertOptions): Promise<ServiceResult<SelectedPopulatedPublicOutput<TModel, TSelect, TPopulate>> | ErrorResult>;
|
|
195
|
-
_delete(id: string): Promise<SingleResult<unknown> | ErrorResult>;
|
|
196
|
-
_distinct(field: string, options?: DistinctArgs<TModel>): Promise<ListResult<unknown> | ErrorResult>;
|
|
197
|
-
_count(filter: Filter<TModel>, access?: BaseFilterAccess): Promise<SingleResult<number> | ErrorResult>;
|
|
198
|
-
private resolvePublicListArgs;
|
|
199
|
-
private resolvePublicListOptions;
|
|
200
|
-
private resolvePublicCreateArgs;
|
|
201
|
-
private resolvePublicCreateOptions;
|
|
202
|
-
private resolvePublicReadArgs;
|
|
203
|
-
private resolvePublicReadFilterArgs;
|
|
204
|
-
private resolvePublicReadOptions;
|
|
205
|
-
private resolvePublicUpdateArgs;
|
|
206
|
-
private resolvePublicUpdateOptions;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
declare class DataService<T> {
|
|
210
|
-
protected req: DataRequest;
|
|
211
|
-
protected dataName: string;
|
|
212
|
-
protected options: DataRouterOptions<T>;
|
|
213
|
-
protected data: T[];
|
|
214
|
-
constructor(req: DataRequest, dataName: string);
|
|
215
|
-
findOne<TSelect extends Projection | undefined = undefined>(filter: DataFilter<T>, args?: DataFindOneArgs<T, TSelect>, options?: DataFindOneOptions): Promise<SingleResult<SelectedPublicOutput<T, TSelect>> | ErrorResult>;
|
|
216
|
-
findById<TSelect extends Projection | undefined = undefined>(id: string, args?: DataFindOneArgs<T, TSelect>, options?: DataFindOneOptions): Promise<SingleResult<SelectedPublicOutput<T, TSelect>> | ErrorResult>;
|
|
217
|
-
find<TSelect extends Projection | undefined = undefined>(filter: DataFilter<T>, args?: DataFindArgs<T, TSelect>, options?: DataFindOptions): Promise<ListResult<SelectedPublicOutput<T, TSelect>> | ErrorResult>;
|
|
218
|
-
decorate<TDoc>(doc: TDoc, access: DecorateAccess, context?: DataHookContext): Promise<TDoc>;
|
|
219
|
-
decorateAll<TDoc>(docs: TDoc[], access: DecorateAllAccess, context?: DataHookContext): Promise<TDoc[]>;
|
|
220
|
-
genAllowedFields(doc: unknown, access: SelectAccess, baseFields?: string[]): Promise<string[]>;
|
|
221
|
-
genFilter(access?: BaseFilterAccess, filter?: DataFilter<T>): Promise<DataFilter<T>>;
|
|
222
|
-
genIDFilter(id: string): Promise<DataFilter<T>>;
|
|
223
|
-
genSelect(access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: string[]): Promise<string[]>;
|
|
224
|
-
genQuerySelect(access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: string[]): Promise<string[]>;
|
|
225
|
-
pickAllowedFields<TDoc>(doc: TDoc, access: SelectAccess, baseFields?: string[]): Promise<TDoc>;
|
|
226
|
-
trimOutputFields<TDoc>(doc: TDoc, access: SelectAccess, baseFields?: string[]): Promise<TDoc>;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
type InternalModelHookContext = ModelHookContext & {
|
|
230
|
-
fieldPermissionAccess?: {
|
|
231
|
-
readIds?: Set<string>;
|
|
232
|
-
updateIds?: Set<string>;
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
declare class Core {
|
|
236
|
-
private req;
|
|
237
|
-
private caches;
|
|
238
|
-
constructor(req: AccessRouterBaseRequest);
|
|
239
|
-
getIdentifier(modelName: string): string;
|
|
240
|
-
genIDFilter<TModel = unknown>(modelName: string, id: string): Promise<Filter<TModel>>;
|
|
241
|
-
genFilter<TModel = unknown>(modelName: string, access?: BaseFilterAccess, _filter?: Filter<TModel>): Promise<Filter<TModel>>;
|
|
242
|
-
private removePrefix;
|
|
243
|
-
genAllowedFields(modelName: string, doc: unknown, access: SelectAccess, baseFields?: any[]): Promise<string[]>;
|
|
244
|
-
pickAllowedFields<T>(modelName: string, doc: T, access: SelectAccess, baseFields?: any[]): Promise<T>;
|
|
245
|
-
genSelect(modelName: string, access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: any[]): Promise<string[]>;
|
|
246
|
-
genPopulate(modelName: string, access?: SelectAccess | BaseFilterAccess, _populate?: Populate | Populate[] | string | null): Promise<(string | Populate)[]>;
|
|
247
|
-
validate(modelName: string, allowedData: unknown, access: ValidateAccess, context: ModelHookContext): Promise<boolean | unknown[]>;
|
|
248
|
-
prepare<T>(modelName: string, allowedData: T, access: PrepareAccess, context: ModelHookContext): Promise<T>;
|
|
249
|
-
transform<T>(modelName: string, doc: T, access: TransformAccess, context: ModelHookContext): Promise<T>;
|
|
250
|
-
afterPersist<T>(modelName: string, doc: T, access: AfterPersistAccess, context: ModelHookContext): Promise<T>;
|
|
251
|
-
changes(modelName: string, doc: Record<string, unknown>, context: ModelHookContext): Promise<void>;
|
|
252
|
-
beforeDelete<T>(modelName: string, doc: T, context: ModelHookContext): Promise<void>;
|
|
253
|
-
afterDelete<T>(modelName: string, doc: T, context: ModelHookContext): Promise<void>;
|
|
254
|
-
genDocPermissions(modelName: string, doc: unknown, access: DocPermissionsAccess, context: ModelHookContext): Promise<{}>;
|
|
255
|
-
addEmptyPermissions<T>(modelName: string, doc: T): T;
|
|
256
|
-
addDocPermissions<T>(modelName: string, doc: T, access: DocPermissionsAccess, context: ModelHookContext): Promise<T>;
|
|
257
|
-
addFieldPermissions<T extends {
|
|
258
|
-
_id?: unknown;
|
|
259
|
-
}>(modelName: string, doc: T, access: DocPermissionsAccess, context: InternalModelHookContext): Promise<T>;
|
|
260
|
-
decorate<T>(modelName: string, doc: T, access: DecorateAccess, context: ModelHookContext): Promise<T>;
|
|
261
|
-
decorateAll<T>(modelName: string, docs: T[], access: DecorateAllAccess, context: ModelHookContext): Promise<T[]>;
|
|
262
|
-
runTasks<T extends object>(modelName: string, docObject: T, task: Task | Task[]): T;
|
|
263
|
-
getPermissions(): Permission;
|
|
264
|
-
setPermissions(): Promise<void>;
|
|
265
|
-
canActivate(routeGuard: Validation): Promise<any>;
|
|
266
|
-
isAllowed(modelName: string, access: RouteGuardAccess | string): Promise<any>;
|
|
267
|
-
getService<TModel = unknown>(modelName: string): Service<TModel>;
|
|
268
|
-
getPublicService<TModel = unknown>(modelName: string): PublicService<TModel>;
|
|
269
|
-
service<TModel = unknown>(modelName: string): PublicService<TModel>;
|
|
270
|
-
svc<TModel = unknown>(modelName: string): PublicService<TModel>;
|
|
271
|
-
private getGlobalPermissions;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
declare class DataCore {
|
|
275
|
-
private req;
|
|
276
|
-
private caches;
|
|
277
|
-
constructor(req: AccessRouterBaseRequest);
|
|
278
|
-
genIDFilter<TData = unknown>(dataName: string, id: string): Promise<Filter<TData>>;
|
|
279
|
-
genFilter<TData = unknown>(dataName: string, access?: BaseFilterAccess, _filter?: Filter<TData>): Promise<Filter<TData>>;
|
|
280
|
-
genAllowedFields(dataName: string, _doc: unknown, access: SelectAccess, baseFields?: any[]): Promise<string[]>;
|
|
281
|
-
pickAllowedFields<TDoc>(dataName: string, doc: TDoc, access: SelectAccess, baseFields?: any[]): Promise<TDoc>;
|
|
282
|
-
genSelect(dataName: string, access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: any[]): Promise<string[]>;
|
|
283
|
-
decorate<TDoc>(dataName: string, doc: TDoc, access: DecorateAccess, context?: DataHookContext): Promise<TDoc>;
|
|
284
|
-
decorateAll<TDoc>(dataName: string, docs: TDoc[], access: DecorateAllAccess, context?: DataHookContext): Promise<TDoc[]>;
|
|
285
|
-
getPermissions(): Permission;
|
|
286
|
-
setPermissions(): Promise<void>;
|
|
287
|
-
canActivate(routeGuard: Validation): Promise<any>;
|
|
288
|
-
isAllowed(dataName: string, access: RouteGuardAccess | string): Promise<any>;
|
|
289
|
-
getService<TData = unknown>(dataName: string): DataService<TData>;
|
|
290
|
-
service<TData = unknown>(dataName: string): DataService<TData>;
|
|
291
|
-
svc<TData = unknown>(dataName: string): DataService<TData>;
|
|
292
|
-
private getGlobalPermissions;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
declare enum StatusCodes {
|
|
296
|
-
OK = 200,
|
|
297
|
-
Created = 201,
|
|
298
|
-
BadRequest = 400,
|
|
299
|
-
Unauthorized = 401,
|
|
300
|
-
Forbidden = 403,
|
|
301
|
-
NotFound = 404,
|
|
302
|
-
UnprocessableContent = 422
|
|
303
|
-
}
|
|
304
|
-
declare enum Codes {
|
|
305
|
-
Success = "success",
|
|
306
|
-
Created = "created",
|
|
307
|
-
BadRequest = "bad_request",
|
|
308
|
-
Unauthorized = "unauthorized",
|
|
309
|
-
Forbidden = "forbidden",
|
|
310
|
-
NotFound = "not_found"
|
|
311
|
-
}
|
|
312
|
-
declare enum CustomHeaders {
|
|
313
|
-
TotalCount = "wtt-total-count",
|
|
314
|
-
ReturnedCount = "wtt-returned-count",
|
|
315
|
-
Page = "wtt-page",
|
|
316
|
-
PageSize = "wtt-page-size",
|
|
317
|
-
TotalPages = "wtt-total-pages",
|
|
318
|
-
HasNextPage = "wtt-has-next-page",
|
|
319
|
-
HasPreviousPage = "wtt-has-previous-page"
|
|
320
|
-
}
|
|
321
|
-
declare enum FilterOperator {
|
|
322
|
-
SubQuery = 0,
|
|
323
|
-
Date = 1
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
interface AccessRouterRequestExtensions {
|
|
327
|
-
macl?: Core;
|
|
328
|
-
dacl?: DataCore;
|
|
329
|
-
}
|
|
330
|
-
type AccessRouterRequest = express.Request & AccessRouterRequestExtensions;
|
|
331
|
-
|
|
332
|
-
type GuardHook<TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, permissions: AccessRouterPermissions) => boolean | Promise<boolean>;
|
|
333
|
-
type Validation = boolean | string | string[] | GuardHook;
|
|
334
|
-
type SelectAccess = 'list' | 'create' | 'read' | 'update' | string;
|
|
335
|
-
type RouteGuardAccess = 'new' | 'list' | 'read' | 'update' | 'upsert' | 'delete' | 'create' | 'distinct' | 'count' | 'subs' | string;
|
|
336
|
-
type DocPermissionsAccess = 'list' | 'create' | 'read' | 'update' | string;
|
|
337
|
-
type BaseFilterAccess = 'list' | 'read' | 'update' | 'delete' | string;
|
|
338
|
-
type DecorateAccess = 'list' | 'create' | 'read' | 'update' | string;
|
|
339
|
-
type DecorateAllAccess = 'list' | string;
|
|
340
|
-
type ValidateAccess = 'create' | 'update' | string;
|
|
341
|
-
type PrepareAccess = 'create' | 'update' | string;
|
|
342
|
-
type TransformAccess = 'update' | string;
|
|
343
|
-
type AfterPersistAccess = 'create' | 'update' | string;
|
|
344
|
-
|
|
345
|
-
interface PublicCreateArgs {
|
|
346
|
-
select?: Projection;
|
|
347
|
-
populate?: Populate[] | string;
|
|
348
|
-
tasks?: Task | Task[];
|
|
349
|
-
}
|
|
350
|
-
interface CreateArgs extends Omit<PublicCreateArgs, 'select' | 'tasks'> {
|
|
351
|
-
}
|
|
352
|
-
interface PublicCreateOptions {
|
|
353
|
-
skim?: boolean;
|
|
354
|
-
includePermissions?: boolean;
|
|
355
|
-
populateAccess?: PopulateAccess;
|
|
356
|
-
}
|
|
357
|
-
interface CreateOptions extends PublicCreateOptions {
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
interface PublicListArgs {
|
|
361
|
-
select?: Projection;
|
|
362
|
-
populate?: Populate[] | string;
|
|
363
|
-
include?: Include | Include[];
|
|
364
|
-
sort?: Sort;
|
|
365
|
-
skip?: string | number;
|
|
366
|
-
limit?: string | number;
|
|
367
|
-
page?: string | number;
|
|
368
|
-
pageSize?: string | number;
|
|
369
|
-
tasks?: Task | Task[];
|
|
370
|
-
}
|
|
371
|
-
interface PublicListOptions {
|
|
372
|
-
skim?: boolean;
|
|
373
|
-
includePermissions?: boolean;
|
|
374
|
-
includeCount?: boolean;
|
|
375
|
-
populateAccess?: PopulateAccess;
|
|
376
|
-
lean?: boolean;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
interface PublicReadArgs {
|
|
380
|
-
select?: Projection;
|
|
381
|
-
populate?: Populate[] | string;
|
|
382
|
-
include?: Include | Include[];
|
|
383
|
-
tasks?: Task | Task[];
|
|
384
|
-
}
|
|
385
|
-
interface PublicReadOptions {
|
|
386
|
-
skim?: boolean;
|
|
387
|
-
populateAccess?: PopulateAccess;
|
|
388
|
-
lean?: boolean;
|
|
389
|
-
includePermissions?: boolean;
|
|
390
|
-
tryList?: boolean;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
interface PublicUpdateArgs {
|
|
394
|
-
select?: Projection;
|
|
395
|
-
populate?: Populate[] | string;
|
|
396
|
-
tasks?: Task | Task[];
|
|
397
|
-
}
|
|
398
|
-
interface PublicUpsertArgs extends PublicUpdateArgs {
|
|
399
|
-
}
|
|
400
|
-
interface UpdateOneArgs<T = unknown> extends Omit<PublicUpdateArgs, 'select' | 'tasks'> {
|
|
401
|
-
overrides?: {
|
|
402
|
-
filter?: Filter<T>;
|
|
403
|
-
populate?: Populate[] | string;
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
interface UpdateByIdArgs<T = unknown> extends Omit<UpdateOneArgs<T>, 'overrides'> {
|
|
407
|
-
overrides?: {
|
|
408
|
-
populate?: Populate[] | string;
|
|
409
|
-
idFilter?: Filter<T>;
|
|
410
|
-
};
|
|
411
|
-
}
|
|
412
|
-
interface UpsertArgs<T = unknown> extends UpdateOneArgs<T> {
|
|
413
|
-
}
|
|
414
|
-
interface PublicUpdateOptions {
|
|
415
|
-
skim?: boolean;
|
|
416
|
-
returningAll?: boolean;
|
|
417
|
-
includePermissions?: boolean;
|
|
418
|
-
populateAccess?: PopulateAccess;
|
|
419
|
-
}
|
|
420
|
-
interface PublicUpsertOptions extends PublicUpdateOptions {
|
|
421
|
-
}
|
|
422
|
-
interface UpdateOneOptions extends Omit<PublicUpdateOptions, 'returningAll'> {
|
|
423
|
-
}
|
|
424
|
-
interface UpdateByIdOptions extends UpdateOneOptions {
|
|
425
|
-
}
|
|
426
|
-
interface UpsertOptions extends UpdateOneOptions {
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
type DataFilter<T = unknown> = Filter<T>;
|
|
430
|
-
interface DataFindOneArgs<T = unknown, TSelect extends Projection | undefined = Projection | undefined> {
|
|
431
|
-
select?: TSelect;
|
|
432
|
-
}
|
|
433
|
-
interface DataFindOneOptions {
|
|
434
|
-
access?: FindAccess;
|
|
435
|
-
}
|
|
436
|
-
interface DataFindArgs<T = unknown, TSelect extends Projection | undefined = Projection | undefined> {
|
|
437
|
-
select?: TSelect;
|
|
438
|
-
sort?: string;
|
|
439
|
-
skip?: string | number;
|
|
440
|
-
limit?: string | number;
|
|
441
|
-
page?: string | number;
|
|
442
|
-
pageSize?: string | number;
|
|
443
|
-
}
|
|
444
|
-
interface DataFindOptions {
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
interface KeyValueProjection {
|
|
448
|
-
[key: string]: 1 | -1;
|
|
449
|
-
}
|
|
450
|
-
type Projection = string[] | string | KeyValueProjection;
|
|
451
|
-
type SortOrder = -1 | 1 | 'asc' | 'ascending' | 'desc' | 'descending';
|
|
452
|
-
type Sort = string | {
|
|
453
|
-
[key: string]: SortOrder;
|
|
454
|
-
} | [string, SortOrder][] | undefined | null;
|
|
455
|
-
type Primitive = string | number | boolean | bigint | symbol | null | undefined;
|
|
456
|
-
type NonTraversable = Primitive | Date | RegExp | Function;
|
|
457
|
-
type PrevDepth = [never, 0, 1, 2, 3, 4, 5];
|
|
458
|
-
type IsUnknown<T> = unknown extends T ? ([keyof T] extends [never] ? true : false) : false;
|
|
459
|
-
type Descend<T> = T extends readonly (infer U)[] ? U : T;
|
|
460
|
-
type ArrayValue<T> = T extends readonly (infer U)[] ? U : T;
|
|
461
|
-
type ComparableValue = string | number | bigint | Date;
|
|
462
|
-
type WithDefaultId<T> = T extends object ? T & {
|
|
463
|
-
_id?: unknown;
|
|
464
|
-
} : {
|
|
465
|
-
_id?: unknown;
|
|
466
|
-
};
|
|
467
|
-
type PublicOutput<T> = T extends object ? T & Record<string, unknown> : Record<string, unknown>;
|
|
468
|
-
type ModelDocument<TModel = unknown> = mongoose.Document & TModel;
|
|
469
|
-
type TrimLeft<S extends string> = S extends ` ${infer Rest}` ? TrimLeft<Rest> : S;
|
|
470
|
-
type TrimRight<S extends string> = S extends `${infer Rest} ` ? TrimRight<Rest> : S;
|
|
471
|
-
type Trim<S extends string> = TrimLeft<TrimRight<S>>;
|
|
472
|
-
type SplitProjectionString<S extends string> = S extends `${infer Head} ${infer Tail}` ? SplitProjectionString<Head> | SplitProjectionString<Tail> : Trim<S>;
|
|
473
|
-
type ProjectionTokens<TProjection> = TProjection extends readonly string[] ? TProjection[number] : TProjection extends string ? SplitProjectionString<TProjection> : TProjection extends KeyValueProjection ? {
|
|
474
|
-
[K in Extract<keyof TProjection, string>]: TProjection[K] extends 1 ? K : never;
|
|
475
|
-
}[Extract<keyof TProjection, string>] : never;
|
|
476
|
-
type PositiveProjectionPaths<TProjection> = ProjectionTokens<TProjection> extends infer TToken ? TToken extends string ? TToken extends '' ? never : TToken extends `-${string}` ? never : TToken : never : never;
|
|
477
|
-
type UnionToIntersection<T> = (T extends unknown ? (value: T) => void : never) extends (value: infer I) => void ? I : never;
|
|
478
|
-
type Simplify<T> = {
|
|
479
|
-
[K in keyof T]: T[K];
|
|
480
|
-
} & {};
|
|
481
|
-
type DeepPickSingle<T, TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? Head extends keyof WithDefaultId<T> ? Head extends string ? {
|
|
482
|
-
[K in Head]: WithDefaultId<T>[K] extends readonly (infer U)[] ? Array<Simplify<DeepPickSingle<U, Tail>>> : WithDefaultId<T>[K] extends object ? Simplify<DeepPickSingle<WithDefaultId<T>[K], Tail>> : WithDefaultId<T>[K];
|
|
483
|
-
} : {} : {} : TPath extends keyof WithDefaultId<T> ? Pick<WithDefaultId<T>, TPath> : {};
|
|
484
|
-
type DeepPick<T, TPaths extends string> = Simplify<UnionToIntersection<DeepPickSingle<T, TPaths>>>;
|
|
485
|
-
type SelectedPublicOutput<T, TProjection> = string extends PositiveProjectionPaths<TProjection> ? PublicOutput<T> : [PositiveProjectionPaths<TProjection>] extends [never] ? PublicOutput<T> : DeepPick<T, Extract<PositiveProjectionPaths<TProjection>, string>>;
|
|
486
|
-
type PopulateInput = Populate | string;
|
|
487
|
-
type PopulateInputs<TPopulate> = TPopulate extends readonly (infer U)[] ? U : TPopulate;
|
|
488
|
-
type PopulatePath<TPopulateEntry> = TPopulateEntry extends string ? TPopulateEntry : TPopulateEntry extends {
|
|
489
|
-
path: infer TPath extends string;
|
|
490
|
-
} ? TPath : never;
|
|
491
|
-
type PopulateSelect<TPopulateEntry> = TPopulateEntry extends {
|
|
492
|
-
select?: infer TSelect;
|
|
493
|
-
} ? TSelect : undefined;
|
|
494
|
-
type PopulateLeafValue<TValue, TPopulateEntry> = TValue extends readonly (infer U)[] ? Array<SelectedPublicOutput<U, PopulateSelect<TPopulateEntry>>> : SelectedPublicOutput<TValue, PopulateSelect<TPopulateEntry>>;
|
|
495
|
-
type PopulateEntryShape<T, TPath extends string, TValue> = TPath extends `${infer Head}.${infer Tail}` ? Head extends keyof WithDefaultId<T> ? Head extends string ? {
|
|
496
|
-
[K in Head]: WithDefaultId<T>[K] extends readonly (infer U)[] ? Array<Simplify<PopulateEntryShape<U, Tail, TValue>>> : Simplify<PopulateEntryShape<WithDefaultId<T>[K], Tail, TValue>>;
|
|
497
|
-
} : {} : {} : TPath extends keyof WithDefaultId<T> ? Pick<{
|
|
498
|
-
[K in TPath]: TValue;
|
|
499
|
-
}, TPath> : {};
|
|
500
|
-
type PopulateOutputShape<T, TPopulateEntry> = PopulatePath<TPopulateEntry> extends infer TPath extends string ? PopulateEntryShape<T, TPath, PopulateLeafValue<PathValue<WithDefaultId<T>, TPath>, TPopulateEntry>> : {};
|
|
501
|
-
type PopulateOutput<T, TPopulate> = string extends PopulatePath<PopulateInputs<TPopulate>> ? {} : [PopulatePath<PopulateInputs<TPopulate>>] extends [never] ? {} : Simplify<UnionToIntersection<PopulateOutputShape<T, Extract<PopulateInputs<TPopulate>, PopulateInput>>>>;
|
|
502
|
-
type SelectedPopulatedPublicOutput<T, TProjection, TPopulate> = Simplify<SelectedPublicOutput<T, TProjection> & PopulateOutput<T, TPopulate>>;
|
|
503
|
-
type DeepFieldPath<T, Depth extends number = 4> = [Depth] extends [never] ? never : Descend<T> extends NonTraversable ? never : {
|
|
504
|
-
[K in Extract<keyof Descend<T>, string>]: K | (Descend<T>[K] extends NonTraversable ? never : Descend<T>[K] extends readonly (infer U)[] ? U extends NonTraversable ? never : `${K}.${DeepFieldPath<U, PrevDepth[Depth]>}` : Descend<T>[K] extends object ? `${K}.${DeepFieldPath<Descend<T>[K], PrevDepth[Depth]>}` : never);
|
|
505
|
-
}[Extract<keyof Descend<T>, string>];
|
|
506
|
-
type PathValue<T, TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? Head extends Extract<keyof Descend<T>, string> ? PathValue<Descend<Descend<T>[Head]>, Tail> : unknown : TPath extends Extract<keyof Descend<T>, string> ? Descend<T>[TPath] : unknown;
|
|
507
|
-
type FieldFilterOperators<T> = {
|
|
508
|
-
$eq?: T;
|
|
509
|
-
$ne?: T;
|
|
510
|
-
$in?: Array<ArrayValue<T>>;
|
|
511
|
-
$nin?: Array<ArrayValue<T>>;
|
|
512
|
-
$exists?: boolean;
|
|
513
|
-
$gt?: ArrayValue<T> extends ComparableValue ? ArrayValue<T> : never;
|
|
514
|
-
$gte?: ArrayValue<T> extends ComparableValue ? ArrayValue<T> : never;
|
|
515
|
-
$lt?: ArrayValue<T> extends ComparableValue ? ArrayValue<T> : never;
|
|
516
|
-
$lte?: ArrayValue<T> extends ComparableValue ? ArrayValue<T> : never;
|
|
517
|
-
$regex?: ArrayValue<T> extends string ? string | RegExp : never;
|
|
518
|
-
$all?: T extends readonly unknown[] ? Array<ArrayValue<T>> : never;
|
|
519
|
-
$size?: T extends readonly unknown[] ? number : never;
|
|
520
|
-
$elemMatch?: ArrayValue<T> extends object ? TypedFilter<ArrayValue<T>> : never;
|
|
521
|
-
$$sq?: unknown;
|
|
522
|
-
$$date?: unknown;
|
|
523
|
-
[key: `$${string}`]: unknown;
|
|
524
|
-
};
|
|
525
|
-
type FieldFilterValue<T> = T | FieldFilterOperators<NonNullable<T>>;
|
|
526
|
-
type LooseFilter = false | Record<string, unknown>;
|
|
527
|
-
type TypedFilterObject<T> = {
|
|
528
|
-
[K in DeepFieldPath<T>]?: FieldFilterValue<PathValue<T, K>>;
|
|
529
|
-
} & {
|
|
530
|
-
_id?: FieldFilterValue<unknown>;
|
|
531
|
-
$and?: TypedFilter<T>[];
|
|
532
|
-
$or?: TypedFilter<T>[];
|
|
533
|
-
$nor?: TypedFilter<T>[];
|
|
534
|
-
[key: `$${string}`]: unknown;
|
|
535
|
-
};
|
|
536
|
-
type TypedFilter<T> = false | TypedFilterObject<WithDefaultId<T>>;
|
|
537
|
-
type Filter<T = unknown> = IsUnknown<T> extends true ? LooseFilter : TypedFilter<T>;
|
|
538
|
-
interface Include {
|
|
539
|
-
model: string;
|
|
540
|
-
op: 'list' | 'read' | 'count';
|
|
541
|
-
path: string;
|
|
542
|
-
filter?: Filter;
|
|
543
|
-
localField: string;
|
|
544
|
-
foreignField: string;
|
|
545
|
-
args?: unknown;
|
|
546
|
-
options?: unknown;
|
|
547
|
-
}
|
|
548
|
-
type FindAccess = 'list' | 'read';
|
|
549
|
-
type PopulateAccess = 'list' | 'read';
|
|
550
|
-
interface Populate {
|
|
551
|
-
path: string;
|
|
552
|
-
select?: Projection;
|
|
553
|
-
match?: unknown;
|
|
554
|
-
access?: PopulateAccess;
|
|
555
|
-
}
|
|
556
|
-
interface SubPopulate {
|
|
557
|
-
path: string;
|
|
558
|
-
select?: Projection;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
interface KeyValue {
|
|
562
|
-
[key: string]: unknown;
|
|
563
|
-
}
|
|
564
|
-
interface Change {
|
|
565
|
-
op: 'add' | 'replace' | 'remove';
|
|
566
|
-
path: Array<string | number>;
|
|
567
|
-
value?: unknown;
|
|
568
|
-
}
|
|
569
|
-
interface ModelHookContext {
|
|
570
|
-
modelName: string;
|
|
571
|
-
mongooseModel: mongoose.Model<unknown>;
|
|
572
|
-
operation?: string;
|
|
573
|
-
originalDocumentSnapshot?: Record<string, unknown>;
|
|
574
|
-
finalDocumentSnapshot?: Record<string, unknown>;
|
|
575
|
-
currentDocument?: ModelDocument;
|
|
576
|
-
originalData?: Record<string, unknown>;
|
|
577
|
-
allowedData?: Record<string, unknown>;
|
|
578
|
-
preparedData?: Record<string, unknown>;
|
|
579
|
-
allowedFields?: string[];
|
|
580
|
-
modifiedPaths?: string[];
|
|
581
|
-
changes?: Change[];
|
|
582
|
-
docPermissions?: KeyValue;
|
|
583
|
-
resolvedQuery?: {
|
|
584
|
-
filter?: Filter;
|
|
585
|
-
select?: string[];
|
|
586
|
-
populate?: Populate[] | string;
|
|
587
|
-
sort?: Sort;
|
|
588
|
-
skip?: number;
|
|
589
|
-
limit?: number;
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
interface DataHookContext {
|
|
593
|
-
dataName?: string;
|
|
594
|
-
operation?: string;
|
|
595
|
-
resolvedQuery?: {
|
|
596
|
-
filter?: Filter;
|
|
597
|
-
select?: string[];
|
|
598
|
-
sort?: Sort;
|
|
599
|
-
skip?: number;
|
|
600
|
-
limit?: number;
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
type RootTarget = 'model' | 'data';
|
|
604
|
-
type RootSubOperation = 'subList' | 'subRead' | 'subCreate' | 'subUpdate' | 'subBulkUpdate' | 'subDelete';
|
|
605
|
-
type RootModelOperation = 'new' | 'list' | 'read' | 'create' | 'update' | 'upsert' | 'delete' | 'distinct' | 'count' | RootSubOperation;
|
|
606
|
-
type RootDataOperation = 'list' | 'read';
|
|
607
|
-
interface RootQueryEntryBase<TTarget extends RootTarget, TOp extends string> {
|
|
608
|
-
target: TTarget;
|
|
609
|
-
name: string;
|
|
610
|
-
op: TOp;
|
|
611
|
-
order?: number;
|
|
612
|
-
}
|
|
613
|
-
interface RootModelNewQueryEntry extends RootQueryEntryBase<'model', 'new'> {
|
|
614
|
-
}
|
|
615
|
-
interface RootModelListQueryEntry extends RootQueryEntryBase<'model', 'list'> {
|
|
616
|
-
filter?: Filter;
|
|
617
|
-
args?: PublicListArgs;
|
|
618
|
-
options?: PublicListOptions;
|
|
619
|
-
}
|
|
620
|
-
interface RootModelReadByIdQueryEntry extends RootQueryEntryBase<'model', 'read'> {
|
|
621
|
-
id: string;
|
|
622
|
-
args?: PublicReadArgs;
|
|
623
|
-
options?: PublicReadOptions;
|
|
624
|
-
}
|
|
625
|
-
interface RootModelReadByFilterQueryEntry extends RootQueryEntryBase<'model', 'read'> {
|
|
626
|
-
filter: Filter;
|
|
627
|
-
args?: PublicReadArgs & {
|
|
628
|
-
sort?: Sort;
|
|
629
|
-
};
|
|
630
|
-
options?: PublicReadOptions;
|
|
631
|
-
}
|
|
632
|
-
interface RootModelCreateQueryEntry extends RootQueryEntryBase<'model', 'create'> {
|
|
633
|
-
data: unknown;
|
|
634
|
-
args?: PublicCreateArgs;
|
|
635
|
-
options?: PublicCreateOptions;
|
|
636
|
-
}
|
|
637
|
-
interface RootModelUpdateQueryEntry extends RootQueryEntryBase<'model', 'update'> {
|
|
638
|
-
id: string;
|
|
639
|
-
data: unknown;
|
|
640
|
-
args?: PublicUpdateArgs;
|
|
641
|
-
options?: PublicUpdateOptions;
|
|
642
|
-
}
|
|
643
|
-
interface RootModelUpsertQueryEntry extends RootQueryEntryBase<'model', 'upsert'> {
|
|
644
|
-
data: Record<string, unknown>;
|
|
645
|
-
args?: PublicUpsertArgs;
|
|
646
|
-
options?: PublicUpsertOptions;
|
|
647
|
-
}
|
|
648
|
-
interface RootModelDeleteQueryEntry extends RootQueryEntryBase<'model', 'delete'> {
|
|
649
|
-
id: string;
|
|
650
|
-
}
|
|
651
|
-
interface RootModelSubListQueryEntry extends RootQueryEntryBase<'model', 'subList'> {
|
|
652
|
-
id: string;
|
|
653
|
-
sub: string;
|
|
654
|
-
filter?: Filter;
|
|
655
|
-
args?: {
|
|
656
|
-
select?: string[];
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
interface RootModelSubReadQueryEntry extends RootQueryEntryBase<'model', 'subRead'> {
|
|
660
|
-
id: string;
|
|
661
|
-
sub: string;
|
|
662
|
-
subId: string;
|
|
663
|
-
args?: {
|
|
664
|
-
select?: string[];
|
|
665
|
-
populate?: SubPopulate | SubPopulate[] | string | string[];
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
interface RootModelSubCreateQueryEntry extends RootQueryEntryBase<'model', 'subCreate'> {
|
|
669
|
-
id: string;
|
|
670
|
-
sub: string;
|
|
671
|
-
data: unknown;
|
|
672
|
-
}
|
|
673
|
-
interface RootModelSubUpdateQueryEntry extends RootQueryEntryBase<'model', 'subUpdate'> {
|
|
674
|
-
id: string;
|
|
675
|
-
sub: string;
|
|
676
|
-
subId: string;
|
|
677
|
-
data: unknown;
|
|
678
|
-
}
|
|
679
|
-
interface RootModelSubBulkUpdateQueryEntry extends RootQueryEntryBase<'model', 'subBulkUpdate'> {
|
|
680
|
-
id: string;
|
|
681
|
-
sub: string;
|
|
682
|
-
data: unknown;
|
|
683
|
-
}
|
|
684
|
-
interface RootModelSubDeleteQueryEntry extends RootQueryEntryBase<'model', 'subDelete'> {
|
|
685
|
-
id: string;
|
|
686
|
-
sub: string;
|
|
687
|
-
subId: string;
|
|
688
|
-
}
|
|
689
|
-
interface RootModelDistinctQueryEntry extends RootQueryEntryBase<'model', 'distinct'> {
|
|
690
|
-
field: string;
|
|
691
|
-
filter?: Filter;
|
|
692
|
-
}
|
|
693
|
-
interface RootModelCountQueryEntry extends RootQueryEntryBase<'model', 'count'> {
|
|
694
|
-
filter?: Filter;
|
|
695
|
-
options?: {
|
|
696
|
-
access?: BaseFilterAccess;
|
|
697
|
-
[key: string]: unknown;
|
|
698
|
-
};
|
|
699
|
-
}
|
|
700
|
-
interface RootDataListQueryEntry extends RootQueryEntryBase<'data', 'list'> {
|
|
701
|
-
filter?: Filter;
|
|
702
|
-
args?: DataFindArgs;
|
|
703
|
-
options?: {
|
|
704
|
-
includeCount?: boolean;
|
|
705
|
-
[key: string]: unknown;
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
interface RootDataReadByIdQueryEntry extends RootQueryEntryBase<'data', 'read'> {
|
|
709
|
-
id: string;
|
|
710
|
-
args?: DataFindOneArgs;
|
|
711
|
-
}
|
|
712
|
-
interface RootDataReadByFilterQueryEntry extends RootQueryEntryBase<'data', 'read'> {
|
|
713
|
-
filter: Filter;
|
|
714
|
-
args?: DataFindOneArgs;
|
|
715
|
-
}
|
|
716
|
-
type RootQueryEntry = RootModelNewQueryEntry | RootModelListQueryEntry | RootModelReadByIdQueryEntry | RootModelReadByFilterQueryEntry | RootModelCreateQueryEntry | RootModelUpdateQueryEntry | RootModelUpsertQueryEntry | RootModelDeleteQueryEntry | RootModelSubListQueryEntry | RootModelSubReadQueryEntry | RootModelSubCreateQueryEntry | RootModelSubUpdateQueryEntry | RootModelSubBulkUpdateQueryEntry | RootModelSubDeleteQueryEntry | RootModelDistinctQueryEntry | RootModelCountQueryEntry | RootDataListQueryEntry | RootDataReadByIdQueryEntry | RootDataReadByFilterQueryEntry;
|
|
717
|
-
interface RootOperationResult<T = unknown, TError = unknown, TInput = unknown, TQuery = unknown> {
|
|
718
|
-
index: number;
|
|
719
|
-
target: RootTarget;
|
|
720
|
-
name: string;
|
|
721
|
-
op: RootModelOperation | RootDataOperation;
|
|
722
|
-
result: ServiceResult<T, TError, TInput, TQuery>;
|
|
723
|
-
statusCode: number;
|
|
724
|
-
message: string;
|
|
725
|
-
}
|
|
726
|
-
interface SubQueryEntry {
|
|
727
|
-
model: string;
|
|
728
|
-
op: 'list' | 'read' | string;
|
|
729
|
-
id?: string;
|
|
730
|
-
filter?: Filter;
|
|
731
|
-
args?: Record<string, unknown>;
|
|
732
|
-
options?: Record<string, unknown>;
|
|
733
|
-
sqOptions?: {
|
|
734
|
-
path?: string;
|
|
735
|
-
compact?: boolean;
|
|
736
|
-
};
|
|
737
|
-
}
|
|
738
|
-
interface Task {
|
|
739
|
-
type: string;
|
|
740
|
-
args: unknown;
|
|
741
|
-
options: Record<string, unknown>;
|
|
742
|
-
}
|
|
743
|
-
interface AccessRouterBaseRequest extends AccessRouterRequest {
|
|
744
|
-
query: Record<'skip' | 'limit' | 'page' | 'page_size' | 'try_list' | 'skim' | 'include_permissions' | 'include_count' | 'include_extra_headers' | 'returning_all', string>;
|
|
745
|
-
}
|
|
746
|
-
interface ModelRequest extends AccessRouterBaseRequest {
|
|
747
|
-
macl: Core;
|
|
748
|
-
}
|
|
749
|
-
interface DataRequest extends AccessRouterBaseRequest {
|
|
750
|
-
dacl: DataCore;
|
|
751
|
-
}
|
|
752
|
-
type Request = AccessRouterBaseRequest;
|
|
753
|
-
interface ErrorResult<TError = unknown, TQuery = unknown> {
|
|
754
|
-
success: false;
|
|
755
|
-
code: Codes.BadRequest | Codes.Unauthorized | Codes.Forbidden | Codes.NotFound;
|
|
756
|
-
errors?: TError[];
|
|
757
|
-
query?: TQuery;
|
|
758
|
-
}
|
|
759
|
-
interface SingleResult<T = unknown, TInput = unknown, TQuery = unknown> {
|
|
760
|
-
success: true;
|
|
761
|
-
kind: 'single';
|
|
762
|
-
code: Codes.Success | Codes.Created;
|
|
763
|
-
data: T;
|
|
764
|
-
input?: TInput;
|
|
765
|
-
query?: TQuery;
|
|
766
|
-
context?: ModelHookContext;
|
|
767
|
-
}
|
|
768
|
-
interface ListResult<T = unknown, TInput = unknown, TQuery = unknown> {
|
|
769
|
-
success: true;
|
|
770
|
-
kind: 'list';
|
|
771
|
-
code: Codes.Success | Codes.Created;
|
|
772
|
-
data: T[];
|
|
773
|
-
count: number;
|
|
774
|
-
totalCount?: number | null;
|
|
775
|
-
input?: TInput;
|
|
776
|
-
query?: TQuery;
|
|
777
|
-
contexts?: ModelHookContext[];
|
|
778
|
-
}
|
|
779
|
-
type ServiceResult<T = unknown, TError = unknown, TInput = unknown, TQuery = unknown> = SingleResult<T, TInput, TQuery> | ListResult<T, TInput, TQuery> | ErrorResult<TError, TQuery>;
|
|
780
|
-
|
|
781
|
-
interface FindArgs<T = unknown> {
|
|
782
|
-
select?: Projection;
|
|
783
|
-
populate?: Populate[] | string;
|
|
784
|
-
include?: Include | Include[];
|
|
785
|
-
sort?: Sort;
|
|
786
|
-
skip?: string | number;
|
|
787
|
-
limit?: string | number;
|
|
788
|
-
page?: string | number;
|
|
789
|
-
pageSize?: string | number;
|
|
790
|
-
overrides?: {
|
|
791
|
-
filter?: Filter<T>;
|
|
792
|
-
select?: Projection;
|
|
793
|
-
populate?: Populate[] | string;
|
|
794
|
-
};
|
|
795
|
-
}
|
|
796
|
-
interface FindOptions {
|
|
797
|
-
skim?: boolean;
|
|
798
|
-
includePermissions?: boolean;
|
|
799
|
-
includeCount?: boolean;
|
|
800
|
-
populateAccess?: PopulateAccess;
|
|
801
|
-
lean?: boolean;
|
|
802
|
-
}
|
|
803
|
-
interface FindOneArgs<T = unknown> {
|
|
804
|
-
select?: Projection;
|
|
805
|
-
sort?: Sort;
|
|
806
|
-
populate?: Populate[] | string;
|
|
807
|
-
include?: Include | Include[];
|
|
808
|
-
overrides?: {
|
|
809
|
-
filter?: Filter<T>;
|
|
810
|
-
select?: Projection;
|
|
811
|
-
populate?: Populate[] | string;
|
|
812
|
-
};
|
|
813
|
-
}
|
|
814
|
-
interface FindOneOptions {
|
|
815
|
-
access?: FindAccess;
|
|
816
|
-
populateAccess?: PopulateAccess;
|
|
817
|
-
skim?: boolean;
|
|
818
|
-
lean?: boolean;
|
|
819
|
-
includePermissions?: boolean;
|
|
820
|
-
}
|
|
821
|
-
interface FindByIdArgs<T = unknown> {
|
|
822
|
-
select?: Projection;
|
|
823
|
-
populate?: Populate[] | string;
|
|
824
|
-
include?: Include | Include[];
|
|
825
|
-
overrides?: {
|
|
826
|
-
select?: Projection;
|
|
827
|
-
populate?: Populate[] | string;
|
|
828
|
-
idFilter?: Filter<T>;
|
|
829
|
-
};
|
|
830
|
-
}
|
|
831
|
-
interface FindByIdOptions extends FindOneOptions {
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
interface ExistsOptions {
|
|
835
|
-
access?: BaseFilterAccess;
|
|
836
|
-
includeId?: boolean;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
840
|
-
type AccessRouterFieldKey<T> = [Extract<keyof T, string>] extends [never] ? string : Extract<keyof T, string>;
|
|
841
|
-
type IdentifierHook<TValue, TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, id: string) => MaybePromise<Filter<TValue>>;
|
|
842
|
-
type GlobalPermissionValue = Record<string, boolean> | string[] | string | null | undefined;
|
|
843
|
-
type BaseFilterHook<TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, permissions: AccessRouterPermissions) => MaybePromise<Filter | true | null | undefined>;
|
|
844
|
-
type OverrideFilterHook<TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, filter: Filter, permissions: AccessRouterPermissions) => MaybePromise<Filter>;
|
|
845
|
-
type Hook<TValue, TContext, TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, value: TValue, permissions: AccessRouterPermissions, context: TContext) => MaybePromise<TValue>;
|
|
846
|
-
type HookChain<TValue, TContext, TRequest extends AccessRouterRequest = AccessRouterRequest> = Hook<TValue, TContext, TRequest> | Array<Hook<TValue, TContext, TRequest>>;
|
|
847
|
-
type ValidateRule = boolean | unknown[];
|
|
848
|
-
type ValidateHook<TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, allowedData: unknown, permissions: AccessRouterPermissions, context: ModelHookContext) => MaybePromise<ValidateRule>;
|
|
849
|
-
type DocPermissionsHook<TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, doc: unknown, permissions: AccessRouterPermissions, context: ModelHookContext) => MaybePromise<Record<string, unknown>>;
|
|
850
|
-
type ChangeHook<TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, previousValue: unknown, nextValue: unknown, changes: Change[], context: ModelHookContext) => MaybePromise<void>;
|
|
851
|
-
type DeleteHook<TValue = unknown, TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, value: TValue, permissions: AccessRouterPermissions, context: ModelHookContext) => MaybePromise<void>;
|
|
852
|
-
type DocumentHook<TValue, TRequest extends AccessRouterRequest = AccessRouterRequest> = (this: TRequest, value: ModelDocument<TValue>, permissions: AccessRouterPermissions, context: ModelHookContext) => MaybePromise<ModelDocument<TValue>>;
|
|
853
|
-
type DocumentHookChain<TValue, TRequest extends AccessRouterRequest = AccessRouterRequest> = DocumentHook<TValue, TRequest> | Array<DocumentHook<TValue, TRequest>>;
|
|
854
|
-
type ModelBaseFilterHook = BaseFilterHook<ModelRequest>;
|
|
855
|
-
type DataBaseFilterHook = BaseFilterHook<DataRequest>;
|
|
856
|
-
type ModelOverrideFilterHook = OverrideFilterHook<ModelRequest>;
|
|
857
|
-
type DataOverrideFilterHook = OverrideFilterHook<DataRequest>;
|
|
858
|
-
type ModelIdentifierHook<TValue = unknown> = IdentifierHook<TValue, ModelRequest>;
|
|
859
|
-
type DataIdentifierHook<TValue = unknown> = IdentifierHook<TValue, DataRequest>;
|
|
860
|
-
type ModelValidateHook = ValidateHook<ModelRequest>;
|
|
861
|
-
type ModelDocPermissionsHook = DocPermissionsHook<ModelRequest>;
|
|
862
|
-
type ModelChangeHook = ChangeHook<ModelRequest>;
|
|
863
|
-
type ModelDocumentHook<TValue = unknown> = DocumentHookChain<TValue, ModelRequest>;
|
|
864
|
-
type ModelDeleteHook<TValue = unknown> = DeleteHook<ModelDocument<TValue>, ModelRequest>;
|
|
865
|
-
type ModelHook<TValue = unknown> = HookChain<TValue, ModelHookContext, ModelRequest>;
|
|
866
|
-
type ModelListHook<TValue = unknown> = HookChain<TValue[], ModelHookContext, ModelRequest>;
|
|
867
|
-
type DataHook<TValue = unknown> = HookChain<TValue, DataHookContext, DataRequest>;
|
|
868
|
-
type DataListHook<TValue = unknown> = HookChain<TValue[], DataHookContext, DataRequest>;
|
|
869
|
-
|
|
870
|
-
type ValidationError = {
|
|
871
|
-
detail: string;
|
|
872
|
-
pointer?: string;
|
|
873
|
-
parameter?: string;
|
|
874
|
-
};
|
|
875
|
-
type RequestSchemaIssue = {
|
|
876
|
-
message: string;
|
|
877
|
-
path?: Array<string | number>;
|
|
878
|
-
};
|
|
879
|
-
type RequestSchemaSuccess<T = unknown> = {
|
|
880
|
-
success: true;
|
|
881
|
-
data: T;
|
|
882
|
-
};
|
|
883
|
-
type RequestSchemaFailure = {
|
|
884
|
-
success: false;
|
|
885
|
-
issues: RequestSchemaIssue[];
|
|
886
|
-
};
|
|
887
|
-
type RequestSchemaResult<T = unknown> = RequestSchemaSuccess<T> | RequestSchemaFailure;
|
|
888
|
-
type RequestSchemaValidator<T = unknown> = (value: unknown) => RequestSchemaResult<T> | Promise<RequestSchemaResult<T>>;
|
|
889
|
-
type RequestSchemaAdapter<T = unknown> = {
|
|
890
|
-
validate: RequestSchemaValidator<T>;
|
|
891
|
-
openapi?: Record<string, unknown>;
|
|
892
|
-
};
|
|
893
|
-
type RequestSchemaOptions = {
|
|
894
|
-
openapi?: Record<string, unknown>;
|
|
895
|
-
};
|
|
896
|
-
type StandardSchemaPathSegment = {
|
|
897
|
-
key: PropertyKey;
|
|
898
|
-
};
|
|
899
|
-
type StandardSchemaIssue = {
|
|
900
|
-
message: string;
|
|
901
|
-
path?: ReadonlyArray<PropertyKey | StandardSchemaPathSegment>;
|
|
902
|
-
};
|
|
903
|
-
type StandardSchemaSuccess<T = unknown> = {
|
|
904
|
-
value: T;
|
|
905
|
-
issues?: undefined;
|
|
906
|
-
};
|
|
907
|
-
type StandardSchemaFailure = {
|
|
908
|
-
issues: ReadonlyArray<StandardSchemaIssue>;
|
|
909
|
-
};
|
|
910
|
-
type StandardSchemaResult<T = unknown> = StandardSchemaSuccess<T> | StandardSchemaFailure;
|
|
911
|
-
type StandardSchemaV1<Input = unknown, Output = Input> = {
|
|
912
|
-
readonly '~standard': {
|
|
913
|
-
readonly version: 1;
|
|
914
|
-
readonly vendor: string;
|
|
915
|
-
readonly validate: (value: unknown, options?: {
|
|
916
|
-
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
917
|
-
}) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
|
|
918
|
-
readonly types?: {
|
|
919
|
-
readonly input: Input;
|
|
920
|
-
readonly output: Output;
|
|
921
|
-
};
|
|
922
|
-
};
|
|
923
|
-
};
|
|
924
|
-
type StandardSchemaInferOutput<TSchema extends StandardSchemaV1> = NonNullable<TSchema['~standard']['types']>['output'];
|
|
925
|
-
type RequestSchemaLike<T = unknown> = RequestSchemaValidator<T> | RequestSchemaAdapter<T> | StandardSchemaV1;
|
|
926
|
-
type YupValidationErrorLike = {
|
|
927
|
-
message: string;
|
|
928
|
-
path?: string;
|
|
929
|
-
inner?: ReadonlyArray<YupValidationErrorLike>;
|
|
930
|
-
};
|
|
931
|
-
type YupSchemaLike<T = unknown> = {
|
|
932
|
-
validate: (value: unknown, options?: {
|
|
933
|
-
abortEarly?: boolean;
|
|
934
|
-
stripUnknown?: boolean;
|
|
935
|
-
}) => Promise<T> | T;
|
|
936
|
-
};
|
|
937
|
-
type JoiValidationErrorDetailLike = {
|
|
938
|
-
message: string;
|
|
939
|
-
path?: ReadonlyArray<string | number>;
|
|
940
|
-
};
|
|
941
|
-
type JoiSchemaLike<T = unknown> = {
|
|
942
|
-
validate: (value: unknown, options?: {
|
|
943
|
-
abortEarly?: boolean;
|
|
944
|
-
stripUnknown?: boolean;
|
|
945
|
-
}) => {
|
|
946
|
-
value: T;
|
|
947
|
-
error?: {
|
|
948
|
-
details?: ReadonlyArray<JoiValidationErrorDetailLike>;
|
|
949
|
-
};
|
|
950
|
-
} | Promise<{
|
|
951
|
-
value: T;
|
|
952
|
-
error?: {
|
|
953
|
-
details?: ReadonlyArray<JoiValidationErrorDetailLike>;
|
|
954
|
-
};
|
|
955
|
-
}>;
|
|
956
|
-
};
|
|
957
|
-
type AjvErrorObjectLike = {
|
|
958
|
-
message?: string;
|
|
959
|
-
instancePath?: string;
|
|
960
|
-
schemaPath?: string;
|
|
961
|
-
params?: {
|
|
962
|
-
missingProperty?: string;
|
|
963
|
-
};
|
|
964
|
-
};
|
|
965
|
-
type AjvValidatorLike<T = unknown> = {
|
|
966
|
-
(value: unknown): boolean | Promise<boolean>;
|
|
967
|
-
errors?: ReadonlyArray<AjvErrorObjectLike> | null;
|
|
968
|
-
};
|
|
969
|
-
type ValibotPathItemLike = {
|
|
970
|
-
key?: unknown;
|
|
971
|
-
};
|
|
972
|
-
type ValibotIssueLike = {
|
|
973
|
-
message: string;
|
|
974
|
-
path?: ReadonlyArray<ValibotPathItemLike>;
|
|
975
|
-
};
|
|
976
|
-
type ValibotSafeParseResult<T = unknown> = {
|
|
977
|
-
success: true;
|
|
978
|
-
output: T;
|
|
979
|
-
issues?: undefined;
|
|
980
|
-
} | {
|
|
981
|
-
success: false;
|
|
982
|
-
output?: undefined;
|
|
983
|
-
issues: ReadonlyArray<ValibotIssueLike>;
|
|
984
|
-
};
|
|
985
|
-
type ValibotSafeParseLike = <TSchema, TOutput = unknown>(schema: TSchema, value: unknown, config?: {
|
|
986
|
-
abortEarly?: boolean;
|
|
987
|
-
}) => ValibotSafeParseResult<TOutput> | Promise<ValibotSafeParseResult<TOutput>>;
|
|
988
|
-
type ArkTypeProblemLike = {
|
|
989
|
-
path?: ReadonlyArray<string | number>;
|
|
990
|
-
message?: string;
|
|
991
|
-
problem?: string;
|
|
992
|
-
};
|
|
993
|
-
type ArkTypeErrorsLike = ReadonlyArray<ArkTypeProblemLike> & {
|
|
994
|
-
summary?: string;
|
|
995
|
-
};
|
|
996
|
-
type ArkTypeLike<T = unknown> = {
|
|
997
|
-
(value: unknown): T | ArkTypeErrorsLike;
|
|
998
|
-
errors?: unknown;
|
|
999
|
-
};
|
|
1000
|
-
type IoTsContextEntryLike = {
|
|
1001
|
-
key: string;
|
|
1002
|
-
};
|
|
1003
|
-
type IoTsDecodeErrorLike = {
|
|
1004
|
-
message?: string;
|
|
1005
|
-
context: ReadonlyArray<IoTsContextEntryLike>;
|
|
1006
|
-
};
|
|
1007
|
-
type IoTsDecoderLike<T = unknown> = {
|
|
1008
|
-
decode: (value: unknown) => {
|
|
1009
|
-
_tag: 'Left';
|
|
1010
|
-
left: ReadonlyArray<IoTsDecodeErrorLike>;
|
|
1011
|
-
} | {
|
|
1012
|
-
_tag: 'Right';
|
|
1013
|
-
right: T;
|
|
1014
|
-
};
|
|
1015
|
-
};
|
|
1016
|
-
type SuperstructFailureLike = {
|
|
1017
|
-
message?: string;
|
|
1018
|
-
path?: ReadonlyArray<string | number>;
|
|
1019
|
-
key?: string | number;
|
|
1020
|
-
branch?: ReadonlyArray<unknown>;
|
|
1021
|
-
failures?: () => ReadonlyArray<SuperstructFailureLike>;
|
|
1022
|
-
};
|
|
1023
|
-
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]>;
|
|
1024
|
-
type VineValidationMessageLike = {
|
|
1025
|
-
field: string;
|
|
1026
|
-
message: string;
|
|
1027
|
-
index?: number;
|
|
1028
|
-
};
|
|
1029
|
-
type VineValidationErrorLike = {
|
|
1030
|
-
messages: ReadonlyArray<VineValidationMessageLike>;
|
|
1031
|
-
};
|
|
1032
|
-
type VineValidatorLike<T = unknown> = {
|
|
1033
|
-
validate: (value: unknown) => Promise<T> | T;
|
|
1034
|
-
};
|
|
1035
|
-
type ListQueryInput = {
|
|
1036
|
-
skip?: string;
|
|
1037
|
-
limit?: string;
|
|
1038
|
-
page?: string;
|
|
1039
|
-
page_size?: string;
|
|
1040
|
-
skim?: 'true' | 'false';
|
|
1041
|
-
include_permissions?: 'true' | 'false';
|
|
1042
|
-
include_count?: 'true' | 'false';
|
|
1043
|
-
include_extra_headers?: 'true' | 'false';
|
|
1044
|
-
};
|
|
1045
|
-
type CreateQueryInput = {
|
|
1046
|
-
include_permissions?: 'true' | 'false';
|
|
1047
|
-
};
|
|
1048
|
-
type ReadQueryInput = {
|
|
1049
|
-
include_permissions?: 'true' | 'false';
|
|
1050
|
-
try_list?: 'true' | 'false';
|
|
1051
|
-
};
|
|
1052
|
-
type UpdateQueryInput = {
|
|
1053
|
-
returning_all?: 'true' | 'false';
|
|
1054
|
-
};
|
|
1055
|
-
type UpsertQueryInput = {
|
|
1056
|
-
returning_all?: 'true' | 'false';
|
|
1057
|
-
include_permissions?: 'true' | 'false';
|
|
1058
|
-
};
|
|
1059
|
-
type AdvancedListBody = {
|
|
1060
|
-
filter?: Filter | unknown[];
|
|
1061
|
-
select?: Projection;
|
|
1062
|
-
sort?: Sort;
|
|
1063
|
-
populate?: Populate[] | string;
|
|
1064
|
-
include?: Include | Include[];
|
|
1065
|
-
tasks?: Task | Task[];
|
|
1066
|
-
skip?: string | number;
|
|
1067
|
-
limit?: string | number;
|
|
1068
|
-
page?: string | number;
|
|
1069
|
-
pageSize?: string | number;
|
|
1070
|
-
options?: {
|
|
1071
|
-
skim?: boolean;
|
|
1072
|
-
includePermissions?: boolean;
|
|
1073
|
-
includeCount?: boolean;
|
|
1074
|
-
includeExtraHeaders?: boolean;
|
|
1075
|
-
populateAccess?: unknown;
|
|
1076
|
-
};
|
|
1077
|
-
};
|
|
1078
|
-
type CountBody = {
|
|
1079
|
-
filter?: Filter | unknown[];
|
|
1080
|
-
options?: {
|
|
1081
|
-
access?: unknown;
|
|
1082
|
-
};
|
|
1083
|
-
};
|
|
1084
|
-
type AdvancedReadFilterBody = {
|
|
1085
|
-
filter?: Filter | unknown[];
|
|
1086
|
-
select?: Projection;
|
|
1087
|
-
sort?: Sort;
|
|
1088
|
-
populate?: Populate[] | string;
|
|
1089
|
-
include?: Include | Include[];
|
|
1090
|
-
tasks?: Task | Task[];
|
|
1091
|
-
options?: {
|
|
1092
|
-
skim?: boolean;
|
|
1093
|
-
includePermissions?: boolean;
|
|
1094
|
-
tryList?: boolean;
|
|
1095
|
-
populateAccess?: unknown;
|
|
1096
|
-
};
|
|
1097
|
-
};
|
|
1098
|
-
type AdvancedReadBody = {
|
|
1099
|
-
select?: Projection;
|
|
1100
|
-
populate?: Populate[] | string;
|
|
1101
|
-
include?: Include | Include[];
|
|
1102
|
-
tasks?: Task | Task[];
|
|
1103
|
-
options?: {
|
|
1104
|
-
skim?: boolean;
|
|
1105
|
-
includePermissions?: boolean;
|
|
1106
|
-
tryList?: boolean;
|
|
1107
|
-
populateAccess?: unknown;
|
|
1108
|
-
};
|
|
1109
|
-
};
|
|
1110
|
-
type AdvancedCreateBody = {
|
|
1111
|
-
data: unknown;
|
|
1112
|
-
select?: Projection;
|
|
1113
|
-
populate?: Populate[] | string;
|
|
1114
|
-
tasks?: Task | Task[];
|
|
1115
|
-
options?: {
|
|
1116
|
-
includePermissions?: boolean;
|
|
1117
|
-
populateAccess?: unknown;
|
|
1118
|
-
};
|
|
1119
|
-
};
|
|
1120
|
-
type AdvancedUpdateBody = {
|
|
1121
|
-
data: unknown;
|
|
1122
|
-
select?: Projection;
|
|
1123
|
-
populate?: Populate[] | string;
|
|
1124
|
-
tasks?: Task | Task[];
|
|
1125
|
-
options?: {
|
|
1126
|
-
returningAll?: boolean;
|
|
1127
|
-
includePermissions?: boolean;
|
|
1128
|
-
populateAccess?: unknown;
|
|
1129
|
-
};
|
|
1130
|
-
};
|
|
1131
|
-
type AdvancedUpsertBody = {
|
|
1132
|
-
data: Record<string, unknown>;
|
|
1133
|
-
select?: Projection;
|
|
1134
|
-
populate?: Populate[] | string;
|
|
1135
|
-
tasks?: Task | Task[];
|
|
1136
|
-
options?: {
|
|
1137
|
-
returningAll?: boolean;
|
|
1138
|
-
includePermissions?: boolean;
|
|
1139
|
-
populateAccess?: unknown;
|
|
1140
|
-
};
|
|
1141
|
-
};
|
|
1142
|
-
type DistinctBody = {
|
|
1143
|
-
filter?: Filter | unknown[];
|
|
1144
|
-
};
|
|
1145
|
-
type SubListBody = {
|
|
1146
|
-
filter?: Filter;
|
|
1147
|
-
select?: string[];
|
|
1148
|
-
};
|
|
1149
|
-
type SubReadBody = {
|
|
1150
|
-
select?: string[];
|
|
1151
|
-
populate?: SubPopulate | SubPopulate[] | string | string[];
|
|
1152
|
-
};
|
|
1153
|
-
|
|
1154
|
-
interface DefaultFindOneArgs<TModel = unknown> extends Omit<FindOneArgs<TModel>, 'overrides'> {
|
|
1155
|
-
}
|
|
1156
|
-
interface DefaultFindByIdArgs<TModel = unknown> extends Omit<FindByIdArgs<TModel>, 'overrides'> {
|
|
1157
|
-
}
|
|
1158
|
-
interface DefaultFindArgs<TModel = unknown> extends Omit<FindArgs<TModel>, 'overrides'> {
|
|
1159
|
-
}
|
|
1160
|
-
type RequestSchema = RequestSchemaLike;
|
|
1161
|
-
type NestedRequestSchema = {
|
|
1162
|
-
default?: RequestSchema;
|
|
1163
|
-
data?: RequestSchema;
|
|
1164
|
-
};
|
|
1165
|
-
type SubRouteGuardOptions = Record<string, Validation | Record<string, Validation>>;
|
|
1166
|
-
interface RequestSchemas {
|
|
1167
|
-
create?: RequestSchema;
|
|
1168
|
-
update?: RequestSchema;
|
|
1169
|
-
upsert?: RequestSchema;
|
|
1170
|
-
count?: RequestSchema;
|
|
1171
|
-
distinct?: RequestSchema;
|
|
1172
|
-
advancedList?: RequestSchema;
|
|
1173
|
-
advancedReadFilter?: RequestSchema;
|
|
1174
|
-
advancedRead?: RequestSchema;
|
|
1175
|
-
advancedCreate?: RequestSchema | NestedRequestSchema;
|
|
1176
|
-
advancedCreateData?: RequestSchema;
|
|
1177
|
-
advancedUpdate?: RequestSchema | NestedRequestSchema;
|
|
1178
|
-
advancedUpdateData?: RequestSchema;
|
|
1179
|
-
advancedUpsert?: RequestSchema | NestedRequestSchema;
|
|
1180
|
-
advancedUpsertData?: RequestSchema;
|
|
1181
|
-
subList?: RequestSchema;
|
|
1182
|
-
subRead?: RequestSchema;
|
|
1183
|
-
subCreate?: RequestSchema;
|
|
1184
|
-
subUpdate?: RequestSchema;
|
|
1185
|
-
subBulkUpdate?: RequestSchema;
|
|
1186
|
-
}
|
|
1187
|
-
interface DataRequestSchemas {
|
|
1188
|
-
advancedList?: RequestSchema;
|
|
1189
|
-
advancedReadFilter?: RequestSchema;
|
|
1190
|
-
advancedRead?: RequestSchema;
|
|
1191
|
-
}
|
|
1192
|
-
interface Defaults<TModel = unknown> {
|
|
1193
|
-
findOneArgs?: DefaultFindOneArgs<TModel>;
|
|
1194
|
-
findOneOptions?: FindOneOptions;
|
|
1195
|
-
findByIdArgs?: DefaultFindByIdArgs<TModel>;
|
|
1196
|
-
findByIdOptions?: FindByIdOptions;
|
|
1197
|
-
findArgs?: DefaultFindArgs<TModel>;
|
|
1198
|
-
findOptions?: FindOptions;
|
|
1199
|
-
createArgs?: CreateArgs;
|
|
1200
|
-
createOptions?: CreateOptions;
|
|
1201
|
-
updateOneArgs?: UpdateOneArgs<TModel>;
|
|
1202
|
-
updateOneOptions?: UpdateOneOptions;
|
|
1203
|
-
upsertOptions?: UpsertOptions;
|
|
1204
|
-
updateByIdArgs?: UpdateByIdArgs<TModel>;
|
|
1205
|
-
upsertArgs?: UpsertArgs<TModel>;
|
|
1206
|
-
updateByIdOptions?: UpdateByIdOptions;
|
|
1207
|
-
existsOptions?: ExistsOptions;
|
|
1208
|
-
publicListArgs?: PublicListArgs;
|
|
1209
|
-
publicListOptions?: PublicListOptions;
|
|
1210
|
-
publicCreateArgs?: PublicCreateArgs;
|
|
1211
|
-
publicCreateOptions?: PublicCreateOptions;
|
|
1212
|
-
publicReadArgs?: PublicReadArgs;
|
|
1213
|
-
publicReadOptions?: PublicReadOptions;
|
|
1214
|
-
publicUpdateArgs?: PublicUpdateArgs;
|
|
1215
|
-
publicUpdateOptions?: PublicUpdateOptions;
|
|
1216
|
-
}
|
|
1217
|
-
interface AccessRouterLogger {
|
|
1218
|
-
debug?: (...args: unknown[]) => unknown;
|
|
1219
|
-
info?: (...args: unknown[]) => unknown;
|
|
1220
|
-
warn?: (...args: unknown[]) => unknown;
|
|
1221
|
-
error?: (...args: unknown[]) => unknown;
|
|
1222
|
-
}
|
|
1223
|
-
interface GlobalOptions {
|
|
1224
|
-
requestPermissionField?: string;
|
|
1225
|
-
globalPermissions?: (this: AccessRouterRequest, req: AccessRouterRequest) => MaybePromise<GlobalPermissionValue>;
|
|
1226
|
-
logger?: AccessRouterLogger;
|
|
1227
|
-
}
|
|
1228
|
-
interface RootRouterOptions {
|
|
1229
|
-
basePath: string;
|
|
1230
|
-
operationAccess?: Validation;
|
|
1231
|
-
}
|
|
1232
|
-
interface OperationAccess {
|
|
1233
|
-
new?: Validation;
|
|
1234
|
-
list?: Validation;
|
|
1235
|
-
create?: Validation;
|
|
1236
|
-
read?: Validation;
|
|
1237
|
-
update?: Validation;
|
|
1238
|
-
upsert?: Validation;
|
|
1239
|
-
delete?: Validation;
|
|
1240
|
-
distinct?: Validation;
|
|
1241
|
-
count?: Validation;
|
|
1242
|
-
subs?: Validation | SubRouteGuardOptions;
|
|
1243
|
-
}
|
|
1244
|
-
type PermissionRule = Validation | OperationAccess;
|
|
1245
|
-
type PermissionSchema<TField extends string = string> = Partial<Record<TField, PermissionRule>>;
|
|
1246
|
-
interface DocPermissions {
|
|
1247
|
-
list?: ModelDocPermissionsHook;
|
|
1248
|
-
create?: ModelDocPermissionsHook;
|
|
1249
|
-
read?: ModelDocPermissionsHook;
|
|
1250
|
-
update?: ModelDocPermissionsHook;
|
|
1251
|
-
}
|
|
1252
|
-
interface DefaultModelRouterOptions<TModel = unknown> {
|
|
1253
|
-
listHardLimit?: number;
|
|
1254
|
-
documentPermissionField?: string;
|
|
1255
|
-
idParam?: string;
|
|
1256
|
-
idField?: string;
|
|
1257
|
-
resolveIdFilter?: ModelIdentifierHook<TModel>;
|
|
1258
|
-
parentPath?: string;
|
|
1259
|
-
queryRouteSegment?: string;
|
|
1260
|
-
mutationRouteSegment?: string;
|
|
1261
|
-
operationAccess?: Validation | OperationAccess;
|
|
1262
|
-
modelPermissionPrefix?: string;
|
|
1263
|
-
}
|
|
1264
|
-
interface ExtendedDefaultModelRouterOptions<TModel = unknown> extends DefaultModelRouterOptions<TModel> {
|
|
1265
|
-
'operationAccess.default'?: Validation;
|
|
1266
|
-
'operationAccess.new'?: Validation;
|
|
1267
|
-
'operationAccess.list'?: Validation;
|
|
1268
|
-
'operationAccess.read'?: Validation;
|
|
1269
|
-
'operationAccess.update'?: Validation;
|
|
1270
|
-
'operationAccess.delete'?: Validation;
|
|
1271
|
-
'operationAccess.create'?: Validation;
|
|
1272
|
-
'operationAccess.distinct'?: Validation;
|
|
1273
|
-
'operationAccess.count'?: Validation;
|
|
1274
|
-
'operationAccess.subs'?: SubRouteGuardOptions;
|
|
1275
|
-
}
|
|
1276
|
-
interface ModelRouterOptions<TModel = unknown> extends DefaultModelRouterOptions<TModel> {
|
|
1277
|
-
modelName?: string;
|
|
1278
|
-
basePath?: string;
|
|
1279
|
-
permissionSchema?: PermissionSchema<AccessRouterFieldKey<TModel>>;
|
|
1280
|
-
alwaysSelectFields?: string[];
|
|
1281
|
-
docPermissions?: DocPermissions | ModelDocPermissionsHook;
|
|
1282
|
-
baseFilter?: ModelBaseFilterHook | Record<string, ModelBaseFilterHook>;
|
|
1283
|
-
overrideFilter?: ModelOverrideFilterHook | Record<string, ModelOverrideFilterHook>;
|
|
1284
|
-
decorate?: ModelHook<TModel> | Record<string, ModelHook<TModel>>;
|
|
1285
|
-
decorateAll?: ModelListHook<TModel> | Record<string, ModelListHook<TModel>>;
|
|
1286
|
-
validate?: ValidateRule | ModelValidateHook | Record<string, ValidateRule | ModelValidateHook>;
|
|
1287
|
-
prepare?: ModelHook<TModel> | Record<string, ModelHook<TModel>>;
|
|
1288
|
-
transform?: ModelDocumentHook<TModel> | Record<string, ModelDocumentHook<TModel>>;
|
|
1289
|
-
afterPersist?: ModelDocumentHook<TModel> | Record<string, ModelDocumentHook<TModel>>;
|
|
1290
|
-
onChange?: Record<string, ModelChangeHook>;
|
|
1291
|
-
beforeDelete?: ModelDeleteHook<TModel>;
|
|
1292
|
-
afterDelete?: ModelDeleteHook<TModel>;
|
|
1293
|
-
requestSchemas?: RequestSchemas;
|
|
1294
|
-
defaults?: Defaults<TModel>;
|
|
1295
|
-
}
|
|
1296
|
-
interface DataRouterOptions<TData = unknown> {
|
|
1297
|
-
data?: TData[];
|
|
1298
|
-
listHardLimit?: number;
|
|
1299
|
-
idParam?: string;
|
|
1300
|
-
idField?: string;
|
|
1301
|
-
resolveIdFilter?: DataIdentifierHook<TData>;
|
|
1302
|
-
parentPath?: string;
|
|
1303
|
-
queryRouteSegment?: string;
|
|
1304
|
-
operationAccess?: Validation | OperationAccess;
|
|
1305
|
-
dataName?: string;
|
|
1306
|
-
basePath?: string;
|
|
1307
|
-
permissionSchema?: PermissionSchema<AccessRouterFieldKey<TData>>;
|
|
1308
|
-
baseFilter?: DataBaseFilterHook | Record<string, DataBaseFilterHook>;
|
|
1309
|
-
overrideFilter?: DataOverrideFilterHook | Record<string, DataOverrideFilterHook>;
|
|
1310
|
-
decorate?: DataHook<TData> | Record<string, DataHook<TData>>;
|
|
1311
|
-
decorateAll?: DataListHook<TData> | Record<string, DataListHook<TData>>;
|
|
1312
|
-
requestSchemas?: DataRequestSchemas;
|
|
1313
|
-
}
|
|
1314
|
-
interface ExtendedModelRouterOptions<TModel = unknown> extends ModelRouterOptions<TModel>, ExtendedDefaultModelRouterOptions<TModel> {
|
|
1315
|
-
'alwaysSelectFields.default'?: string[];
|
|
1316
|
-
'alwaysSelectFields.list'?: string[];
|
|
1317
|
-
'alwaysSelectFields.create'?: string[];
|
|
1318
|
-
'alwaysSelectFields.read'?: string[];
|
|
1319
|
-
'alwaysSelectFields.update'?: string[];
|
|
1320
|
-
'docPermissions.default'?: ModelDocPermissionsHook;
|
|
1321
|
-
'docPermissions.list'?: ModelDocPermissionsHook;
|
|
1322
|
-
'docPermissions.create'?: ModelDocPermissionsHook;
|
|
1323
|
-
'docPermissions.read'?: ModelDocPermissionsHook;
|
|
1324
|
-
'docPermissions.update'?: ModelDocPermissionsHook;
|
|
1325
|
-
'baseFilter.default'?: ModelBaseFilterHook;
|
|
1326
|
-
'baseFilter.list'?: ModelBaseFilterHook;
|
|
1327
|
-
'baseFilter.read'?: ModelBaseFilterHook;
|
|
1328
|
-
'baseFilter.update'?: ModelBaseFilterHook;
|
|
1329
|
-
'baseFilter.delete'?: ModelBaseFilterHook;
|
|
1330
|
-
'overrideFilter.default'?: ModelOverrideFilterHook;
|
|
1331
|
-
'overrideFilter.list'?: ModelOverrideFilterHook;
|
|
1332
|
-
'overrideFilter.read'?: ModelOverrideFilterHook;
|
|
1333
|
-
'overrideFilter.update'?: ModelOverrideFilterHook;
|
|
1334
|
-
'overrideFilter.delete'?: ModelOverrideFilterHook;
|
|
1335
|
-
'decorate.default'?: ModelHook;
|
|
1336
|
-
'decorate.list'?: ModelHook;
|
|
1337
|
-
'decorate.create'?: ModelHook;
|
|
1338
|
-
'decorate.read'?: ModelHook;
|
|
1339
|
-
'decorate.update'?: ModelHook;
|
|
1340
|
-
'decorateAll.default'?: ModelListHook;
|
|
1341
|
-
'decorateAll.list'?: ModelListHook;
|
|
1342
|
-
'validate.default'?: ValidateRule | ModelValidateHook;
|
|
1343
|
-
'validate.create'?: ValidateRule | ModelValidateHook;
|
|
1344
|
-
'validate.update'?: ValidateRule | ModelValidateHook;
|
|
1345
|
-
'prepare.default'?: ModelHook;
|
|
1346
|
-
'prepare.create'?: ModelHook;
|
|
1347
|
-
'prepare.update'?: ModelHook;
|
|
1348
|
-
'transform.default'?: ModelDocumentHook;
|
|
1349
|
-
'transform.update'?: ModelDocumentHook;
|
|
1350
|
-
'afterPersist.default'?: ModelDocumentHook;
|
|
1351
|
-
'afterPersist.create'?: ModelDocumentHook;
|
|
1352
|
-
'afterPersist.update'?: ModelDocumentHook;
|
|
1353
|
-
onChange?: Record<string, ModelChangeHook>;
|
|
1354
|
-
'requestSchemas.create'?: RequestSchema;
|
|
1355
|
-
'requestSchemas.update'?: RequestSchema;
|
|
1356
|
-
'requestSchemas.upsert'?: RequestSchema;
|
|
1357
|
-
'requestSchemas.count'?: RequestSchema;
|
|
1358
|
-
'requestSchemas.distinct'?: RequestSchema;
|
|
1359
|
-
'requestSchemas.advancedList'?: RequestSchema;
|
|
1360
|
-
'requestSchemas.advancedReadFilter'?: RequestSchema;
|
|
1361
|
-
'requestSchemas.advancedRead'?: RequestSchema;
|
|
1362
|
-
'requestSchemas.advancedCreate.default'?: RequestSchema;
|
|
1363
|
-
'requestSchemas.advancedCreate.data'?: RequestSchema;
|
|
1364
|
-
'requestSchemas.advancedUpdate'?: RequestSchema;
|
|
1365
|
-
'requestSchemas.advancedUpdate.default'?: RequestSchema;
|
|
1366
|
-
'requestSchemas.advancedUpdate.data'?: RequestSchema;
|
|
1367
|
-
'requestSchemas.advancedUpsert.default'?: RequestSchema;
|
|
1368
|
-
'requestSchemas.advancedUpsert.data'?: RequestSchema;
|
|
1369
|
-
'requestSchemas.subList'?: RequestSchema;
|
|
1370
|
-
'requestSchemas.subRead'?: RequestSchema;
|
|
1371
|
-
'requestSchemas.subCreate'?: RequestSchema;
|
|
1372
|
-
'requestSchemas.subUpdate'?: RequestSchema;
|
|
1373
|
-
'requestSchemas.subBulkUpdate'?: RequestSchema;
|
|
1374
|
-
'defaults.findOneArgs'?: DefaultFindOneArgs<TModel>;
|
|
1375
|
-
'defaults.findOneOptions'?: FindOneOptions;
|
|
1376
|
-
'defaults.findByIdArgs'?: DefaultFindByIdArgs<TModel>;
|
|
1377
|
-
'defaults.findByIdOptions'?: FindByIdOptions;
|
|
1378
|
-
'defaults.findArgs'?: DefaultFindArgs<TModel>;
|
|
1379
|
-
'defaults.findOptions'?: FindOptions;
|
|
1380
|
-
'defaults.createArgs'?: CreateArgs;
|
|
1381
|
-
'defaults.createOptions'?: CreateOptions;
|
|
1382
|
-
'defaults.updateOneArgs'?: UpdateOneArgs<TModel>;
|
|
1383
|
-
'defaults.updateOneOptions'?: UpdateOneOptions;
|
|
1384
|
-
'defaults.updateByIdArgs'?: UpdateByIdArgs<TModel>;
|
|
1385
|
-
'defaults.updateByIdOptions'?: UpdateByIdOptions;
|
|
1386
|
-
'defaults.upsertArgs'?: UpsertArgs<TModel>;
|
|
1387
|
-
'defaults.existsOptions'?: ExistsOptions;
|
|
1388
|
-
'defaults.publicListArgs'?: PublicListArgs;
|
|
1389
|
-
'defaults.publicListOptions'?: PublicListOptions;
|
|
1390
|
-
'defaults.publicCreateArgs'?: PublicCreateArgs;
|
|
1391
|
-
'defaults.publicCreateOptions'?: PublicCreateOptions;
|
|
1392
|
-
'defaults.publicReadArgs'?: PublicReadArgs;
|
|
1393
|
-
'defaults.publicReadOptions'?: PublicReadOptions;
|
|
1394
|
-
'defaults.publicUpdateArgs'?: PublicUpdateArgs;
|
|
1395
|
-
'defaults.publicUpdateOptions'?: PublicUpdateOptions;
|
|
1396
|
-
}
|
|
1397
|
-
interface ExtendedDataRouterOptions<TData = unknown> extends DataRouterOptions<TData> {
|
|
1398
|
-
'requestSchemas.advancedList'?: RequestSchema;
|
|
1399
|
-
'requestSchemas.advancedReadFilter'?: RequestSchema;
|
|
1400
|
-
'requestSchemas.advancedRead'?: RequestSchema;
|
|
1401
|
-
}
|
|
1402
|
-
|
|
1403
|
-
interface DistinctArgs<T = unknown> {
|
|
1404
|
-
filter?: Filter<T>;
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
|
-
declare function parsePathParam(value: string | string[] | undefined, parameter: string): string;
|
|
1408
|
-
declare function parseQuery<TSchema extends z.ZodTypeAny>(schema: TSchema, value: unknown): z.output<TSchema>;
|
|
1409
|
-
declare function parseBody<TSchema extends z.ZodTypeAny>(schema: TSchema, value: unknown): z.output<TSchema>;
|
|
1410
|
-
declare function parseBodyWithSchema<TSchema extends z.ZodTypeAny>(schema: TSchema, value: unknown, userSchema?: RequestSchemaLike): Promise<z.output<TSchema>>;
|
|
1411
|
-
declare function parseNestedBodyWithSchema(schema: z.ZodTypeAny, value: unknown, nestedKey: string, userSchema?: RequestSchemaLike): Promise<Record<string, unknown>>;
|
|
1412
|
-
/**
|
|
1413
|
-
* Wraps a request validator into a request schema adapter used by `access-router`.
|
|
1414
|
-
*
|
|
1415
|
-
* @example
|
|
1416
|
-
* const schema = defineRequestSchema(fromZod(z.object({ name: z.string() })));
|
|
1417
|
-
*/
|
|
1418
|
-
declare function defineRequestSchema<T = unknown>(validator: RequestSchemaValidator<T>, options?: RequestSchemaOptions): RequestSchemaAdapter<T>;
|
|
1419
|
-
/**
|
|
1420
|
-
* Adapts a Zod schema into a `RequestSchemaValidator` for `access-router`.
|
|
1421
|
-
*
|
|
1422
|
-
* @example
|
|
1423
|
-
* const validator = fromZod(z.object({ name: z.string() }));
|
|
1424
|
-
*/
|
|
1425
|
-
declare function fromZod<TSchema extends z.ZodTypeAny>(schema: TSchema): RequestSchemaValidator<z.output<TSchema>>;
|
|
1426
|
-
declare function fromStandardSchema<TSchema extends StandardSchemaV1>(schema: TSchema): RequestSchemaValidator<StandardSchemaInferOutput<TSchema>>;
|
|
1427
|
-
declare function fromYup<TSchema extends YupSchemaLike>(schema: TSchema): RequestSchemaValidator;
|
|
1428
|
-
declare function fromJoi<TSchema extends JoiSchemaLike>(schema: TSchema): RequestSchemaValidator;
|
|
1429
|
-
declare function fromAjv<TValue = unknown>(validator: AjvValidatorLike<TValue>): RequestSchemaValidator<TValue>;
|
|
1430
|
-
declare function fromValibot<TSchema, TOutput = unknown>(schema: TSchema, safeParse: ValibotSafeParseLike): RequestSchemaValidator<TOutput>;
|
|
1431
|
-
declare function fromArkType<TValue = unknown>(type: ArkTypeLike<TValue>): RequestSchemaValidator<TValue>;
|
|
1432
|
-
declare function fromIoTs<TValue = unknown>(decoder: IoTsDecoderLike<TValue>): RequestSchemaValidator<TValue>;
|
|
1433
|
-
declare function fromSuperstruct<TStruct, TOutput = unknown>(struct: TStruct, validate: SuperstructValidateLike): RequestSchemaValidator<TOutput>;
|
|
1434
|
-
declare function fromVine<TValue = unknown>(validator: VineValidatorLike<TValue>): RequestSchemaValidator<TValue>;
|
|
1435
|
-
|
|
1436
|
-
export { FilterOperator as $, type AccessRouterBaseRequest as A, type BaseFilterAccess as B, type Change as C, type DataBaseFilterHook as D, type DataFindOptions as E, type DataHook as F, type DataHookContext as G, type DataIdentifierHook as H, type DataListHook as I, type DataOverrideFilterHook as J, type DataRequest as K, type DataRequestSchemas as L, type DataRouterOptions as M, type DecorateAccess as N, type DecorateAllAccess as O, type DeepFieldPath as P, type DefaultModelRouterOptions as Q, type Defaults as R, type DistinctArgs as S, type DistinctBody as T, type DocPermissionsAccess as U, type ErrorResult as V, type ExistsOptions as W, type ExtendedDataRouterOptions as X, type ExtendedDefaultModelRouterOptions as Y, type ExtendedModelRouterOptions as Z, type Filter as _, type AccessRouterFieldKey as a, type RootDataListQueryEntry as a$, type FindAccess as a0, type FindArgs as a1, type FindByIdArgs as a2, type FindByIdOptions as a3, type FindOneArgs as a4, type FindOneOptions as a5, type FindOptions as a6, type GlobalOptions as a7, type GlobalPermissionValue as a8, type GuardHook as a9, type PermissionSchema as aA, type Populate as aB, type PopulateAccess as aC, type PrepareAccess as aD, type Projection as aE, type PublicCreateArgs as aF, type PublicCreateOptions as aG, type PublicListArgs as aH, type PublicListOptions as aI, type PublicOutput as aJ, type PublicReadArgs as aK, type PublicReadOptions as aL, type PublicUpdateArgs as aM, type PublicUpdateOptions as aN, type PublicUpsertArgs as aO, type PublicUpsertOptions as aP, type ReadQueryInput as aQ, type Request as aR, type RequestSchemaAdapter as aS, type RequestSchemaFailure as aT, type RequestSchemaIssue as aU, type RequestSchemaLike as aV, type RequestSchemaOptions as aW, type RequestSchemaResult as aX, type RequestSchemaSuccess as aY, type RequestSchemaValidator as aZ, type RequestSchemas as a_, type IdentifierHook as aa, type Include as ab, type IoTsContextEntryLike as ac, type IoTsDecodeErrorLike as ad, type IoTsDecoderLike as ae, type JoiSchemaLike as af, type JoiValidationErrorDetailLike as ag, type KeyValueProjection as ah, type ListQueryInput as ai, type ListResult as aj, type MaybePromise as ak, type ModelBaseFilterHook as al, type ModelChangeHook as am, type ModelDeleteHook as an, type ModelDocPermissionsHook as ao, type ModelDocument as ap, type ModelDocumentHook as aq, type ModelHook as ar, type ModelHookContext as as, type ModelIdentifierHook as at, type ModelListHook as au, type ModelOverrideFilterHook as av, type ModelRequest as aw, type ModelRouterOptions as ax, type ModelValidateHook as ay, type PathValue as az, type AccessRouterLogger as b, type ValidateRule as b$, type RootDataOperation as b0, type RootDataReadByFilterQueryEntry as b1, type RootDataReadByIdQueryEntry as b2, type RootModelCountQueryEntry as b3, type RootModelCreateQueryEntry as b4, type RootModelDeleteQueryEntry as b5, type RootModelDistinctQueryEntry as b6, type RootModelListQueryEntry as b7, type RootModelNewQueryEntry as b8, type RootModelOperation as b9, type StandardSchemaPathSegment as bA, type StandardSchemaResult as bB, type StandardSchemaSuccess as bC, type StandardSchemaV1 as bD, StatusCodes as bE, type SubListBody as bF, type SubPopulate as bG, type SubQueryEntry as bH, type SubReadBody as bI, type SuperstructFailureLike as bJ, type SuperstructValidateLike as bK, type Task as bL, type TransformAccess as bM, type TypedFilter as bN, type UpdateByIdArgs as bO, type UpdateByIdOptions as bP, type UpdateOneArgs as bQ, type UpdateOneOptions as bR, type UpdateQueryInput as bS, type UpsertArgs as bT, type UpsertOptions as bU, type UpsertQueryInput as bV, type ValibotIssueLike as bW, type ValibotPathItemLike as bX, type ValibotSafeParseLike as bY, type ValibotSafeParseResult as bZ, type ValidateAccess as b_, type RootModelReadByFilterQueryEntry as ba, type RootModelReadByIdQueryEntry as bb, type RootModelSubBulkUpdateQueryEntry as bc, type RootModelSubCreateQueryEntry as bd, type RootModelSubDeleteQueryEntry as be, type RootModelSubListQueryEntry as bf, type RootModelSubReadQueryEntry as bg, type RootModelSubUpdateQueryEntry as bh, type RootModelUpdateQueryEntry as bi, type RootModelUpsertQueryEntry as bj, type RootOperationResult as bk, type RootQueryEntry as bl, type RootRouterOptions as bm, type RootSubOperation as bn, type RootTarget as bo, type RouteGuardAccess as bp, type SelectAccess as bq, type SelectedPopulatedPublicOutput as br, type SelectedPublicOutput as bs, type ServiceResult as bt, type SingleResult as bu, type Sort as bv, type SortOrder as bw, type StandardSchemaFailure as bx, type StandardSchemaInferOutput as by, type StandardSchemaIssue as bz, type AccessRouterRequest as c, type Validation as c0, type ValidationError as c1, type VineValidationErrorLike as c2, type VineValidationMessageLike as c3, type VineValidatorLike as c4, type YupSchemaLike as c5, type YupValidationErrorLike as c6, defineRequestSchema as c7, fromAjv as c8, fromArkType as c9, fromIoTs as ca, fromJoi as cb, fromStandardSchema as cc, fromSuperstruct as cd, fromValibot as ce, fromVine as cf, fromYup as cg, fromZod as ch, parseBody as ci, parseBodyWithSchema as cj, parseNestedBodyWithSchema as ck, parsePathParam as cl, parseQuery as cm, DataService as cn, Model as co, Service as cp, PublicService as cq, type AccessRouterPermissionMap as cr, type AccessRouterPermissions as cs, type Permissions as ct, 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, Codes as q, type CountBody as r, type CreateArgs as s, type CreateOptions as t, type CreateQueryInput as u, CustomHeaders as v, type DataFilter as w, type DataFindArgs as x, type DataFindOneArgs as y, type DataFindOneOptions as z };
|