@web-ts-toolkit/access-router 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -358
- package/advanced.d.mts +1072 -0
- package/advanced.d.ts +1072 -0
- package/advanced.js +719 -0
- package/advanced.mjs +646 -0
- package/index.d.mts +179 -1435
- package/index.d.ts +179 -1435
- package/index.js +2897 -1948
- package/index.mjs +2840 -1846
- package/package.json +9 -3
- package/service-DLKAswCS.d.mts +1117 -0
- package/service-DLKAswCS.d.ts +1117 -0
package/index.d.mts
CHANGED
|
@@ -1,811 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
import { Response, NextFunction, Router } from 'express';
|
|
3
|
+
import { _ as GlobalOptions, E as DefaultModelRouterOptions, N as ExtendedDefaultModelRouterOptions, ah as ModelRouterOptions, O as ExtendedModelRouterOptions, w as DataRouterOptions, M as ExtendedDataRouterOptions, A as AccessRouterBaseRequest, a0 as GuardHook, ag as ModelRequest, u as DataRequest, bi as DataService, bj as Model, bk as Service, bl as PublicService, bh as Validation, aX as RootRouterOptions } from './service-DLKAswCS.mjs';
|
|
4
|
+
export { bm as AccessRouterPermissionMap, bn as AccessRouterPermissions, e as AccessRouterRequest, f as AccessRouterRequestExtensions, bo as Permissions } from './service-DLKAswCS.mjs';
|
|
5
5
|
import JsonRouter from '@web-ts-toolkit/express-json-router';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
modelName: string;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
changes(doc: Record<string, unknown>, context: MiddlewareContext): Promise<void>;
|
|
52
|
-
validate(allowedData: unknown, access: ValidateAccess, context: MiddlewareContext): Promise<boolean | unknown[]>;
|
|
53
|
-
checkIfModelPermissionExists(accesses: DocPermissionsAccess[]): boolean;
|
|
54
|
-
protected validateClientFilter(filter: Filter | null | undefined): string[];
|
|
55
|
-
protected processInclude(include: Include | Include[]): {
|
|
56
|
-
includes: Include[];
|
|
57
|
-
includeLocalFields: any[];
|
|
58
|
-
includePaths: any[];
|
|
59
|
-
};
|
|
60
|
-
protected includeDocs(docs: any, include: Include | Include[]): Promise<any>;
|
|
61
|
-
private includeDocsList;
|
|
62
|
-
private includeDocsCount;
|
|
63
|
-
protected parseClientData(filter: any): Promise<unknown>;
|
|
64
|
-
private handleSubQuery;
|
|
65
|
-
private handleDate;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
interface FindProps {
|
|
69
|
-
filter: Filter;
|
|
70
|
-
select?: Projection;
|
|
71
|
-
sort?: Sort;
|
|
72
|
-
populate?: Populate[] | string;
|
|
73
|
-
limit?: string | number;
|
|
74
|
-
skip?: string | number;
|
|
75
|
-
lean?: boolean;
|
|
76
|
-
}
|
|
77
|
-
interface FindOneProps {
|
|
78
|
-
filter: Filter;
|
|
79
|
-
select?: Projection;
|
|
80
|
-
sort?: Sort;
|
|
81
|
-
populate?: Populate[] | string;
|
|
82
|
-
lean?: boolean;
|
|
83
|
-
}
|
|
84
|
-
type SortValue = 1 | -1 | 'asc' | 'ascending' | 'desc' | 'descending';
|
|
85
|
-
type SortType = string | [string, SortValue][] | {
|
|
86
|
-
[key: string]: SortValue;
|
|
87
|
-
} | Map<string, SortValue> | null | undefined;
|
|
88
|
-
declare class Model {
|
|
89
|
-
modelName: string;
|
|
90
|
-
model: mongoose.Model<any>;
|
|
91
|
-
constructor(modelName: string);
|
|
92
|
-
new(): any;
|
|
93
|
-
create(data: any): Promise<any>;
|
|
94
|
-
find({ filter, select, sort, populate, limit, skip, lean }: FindProps): mongoose.Query<any[], any, {}, any, "find", {}>;
|
|
95
|
-
validateSort(sort: SortType, logError?: (msg: string, ...args: unknown[]) => void): boolean;
|
|
96
|
-
findOne({ filter, select, sort, populate, lean }: FindOneProps): mongoose.Query<any, any, {}, any, "findOne", {}>;
|
|
97
|
-
findOneAndDelete(filter: any): mongoose.Query<any, any, {}, any, "findOneAndDelete", {}>;
|
|
98
|
-
exists(filter: any): mongoose.Query<any, any, {}, any, "findOne", {}>;
|
|
99
|
-
countDocuments(filter?: {}): mongoose.Query<number, any, {}, any, "countDocuments", {}>;
|
|
100
|
-
estimatedDocumentCount(): mongoose.Query<number, any, {}, any, "estimatedDocumentCount", {}>;
|
|
101
|
-
distinct(field: string, conditions?: {}): mongoose.Query<any[], any, {}, any, "distinct", {}>;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
declare class Service extends Base {
|
|
105
|
-
model: Model;
|
|
106
|
-
options: ModelRouterOptions;
|
|
107
|
-
defaults: Defaults;
|
|
108
|
-
baseFields: string[];
|
|
109
|
-
baseFieldsExt: string[];
|
|
110
|
-
constructor(req: Request, modelName: string);
|
|
111
|
-
findOne(filter: Filter, args?: FindOneArgs, options?: FindOneOptions): Promise<SingleResult | ErrorResult>;
|
|
112
|
-
findById(id: string, args?: FindByIdArgs, options?: FindByIdOptions): Promise<SingleResult | ErrorResult>;
|
|
113
|
-
find(filter: Filter, args?: FindArgs, options?: FindOptions, decorate?: Function): Promise<ListResult | ErrorResult>;
|
|
114
|
-
create(data: any, args?: CreateArgs, options?: CreateOptions, decorate?: Function): Promise<ListResult | ErrorResult>;
|
|
115
|
-
new(): Promise<SingleResult>;
|
|
116
|
-
updateOne(filter: Filter, data: any, args?: UpdateOneArgs, options?: UpdateOneOptions, decorate?: Function): Promise<SingleResult | ErrorResult>;
|
|
117
|
-
updateById(id: string, data: any, { populate, overrides }?: UpdateByIdArgs, { skim, includePermissions, populateAccess, }?: UpdateByIdOptions, decorate?: Function): Promise<SingleResult | ErrorResult>;
|
|
118
|
-
upsert(filter: Filter, data: any, args?: UpsertArgs, options?: UpsertOptions, decorate?: Function): Promise<ServiceResult>;
|
|
119
|
-
delete(id: string): Promise<SingleResult | ErrorResult>;
|
|
120
|
-
exists(filter: Filter, options: ExistsOptions & {
|
|
121
|
-
includeId: true;
|
|
122
|
-
}): Promise<SingleResult | ErrorResult>;
|
|
123
|
-
exists(filter: Filter, options?: ExistsOptions): Promise<SingleResult<boolean> | ErrorResult>;
|
|
124
|
-
distinct(field: string, args?: DistinctArgs): Promise<ListResult | ErrorResult>;
|
|
125
|
-
count(filter: any, access?: BaseFilterAccess): Promise<SingleResult<number> | ErrorResult>;
|
|
126
|
-
getDocPermissions(doc: any): unknown;
|
|
127
|
-
private getFieldPermissionAccess;
|
|
128
|
-
private getAccessibleIdSet;
|
|
129
|
-
listSub(id: any, sub: any, options?: {
|
|
130
|
-
filter: Filter;
|
|
131
|
-
fields: string[];
|
|
132
|
-
}): Promise<ListResult | ErrorResult>;
|
|
133
|
-
readSub(id: any, sub: any, subId: any, options?: {
|
|
134
|
-
fields: string[];
|
|
135
|
-
populate: SubPopulate | SubPopulate[];
|
|
136
|
-
}): Promise<SingleResult | ErrorResult>;
|
|
137
|
-
updateSub(id: any, sub: any, subId: any, data: any): Promise<SingleResult | ErrorResult>;
|
|
138
|
-
bulkUpdateSub(id: any, sub: any, data: any): Promise<ListResult | ErrorResult>;
|
|
139
|
-
createSub(id: any, sub: any, data: any, options?: {
|
|
140
|
-
addFirst: boolean;
|
|
141
|
-
}): Promise<ListResult | ErrorResult>;
|
|
142
|
-
deleteSub(id: any, sub: any, subId: any): Promise<SingleResult | ErrorResult>;
|
|
143
|
-
getParentDoc(id: any, sub: any, args?: {
|
|
144
|
-
populate?: SubPopulate | SubPopulate[];
|
|
145
|
-
}, options?: {
|
|
146
|
-
access?: BaseFilterAccess;
|
|
147
|
-
lean?: boolean;
|
|
148
|
-
}): Promise<any>;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
declare class PublicService extends Service {
|
|
152
|
-
_list(filter: Filter, args?: PublicListArgs, options?: PublicListOptions): Promise<ListResult | ErrorResult>;
|
|
153
|
-
_create(data: any, args?: PublicCreateArgs, options?: PublicCreateOptions): Promise<ListResult | ErrorResult>;
|
|
154
|
-
_new(): Promise<SingleResult>;
|
|
155
|
-
_read(id: string, args?: PublicReadArgs, options?: PublicReadOptions): Promise<SingleResult | ErrorResult>;
|
|
156
|
-
_readFilter(filter: Filter, args?: PublicReadArgs & {
|
|
157
|
-
sort?: Sort;
|
|
158
|
-
}, options?: PublicReadOptions): Promise<SingleResult | ErrorResult>;
|
|
159
|
-
_update(id: string, data: any, args?: PublicUpdateArgs, options?: PublicUpdateOptions): Promise<SingleResult | ErrorResult>;
|
|
160
|
-
_delete(id: string): Promise<SingleResult | ErrorResult>;
|
|
161
|
-
_distinct(field: string, options?: DistinctArgs): Promise<ListResult | ErrorResult>;
|
|
162
|
-
_count(filter: any, access?: BaseFilterAccess): Promise<SingleResult<number> | ErrorResult>;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
declare class DataService<T> {
|
|
166
|
-
req: Request;
|
|
167
|
-
dataName: string;
|
|
168
|
-
options: DataRouterOptions;
|
|
169
|
-
data: T[];
|
|
170
|
-
constructor(req: Request, dataName: string);
|
|
171
|
-
findOne(filter: DataFilter, args?: DataFindOneArgs, options?: DataFindOneOptions): Promise<SingleResult<T> | ErrorResult>;
|
|
172
|
-
findById(id: string, args?: DataFindOneArgs, options?: DataFindOneOptions): Promise<SingleResult<T> | ErrorResult>;
|
|
173
|
-
find(filter: DataFilter, args?: DataFindArgs, options?: DataFindOptions): Promise<ListResult<T> | ErrorResult>;
|
|
174
|
-
decorate<TDoc>(doc: TDoc, access: DecorateAccess, context?: DataMiddlewareContext): Promise<TDoc>;
|
|
175
|
-
decorateAll<TDoc>(docs: TDoc[], access: DecorateAllAccess): Promise<TDoc[]>;
|
|
176
|
-
genAllowedFields(doc: unknown, access: SelectAccess, baseFields?: string[]): Promise<string[]>;
|
|
177
|
-
genFilter(access?: BaseFilterAccess, filter?: any): Promise<Filter>;
|
|
178
|
-
genIDFilter(id: string): Promise<Filter>;
|
|
179
|
-
genSelect(access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: string[]): Promise<string[]>;
|
|
180
|
-
genQuerySelect(access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: string[]): Promise<string[]>;
|
|
181
|
-
pickAllowedFields<TDoc>(doc: TDoc, access: SelectAccess, baseFields?: string[]): Promise<TDoc>;
|
|
182
|
-
trimOutputFields<TDoc>(doc: TDoc, access: SelectAccess, baseFields?: string[]): Promise<TDoc>;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
declare class Core {
|
|
186
|
-
private req;
|
|
187
|
-
private caches;
|
|
188
|
-
constructor(req: Request);
|
|
189
|
-
getIdentifier(modelName: string): string;
|
|
190
|
-
genIDFilter(modelName: string, id: string): Promise<any>;
|
|
191
|
-
genFilter(modelName: string, access?: BaseFilterAccess, _filter?: Filter): Promise<Filter>;
|
|
192
|
-
private removePrefix;
|
|
193
|
-
genAllowedFields(modelName: string, doc: unknown, access: SelectAccess, baseFields?: any[]): Promise<string[]>;
|
|
194
|
-
pickAllowedFields<T>(modelName: string, doc: T, access: SelectAccess, baseFields?: any[]): Promise<T>;
|
|
195
|
-
genSelect(modelName: string, access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: any[]): Promise<string[]>;
|
|
196
|
-
genPopulate(modelName: string, access?: SelectAccess | BaseFilterAccess, _populate?: Populate | Populate[] | string | null): Promise<(string | Populate)[]>;
|
|
197
|
-
validate(modelName: string, allowedData: unknown, access: ValidateAccess, context: MiddlewareContext): Promise<boolean | unknown[]>;
|
|
198
|
-
prepare<T>(modelName: string, allowedData: T, access: PrepareAccess, context: MiddlewareContext): Promise<T>;
|
|
199
|
-
transform<T>(modelName: string, doc: T, access: TransformAccess, context: MiddlewareContext): Promise<T>;
|
|
200
|
-
finalize<T>(modelName: string, doc: T, access: FinalizeAccess, context: MiddlewareContext): Promise<T>;
|
|
201
|
-
changes(modelName: string, doc: Record<string, unknown>, context: MiddlewareContext): Promise<void>;
|
|
202
|
-
genDocPermissions(modelName: string, doc: unknown, access: DocPermissionsAccess, context: MiddlewareContext): Promise<{}>;
|
|
203
|
-
addEmptyPermissions<T>(modelName: string, doc: T): T;
|
|
204
|
-
addDocPermissions<T>(modelName: string, doc: T, access: DocPermissionsAccess, context: MiddlewareContext): Promise<T>;
|
|
205
|
-
addFieldPermissions<T extends {
|
|
206
|
-
_id?: unknown;
|
|
207
|
-
}>(modelName: string, doc: T, access: DocPermissionsAccess, context: MiddlewareContext): Promise<T>;
|
|
208
|
-
decorate<T>(modelName: string, doc: T, access: DecorateAccess, context: MiddlewareContext): Promise<T>;
|
|
209
|
-
decorateAll<T>(modelName: string, docs: T[], access: DecorateAllAccess, context: MiddlewareContext): Promise<T[]>;
|
|
210
|
-
runTasks<T extends object>(modelName: string, docObject: T, task: Task | Task[]): T;
|
|
211
|
-
getPermissions(): Permission;
|
|
212
|
-
setPermissions(): Promise<void>;
|
|
213
|
-
canActivate(routeGuard: Validation): Promise<any>;
|
|
214
|
-
isAllowed(modelName: string, access: RouteGuardAccess | string): Promise<any>;
|
|
215
|
-
getService(modelName: string): Service;
|
|
216
|
-
getPublicService(modelName: string): PublicService;
|
|
217
|
-
service(modelName: string): PublicService;
|
|
218
|
-
svc(modelName: string): PublicService;
|
|
219
|
-
private getGlobalPermissions;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
declare class DataCore {
|
|
223
|
-
private req;
|
|
224
|
-
private caches;
|
|
225
|
-
constructor(req: Request);
|
|
226
|
-
genIDFilter(dataName: string, id: string): Promise<any>;
|
|
227
|
-
genFilter(dataName: string, access?: BaseFilterAccess, _filter?: Filter): Promise<Filter>;
|
|
228
|
-
genAllowedFields(dataName: string, _doc: unknown, access: SelectAccess, baseFields?: any[]): Promise<string[]>;
|
|
229
|
-
pickAllowedFields<TDoc>(dataName: string, doc: TDoc, access: SelectAccess, baseFields?: any[]): Promise<TDoc>;
|
|
230
|
-
genSelect(dataName: string, access: SelectAccess, targetFields?: Projection, skipChecks?: boolean, subPaths?: any[]): Promise<string[]>;
|
|
231
|
-
decorate<TDoc>(dataName: string, doc: TDoc, access: DecorateAccess, context?: DataMiddlewareContext): Promise<TDoc>;
|
|
232
|
-
decorateAll<TDoc>(dataName: string, docs: TDoc[], access: DecorateAllAccess): Promise<TDoc[]>;
|
|
233
|
-
getPermissions(): Permission;
|
|
234
|
-
setPermissions(): Promise<void>;
|
|
235
|
-
canActivate(routeGuard: Validation): Promise<any>;
|
|
236
|
-
isAllowed(dataName: string, access: RouteGuardAccess | string): Promise<any>;
|
|
237
|
-
getService(dataName: string): DataService<unknown>;
|
|
238
|
-
service(dataName: string): DataService<unknown>;
|
|
239
|
-
svc(dataName: string): DataService<unknown>;
|
|
240
|
-
private getGlobalPermissions;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
declare enum StatusCodes {
|
|
244
|
-
OK = 200,
|
|
245
|
-
Created = 201,
|
|
246
|
-
BadRequest = 400,
|
|
247
|
-
Unauthorized = 401,
|
|
248
|
-
Forbidden = 403,
|
|
249
|
-
NotFound = 404,
|
|
250
|
-
UnprocessableContent = 422
|
|
251
|
-
}
|
|
252
|
-
declare enum Codes {
|
|
253
|
-
Success = "success",
|
|
254
|
-
Created = "created",
|
|
255
|
-
BadRequest = "bad_request",
|
|
256
|
-
Unauthorized = "unauthorized",
|
|
257
|
-
Forbidden = "forbidden",
|
|
258
|
-
NotFound = "not_found"
|
|
259
|
-
}
|
|
260
|
-
declare enum CustomHeaders {
|
|
261
|
-
TotalCount = "wtt-total-count",
|
|
262
|
-
ReturnedCount = "wtt-returned-count",
|
|
263
|
-
Page = "wtt-page",
|
|
264
|
-
PageSize = "wtt-page-size",
|
|
265
|
-
TotalPages = "wtt-total-pages",
|
|
266
|
-
HasNextPage = "wtt-has-next-page",
|
|
267
|
-
HasPreviousPage = "wtt-has-previous-page"
|
|
268
|
-
}
|
|
269
|
-
declare enum FilterOperator {
|
|
270
|
-
SubQuery = 0,
|
|
271
|
-
Date = 1
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
type Validation = boolean | string | string[] | Function;
|
|
275
|
-
interface KeyValueProjection {
|
|
276
|
-
[key: string]: 1 | -1;
|
|
277
|
-
}
|
|
278
|
-
type Projection = string[] | string | KeyValueProjection;
|
|
279
|
-
type SortOrder = -1 | 1 | 'asc' | 'ascending' | 'desc' | 'descending';
|
|
280
|
-
type Sort = string | {
|
|
281
|
-
[key: string]: SortOrder;
|
|
282
|
-
} | [string, SortOrder][] | undefined | null;
|
|
283
|
-
type Filter = false | Record<string, unknown>;
|
|
284
|
-
interface Include {
|
|
285
|
-
model: string;
|
|
286
|
-
op: 'list' | 'read' | 'count';
|
|
287
|
-
path: string;
|
|
288
|
-
filter?: Filter;
|
|
289
|
-
localField: string;
|
|
290
|
-
foreignField: string;
|
|
291
|
-
args?: unknown;
|
|
292
|
-
options?: unknown;
|
|
293
|
-
}
|
|
294
|
-
type FindAccess = 'list' | 'read';
|
|
295
|
-
type PopulateAccess = 'list' | 'read';
|
|
296
|
-
interface Populate {
|
|
297
|
-
path: string;
|
|
298
|
-
select?: Projection;
|
|
299
|
-
match?: unknown;
|
|
300
|
-
access?: PopulateAccess;
|
|
301
|
-
}
|
|
302
|
-
interface SubPopulate {
|
|
303
|
-
path: string;
|
|
304
|
-
select?: Projection;
|
|
305
|
-
}
|
|
306
|
-
interface keyValue {
|
|
307
|
-
[key: string]: unknown;
|
|
308
|
-
}
|
|
309
|
-
interface MiddlewareContext {
|
|
310
|
-
modelName: string;
|
|
311
|
-
model: mongoose.Model<unknown>;
|
|
312
|
-
originalDocObject?: Record<string, unknown>;
|
|
313
|
-
finalDocObject?: Record<string, unknown>;
|
|
314
|
-
diff?(doc: Document): void;
|
|
315
|
-
currentDoc?: keyValue;
|
|
316
|
-
originalData?: Record<string, unknown>;
|
|
317
|
-
preparedData?: Record<string, unknown>;
|
|
318
|
-
modifiedPaths?: string[];
|
|
319
|
-
changes?: Diff<unknown>[];
|
|
320
|
-
docPermissions?: keyValue;
|
|
321
|
-
fieldPermissionAccess?: {
|
|
322
|
-
readIds?: Set<string>;
|
|
323
|
-
updateIds?: Set<string>;
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
|
-
interface DataMiddlewareContext {
|
|
327
|
-
}
|
|
328
|
-
interface RootQueryEntry {
|
|
329
|
-
model: string;
|
|
330
|
-
op: string;
|
|
331
|
-
id?: string;
|
|
332
|
-
field?: string;
|
|
333
|
-
filter?: Filter;
|
|
334
|
-
data?: unknown;
|
|
335
|
-
args?: unknown;
|
|
336
|
-
options?: unknown;
|
|
337
|
-
order?: number;
|
|
338
|
-
}
|
|
339
|
-
interface SubQueryEntry extends RootQueryEntry {
|
|
340
|
-
sqOptions?: {
|
|
341
|
-
path?: string;
|
|
342
|
-
compact?: boolean;
|
|
343
|
-
};
|
|
344
|
-
}
|
|
345
|
-
interface Task {
|
|
346
|
-
type: string;
|
|
347
|
-
args: unknown;
|
|
348
|
-
options: Record<string, unknown>;
|
|
349
|
-
}
|
|
350
|
-
interface Request extends express.Request {
|
|
351
|
-
query: Record<'skip' | 'limit' | 'page' | 'page_size' | 'try_list' | 'skim' | 'include_permissions' | 'include_count' | 'include_extra_headers' | 'returning_all', string>;
|
|
352
|
-
macl: Core;
|
|
353
|
-
dacl: DataCore;
|
|
354
|
-
}
|
|
355
|
-
interface ErrorResult<TError = unknown, TQuery = unknown> {
|
|
356
|
-
success: false;
|
|
357
|
-
code: Codes.BadRequest | Codes.Unauthorized | Codes.Forbidden | Codes.NotFound;
|
|
358
|
-
errors?: TError[];
|
|
359
|
-
query?: TQuery;
|
|
360
|
-
}
|
|
361
|
-
interface SingleResult<T = unknown, TInput = unknown, TQuery = unknown> {
|
|
362
|
-
success: true;
|
|
363
|
-
kind: 'single';
|
|
364
|
-
code: Codes.Success | Codes.Created;
|
|
365
|
-
data: T;
|
|
366
|
-
input?: TInput;
|
|
367
|
-
query?: TQuery;
|
|
368
|
-
context?: MiddlewareContext;
|
|
369
|
-
}
|
|
370
|
-
interface ListResult<T = unknown, TInput = unknown, TQuery = unknown> {
|
|
371
|
-
success: true;
|
|
372
|
-
kind: 'list';
|
|
373
|
-
code: Codes.Success | Codes.Created;
|
|
374
|
-
data: T[];
|
|
375
|
-
count: number;
|
|
376
|
-
totalCount?: number | null;
|
|
377
|
-
input?: TInput;
|
|
378
|
-
query?: TQuery;
|
|
379
|
-
contexts?: MiddlewareContext[];
|
|
380
|
-
}
|
|
381
|
-
type ServiceResult<T = unknown, TError = unknown, TInput = unknown, TQuery = unknown> = SingleResult<T, TInput, TQuery> | ListResult<T, TInput, TQuery> | ErrorResult<TError, TQuery>;
|
|
382
|
-
|
|
383
|
-
interface PublicCreateArgs {
|
|
384
|
-
select?: Projection;
|
|
385
|
-
populate?: Populate[] | string;
|
|
386
|
-
tasks?: Task | Task[];
|
|
387
|
-
}
|
|
388
|
-
interface CreateArgs extends Omit<PublicCreateArgs, 'select' | 'tasks'> {
|
|
389
|
-
}
|
|
390
|
-
interface PublicCreateOptions {
|
|
391
|
-
skim?: boolean;
|
|
392
|
-
includePermissions?: boolean;
|
|
393
|
-
populateAccess?: PopulateAccess;
|
|
394
|
-
}
|
|
395
|
-
interface CreateOptions extends PublicCreateOptions {
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
interface PublicUpdateArgs {
|
|
399
|
-
select?: Projection;
|
|
400
|
-
populate?: Populate[] | string;
|
|
401
|
-
tasks?: Task | Task[];
|
|
402
|
-
}
|
|
403
|
-
interface UpdateOneArgs extends Omit<PublicUpdateArgs, 'select' | 'tasks'> {
|
|
404
|
-
overrides?: {
|
|
405
|
-
filter?: Filter;
|
|
406
|
-
populate?: Populate[] | string;
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
interface UpdateByIdArgs extends Omit<UpdateOneArgs, 'overrides'> {
|
|
410
|
-
overrides?: {
|
|
411
|
-
populate?: Populate[] | string;
|
|
412
|
-
idFilter?: Filter;
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
interface UpsertArgs extends UpdateOneArgs {
|
|
416
|
-
}
|
|
417
|
-
interface PublicUpdateOptions {
|
|
418
|
-
skim?: boolean;
|
|
419
|
-
returningAll?: boolean;
|
|
420
|
-
includePermissions?: boolean;
|
|
421
|
-
populateAccess?: PopulateAccess;
|
|
422
|
-
}
|
|
423
|
-
interface UpdateOneOptions extends Omit<PublicUpdateOptions, 'returningAll'> {
|
|
424
|
-
}
|
|
425
|
-
interface UpdateByIdOptions extends UpdateOneOptions {
|
|
426
|
-
}
|
|
427
|
-
interface UpsertOptions extends UpdateOneOptions {
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
interface PublicListArgs {
|
|
431
|
-
select?: Projection;
|
|
432
|
-
populate?: Populate[] | string;
|
|
433
|
-
include?: Include | Include[];
|
|
434
|
-
sort?: Sort;
|
|
435
|
-
skip?: string | number;
|
|
436
|
-
limit?: string | number;
|
|
437
|
-
page?: string | number;
|
|
438
|
-
pageSize?: string | number;
|
|
439
|
-
tasks?: Task | Task[];
|
|
440
|
-
}
|
|
441
|
-
interface PublicListOptions {
|
|
442
|
-
skim?: boolean;
|
|
443
|
-
includePermissions?: boolean;
|
|
444
|
-
includeCount?: boolean;
|
|
445
|
-
populateAccess?: PopulateAccess;
|
|
446
|
-
lean?: boolean;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
interface PublicReadArgs {
|
|
450
|
-
select?: Projection;
|
|
451
|
-
populate?: Populate[] | string;
|
|
452
|
-
include?: Include | Include[];
|
|
453
|
-
tasks?: Task | Task[];
|
|
454
|
-
}
|
|
455
|
-
interface PublicReadOptions {
|
|
456
|
-
skim?: boolean;
|
|
457
|
-
populateAccess?: PopulateAccess;
|
|
458
|
-
lean?: boolean;
|
|
459
|
-
includePermissions?: boolean;
|
|
460
|
-
tryList?: boolean;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
interface FindArgs {
|
|
464
|
-
select?: Projection;
|
|
465
|
-
populate?: Populate[] | string;
|
|
466
|
-
include?: Include | Include[];
|
|
467
|
-
sort?: Sort;
|
|
468
|
-
skip?: string | number;
|
|
469
|
-
limit?: string | number;
|
|
470
|
-
page?: string | number;
|
|
471
|
-
pageSize?: string | number;
|
|
472
|
-
overrides?: {
|
|
473
|
-
filter?: Filter;
|
|
474
|
-
select?: Projection;
|
|
475
|
-
populate?: Populate[] | string;
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
interface FindOptions {
|
|
479
|
-
skim?: boolean;
|
|
480
|
-
includePermissions?: boolean;
|
|
481
|
-
includeCount?: boolean;
|
|
482
|
-
populateAccess?: PopulateAccess;
|
|
483
|
-
lean?: boolean;
|
|
484
|
-
}
|
|
485
|
-
interface FindOneArgs {
|
|
486
|
-
select?: Projection;
|
|
487
|
-
sort?: Sort;
|
|
488
|
-
populate?: Populate[] | string;
|
|
489
|
-
include?: Include | Include[];
|
|
490
|
-
overrides?: {
|
|
491
|
-
filter?: Filter;
|
|
492
|
-
select?: Projection;
|
|
493
|
-
populate?: Populate[] | string;
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
interface FindOneOptions {
|
|
497
|
-
access?: FindAccess;
|
|
498
|
-
populateAccess?: PopulateAccess;
|
|
499
|
-
skim?: boolean;
|
|
500
|
-
lean?: boolean;
|
|
501
|
-
includePermissions?: boolean;
|
|
502
|
-
}
|
|
503
|
-
interface FindByIdArgs {
|
|
504
|
-
select?: Projection;
|
|
505
|
-
populate?: Populate[] | string;
|
|
506
|
-
include?: Include | Include[];
|
|
507
|
-
overrides?: {
|
|
508
|
-
select?: Projection;
|
|
509
|
-
populate?: Populate[] | string;
|
|
510
|
-
idFilter?: Filter;
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
|
-
interface FindByIdOptions extends FindOneOptions {
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
interface ExistsOptions {
|
|
517
|
-
access?: BaseFilterAccess;
|
|
518
|
-
includeId?: boolean;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
interface DefaultFindOneArgs extends Omit<FindOneArgs, 'overrides'> {
|
|
522
|
-
}
|
|
523
|
-
interface DefaultFindByIdArgs extends Omit<FindByIdArgs, 'overrides'> {
|
|
524
|
-
}
|
|
525
|
-
interface DefaultFindArgs extends Omit<FindArgs, 'overrides'> {
|
|
526
|
-
}
|
|
527
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
528
|
-
type RequestZodSchema = z.ZodTypeAny;
|
|
529
|
-
type GlobalPermissionValue = Record<string, boolean> | string[] | string | null | undefined;
|
|
530
|
-
type BaseFilterHook = (this: express.Request, permissions: Permissions) => MaybePromise<Filter | true | null | undefined>;
|
|
531
|
-
type OverrideFilterHook = (this: express.Request, filter: Filter, permissions: Permissions) => MaybePromise<Filter>;
|
|
532
|
-
type MiddlewareHook<TValue, TContext> = (this: express.Request, value: TValue, permissions: Permissions, context: TContext) => MaybePromise<TValue>;
|
|
533
|
-
type MiddlewareChain<TValue, TContext> = MiddlewareHook<TValue, TContext> | Array<MiddlewareHook<TValue, TContext>>;
|
|
534
|
-
type ValidateRule = boolean | unknown[];
|
|
535
|
-
type ValidateHook = (this: express.Request, allowedData: unknown, permissions: Permissions, context: MiddlewareContext) => MaybePromise<ValidateRule>;
|
|
536
|
-
type DocPermissionsHook = (this: express.Request, doc: unknown, permissions: Permissions, context: MiddlewareContext) => MaybePromise<Record<string, unknown>>;
|
|
537
|
-
type ChangeHook = (this: express.Request, previousValue: unknown, nextValue: unknown, changes: Diff<unknown>[], context: MiddlewareContext) => MaybePromise<void>;
|
|
538
|
-
type ModelMiddleware = MiddlewareChain<unknown, MiddlewareContext>;
|
|
539
|
-
type ModelListMiddleware = MiddlewareChain<unknown[], MiddlewareContext>;
|
|
540
|
-
type DataMiddleware = MiddlewareChain<unknown, DataMiddlewareContext>;
|
|
541
|
-
type DataListMiddleware = MiddlewareChain<unknown[], DataMiddlewareContext>;
|
|
542
|
-
type SubRouteGuardOptions = Record<string, Validation | Record<string, Validation>>;
|
|
543
|
-
interface RequestSchemas {
|
|
544
|
-
create?: RequestZodSchema;
|
|
545
|
-
update?: RequestZodSchema;
|
|
546
|
-
upsert?: RequestZodSchema;
|
|
547
|
-
count?: RequestZodSchema;
|
|
548
|
-
distinct?: RequestZodSchema;
|
|
549
|
-
advancedList?: RequestZodSchema;
|
|
550
|
-
advancedReadFilter?: RequestZodSchema;
|
|
551
|
-
advancedRead?: RequestZodSchema;
|
|
552
|
-
advancedCreate?: RequestZodSchema;
|
|
553
|
-
advancedCreateData?: RequestZodSchema;
|
|
554
|
-
advancedUpdate?: RequestZodSchema;
|
|
555
|
-
advancedUpdateData?: RequestZodSchema;
|
|
556
|
-
advancedUpsert?: RequestZodSchema;
|
|
557
|
-
advancedUpsertData?: RequestZodSchema;
|
|
558
|
-
subList?: RequestZodSchema;
|
|
559
|
-
subRead?: RequestZodSchema;
|
|
560
|
-
subCreate?: RequestZodSchema;
|
|
561
|
-
subUpdate?: RequestZodSchema;
|
|
562
|
-
subBulkUpdate?: RequestZodSchema;
|
|
563
|
-
}
|
|
564
|
-
interface DataRequestSchemas {
|
|
565
|
-
advancedList?: RequestZodSchema;
|
|
566
|
-
advancedReadFilter?: RequestZodSchema;
|
|
567
|
-
advancedRead?: RequestZodSchema;
|
|
568
|
-
}
|
|
569
|
-
interface Defaults {
|
|
570
|
-
findOneArgs?: DefaultFindOneArgs;
|
|
571
|
-
findOneOptions?: FindOneOptions;
|
|
572
|
-
findByIdArgs?: DefaultFindByIdArgs;
|
|
573
|
-
findByIdOptions?: FindByIdOptions;
|
|
574
|
-
findArgs?: DefaultFindArgs;
|
|
575
|
-
findOptions?: FindOptions;
|
|
576
|
-
createArgs?: CreateArgs;
|
|
577
|
-
createOptions?: CreateOptions;
|
|
578
|
-
updateOneArgs?: UpdateOneArgs;
|
|
579
|
-
updateOneOptions?: UpdateOneOptions;
|
|
580
|
-
upsertOptions?: UpsertOptions;
|
|
581
|
-
updateByIdArgs?: UpdateByIdArgs;
|
|
582
|
-
upsertArgs?: UpsertArgs;
|
|
583
|
-
updateByIdOptions?: UpdateByIdOptions;
|
|
584
|
-
existsOptions?: ExistsOptions;
|
|
585
|
-
publicListArgs?: PublicListArgs;
|
|
586
|
-
publicListOptions?: PublicListOptions;
|
|
587
|
-
publicCreateArgs?: PublicCreateArgs;
|
|
588
|
-
publicCreateOptions?: PublicCreateOptions;
|
|
589
|
-
publicReadArgs?: PublicReadArgs;
|
|
590
|
-
publicReadOptions?: PublicReadOptions;
|
|
591
|
-
publicUpdateArgs?: PublicUpdateArgs;
|
|
592
|
-
publicUpdateOptions?: PublicUpdateOptions;
|
|
593
|
-
}
|
|
594
|
-
interface AccessRouterLogger {
|
|
595
|
-
debug?: (...args: unknown[]) => unknown;
|
|
596
|
-
info?: (...args: unknown[]) => unknown;
|
|
597
|
-
warn?: (...args: unknown[]) => unknown;
|
|
598
|
-
error?: (...args: unknown[]) => unknown;
|
|
599
|
-
}
|
|
600
|
-
interface GlobalOptions {
|
|
601
|
-
requestPermissionField?: string;
|
|
602
|
-
globalPermissions?: (this: express.Request, req: express.Request) => MaybePromise<GlobalPermissionValue>;
|
|
603
|
-
logger?: AccessRouterLogger;
|
|
604
|
-
}
|
|
605
|
-
interface RootRouterOptions {
|
|
606
|
-
basePath: string;
|
|
607
|
-
routeGuard?: Validation;
|
|
608
|
-
}
|
|
609
|
-
interface Access {
|
|
610
|
-
list?: Validation;
|
|
611
|
-
create?: Validation;
|
|
612
|
-
read?: Validation;
|
|
613
|
-
update?: Validation;
|
|
614
|
-
delete?: Validation;
|
|
615
|
-
distinct?: Validation;
|
|
616
|
-
count?: Validation;
|
|
617
|
-
sub?: Validation | SubRouteGuardOptions;
|
|
618
|
-
}
|
|
619
|
-
interface PermissionSchema {
|
|
620
|
-
[key: string]: Access;
|
|
621
|
-
}
|
|
622
|
-
interface DocPermissions {
|
|
623
|
-
list?: Function;
|
|
624
|
-
create?: Function;
|
|
625
|
-
read?: Function;
|
|
626
|
-
update?: Function;
|
|
627
|
-
}
|
|
628
|
-
interface DefaultModelRouterOptions {
|
|
629
|
-
listHardLimit?: number;
|
|
630
|
-
documentPermissionField?: string;
|
|
631
|
-
idParam?: string;
|
|
632
|
-
identifier?: string | Function;
|
|
633
|
-
parentPath?: string;
|
|
634
|
-
queryPath?: string;
|
|
635
|
-
mutationPath?: string;
|
|
636
|
-
routeGuard?: Validation | Access;
|
|
637
|
-
modelPermissionPrefix?: string;
|
|
638
|
-
}
|
|
639
|
-
interface ExtendedDefaultModelRouterOptions extends DefaultModelRouterOptions {
|
|
640
|
-
'routeGuard.default'?: Validation;
|
|
641
|
-
'routeGuard.new'?: Validation;
|
|
642
|
-
'routeGuard.list'?: Validation;
|
|
643
|
-
'routeGuard.read'?: Validation;
|
|
644
|
-
'routeGuard.update'?: Validation;
|
|
645
|
-
'routeGuard.delete'?: Validation;
|
|
646
|
-
'routeGuard.create'?: Validation;
|
|
647
|
-
'routeGuard.distinct'?: Validation;
|
|
648
|
-
'routeGuard.count'?: Validation;
|
|
649
|
-
'routeGuard.subs'?: SubRouteGuardOptions;
|
|
650
|
-
}
|
|
651
|
-
interface ModelRouterOptions extends DefaultModelRouterOptions {
|
|
652
|
-
modelName?: string;
|
|
653
|
-
basePath?: string;
|
|
654
|
-
permissionSchema?: PermissionSchema;
|
|
655
|
-
_permissionSchemaKeys?: string[];
|
|
656
|
-
_globalPermissionKeys?: Record<string, string[]>;
|
|
657
|
-
_modelPermissionKeys?: Record<string, string[]>;
|
|
658
|
-
mandatoryFields?: string[];
|
|
659
|
-
docPermissions?: DocPermissions | DocPermissionsHook;
|
|
660
|
-
baseFilter?: BaseFilterHook | Record<string, BaseFilterHook>;
|
|
661
|
-
overrideFilter?: OverrideFilterHook | Record<string, OverrideFilterHook>;
|
|
662
|
-
decorate?: ModelMiddleware | Record<string, ModelMiddleware>;
|
|
663
|
-
decorateAll?: ModelListMiddleware | Record<string, ModelListMiddleware>;
|
|
664
|
-
validate?: ValidateRule | ValidateHook | Record<string, ValidateRule | ValidateHook>;
|
|
665
|
-
prepare?: ModelMiddleware | Record<string, ModelMiddleware>;
|
|
666
|
-
transform?: ModelMiddleware | Record<string, ModelMiddleware>;
|
|
667
|
-
finalize?: ModelMiddleware | Record<string, ModelMiddleware>;
|
|
668
|
-
change?: Record<string, ChangeHook>;
|
|
669
|
-
requestSchemas?: RequestSchemas;
|
|
670
|
-
defaults?: Defaults;
|
|
671
|
-
}
|
|
672
|
-
interface DataRouterOptions {
|
|
673
|
-
data?: unknown[];
|
|
674
|
-
listHardLimit?: number;
|
|
675
|
-
idParam?: string;
|
|
676
|
-
identifier?: string | Function;
|
|
677
|
-
parentPath?: string;
|
|
678
|
-
queryPath?: string;
|
|
679
|
-
routeGuard?: Validation | Access;
|
|
680
|
-
dataName?: string;
|
|
681
|
-
basePath?: string;
|
|
682
|
-
permissionSchema?: PermissionSchema;
|
|
683
|
-
baseFilter?: BaseFilterHook | Record<string, BaseFilterHook>;
|
|
684
|
-
overrideFilter?: OverrideFilterHook | Record<string, OverrideFilterHook>;
|
|
685
|
-
decorate?: DataMiddleware | Record<string, DataMiddleware>;
|
|
686
|
-
decorateAll?: DataListMiddleware | Record<string, DataListMiddleware>;
|
|
687
|
-
requestSchemas?: DataRequestSchemas;
|
|
688
|
-
}
|
|
689
|
-
interface ExtendedModelRouterOptions extends ModelRouterOptions, ExtendedDefaultModelRouterOptions {
|
|
690
|
-
'mandatoryFields.default'?: string[];
|
|
691
|
-
'mandatoryFields.list'?: string[];
|
|
692
|
-
'mandatoryFields.create'?: string[];
|
|
693
|
-
'mandatoryFields.read'?: string[];
|
|
694
|
-
'mandatoryFields.update'?: string[];
|
|
695
|
-
'docPermissions.default'?: DocPermissionsHook;
|
|
696
|
-
'docPermissions.list'?: DocPermissionsHook;
|
|
697
|
-
'docPermissions.create'?: DocPermissionsHook;
|
|
698
|
-
'docPermissions.read'?: DocPermissionsHook;
|
|
699
|
-
'docPermissions.update'?: DocPermissionsHook;
|
|
700
|
-
'baseFilter.default'?: BaseFilterHook;
|
|
701
|
-
'baseFilter.list'?: BaseFilterHook;
|
|
702
|
-
'baseFilter.read'?: BaseFilterHook;
|
|
703
|
-
'baseFilter.update'?: BaseFilterHook;
|
|
704
|
-
'baseFilter.delete'?: BaseFilterHook;
|
|
705
|
-
'overrideFilter.default'?: OverrideFilterHook;
|
|
706
|
-
'overrideFilter.list'?: OverrideFilterHook;
|
|
707
|
-
'overrideFilter.read'?: OverrideFilterHook;
|
|
708
|
-
'overrideFilter.update'?: OverrideFilterHook;
|
|
709
|
-
'overrideFilter.delete'?: OverrideFilterHook;
|
|
710
|
-
'decorate.default'?: ModelMiddleware;
|
|
711
|
-
'decorate.list'?: ModelMiddleware;
|
|
712
|
-
'decorate.create'?: ModelMiddleware;
|
|
713
|
-
'decorate.read'?: ModelMiddleware;
|
|
714
|
-
'decorate.update'?: ModelMiddleware;
|
|
715
|
-
'decorateAll.default'?: ModelListMiddleware;
|
|
716
|
-
'decorateAll.list'?: ModelListMiddleware;
|
|
717
|
-
'validate.default'?: ValidateRule | ValidateHook;
|
|
718
|
-
'validate.create'?: ValidateRule | ValidateHook;
|
|
719
|
-
'validate.update'?: ValidateRule | ValidateHook;
|
|
720
|
-
'prepare.default'?: ModelMiddleware;
|
|
721
|
-
'prepare.create'?: ModelMiddleware;
|
|
722
|
-
'prepare.update'?: ModelMiddleware;
|
|
723
|
-
'transform.default'?: ModelMiddleware;
|
|
724
|
-
'transform.update'?: ModelMiddleware;
|
|
725
|
-
'finalize.default'?: ModelMiddleware;
|
|
726
|
-
'finalize.create'?: ModelMiddleware;
|
|
727
|
-
'finalize.update'?: ModelMiddleware;
|
|
728
|
-
'requestSchemas.create'?: RequestZodSchema;
|
|
729
|
-
'requestSchemas.update'?: RequestZodSchema;
|
|
730
|
-
'requestSchemas.upsert'?: RequestZodSchema;
|
|
731
|
-
'requestSchemas.count'?: RequestZodSchema;
|
|
732
|
-
'requestSchemas.distinct'?: RequestZodSchema;
|
|
733
|
-
'requestSchemas.advancedList'?: RequestZodSchema;
|
|
734
|
-
'requestSchemas.advancedReadFilter'?: RequestZodSchema;
|
|
735
|
-
'requestSchemas.advancedRead'?: RequestZodSchema;
|
|
736
|
-
'requestSchemas.advancedCreate.default'?: RequestZodSchema;
|
|
737
|
-
'requestSchemas.advancedCreate.data'?: RequestZodSchema;
|
|
738
|
-
'requestSchemas.advancedUpdate'?: RequestZodSchema;
|
|
739
|
-
'requestSchemas.advancedUpdate.default'?: RequestZodSchema;
|
|
740
|
-
'requestSchemas.advancedUpdate.data'?: RequestZodSchema;
|
|
741
|
-
'requestSchemas.advancedUpsert.default'?: RequestZodSchema;
|
|
742
|
-
'requestSchemas.advancedUpsert.data'?: RequestZodSchema;
|
|
743
|
-
'requestSchemas.subList'?: RequestZodSchema;
|
|
744
|
-
'requestSchemas.subRead'?: RequestZodSchema;
|
|
745
|
-
'requestSchemas.subCreate'?: RequestZodSchema;
|
|
746
|
-
'requestSchemas.subUpdate'?: RequestZodSchema;
|
|
747
|
-
'requestSchemas.subBulkUpdate'?: RequestZodSchema;
|
|
748
|
-
'defaults.findOneArgs'?: DefaultFindOneArgs;
|
|
749
|
-
'defaults.findOneOptions'?: FindOneOptions;
|
|
750
|
-
'defaults.findByIdArgs'?: DefaultFindByIdArgs;
|
|
751
|
-
'defaults.findByIdOptions'?: FindByIdOptions;
|
|
752
|
-
'defaults.findArgs'?: DefaultFindArgs;
|
|
753
|
-
'defaults.findOptions'?: FindOptions;
|
|
754
|
-
'defaults.createArgs'?: CreateArgs;
|
|
755
|
-
'defaults.createOptions'?: CreateOptions;
|
|
756
|
-
'defaults.updateOneArgs'?: UpdateOneArgs;
|
|
757
|
-
'defaults.updateOneOptions'?: UpdateOneOptions;
|
|
758
|
-
'defaults.updateByIdArgs'?: UpdateByIdArgs;
|
|
759
|
-
'defaults.updateByIdOptions'?: UpdateByIdOptions;
|
|
760
|
-
'defaults.existsOptions'?: ExistsOptions;
|
|
761
|
-
'defaults.publicListArgs'?: PublicListArgs;
|
|
762
|
-
'defaults.publicListOptions'?: PublicListOptions;
|
|
763
|
-
'defaults.publicCreateArgs'?: PublicCreateArgs;
|
|
764
|
-
'defaults.publicCreateOptions'?: PublicCreateOptions;
|
|
765
|
-
'defaults.publicReadArgs'?: PublicReadArgs;
|
|
766
|
-
'defaults.publicReadOptions'?: PublicReadOptions;
|
|
767
|
-
'defaults.publicUpdateArgs'?: PublicUpdateArgs;
|
|
768
|
-
'defaults.publicUpdateOptions'?: PublicUpdateOptions;
|
|
769
|
-
}
|
|
770
|
-
interface ExtendedDataRouterOptions extends DataRouterOptions {
|
|
771
|
-
'requestSchemas.advancedList'?: RequestZodSchema;
|
|
772
|
-
'requestSchemas.advancedReadFilter'?: RequestZodSchema;
|
|
773
|
-
'requestSchemas.advancedRead'?: RequestZodSchema;
|
|
774
|
-
}
|
|
775
|
-
type SelectAccess = 'list' | 'create' | 'read' | 'update' | string;
|
|
776
|
-
type RouteGuardAccess = 'new' | 'list' | 'read' | 'update' | 'delete' | 'create' | 'distinct' | 'count' | 'subs' | string;
|
|
777
|
-
type DocPermissionsAccess = 'list' | 'create' | 'read' | 'update' | string;
|
|
778
|
-
type BaseFilterAccess = 'list' | 'read' | 'update' | 'delete' | string;
|
|
779
|
-
type DecorateAccess = 'list' | 'create' | 'read' | 'update' | string;
|
|
780
|
-
type DecorateAllAccess = 'list' | string;
|
|
781
|
-
type ValidateAccess = 'create' | 'update' | string;
|
|
782
|
-
type PrepareAccess = 'create' | 'update' | string;
|
|
783
|
-
type TransformAccess = 'update' | string;
|
|
784
|
-
type FinalizeAccess = 'create' | 'update' | string;
|
|
785
|
-
|
|
786
|
-
interface DistinctArgs {
|
|
787
|
-
filter?: Filter;
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
type DataFilter = Filter;
|
|
791
|
-
interface DataFindOneArgs {
|
|
792
|
-
select?: Projection;
|
|
793
|
-
}
|
|
794
|
-
interface DataFindOneOptions {
|
|
795
|
-
access?: FindAccess;
|
|
796
|
-
}
|
|
797
|
-
interface DataFindArgs {
|
|
798
|
-
select?: Projection;
|
|
799
|
-
sort?: string;
|
|
800
|
-
skip?: string | number;
|
|
801
|
-
limit?: string | number;
|
|
802
|
-
page?: string | number;
|
|
803
|
-
pageSize?: string | number;
|
|
804
|
-
}
|
|
805
|
-
interface DataFindOptions {
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
declare function macl(): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
6
|
+
import 'zod';
|
|
7
|
+
import 'deep-diff';
|
|
8
|
+
|
|
9
|
+
declare class AccessRuntime {
|
|
10
|
+
private readonly globalOptions;
|
|
11
|
+
private readonly defaultModelOptions;
|
|
12
|
+
private readonly modelOptions;
|
|
13
|
+
private readonly modelJsonSchemas;
|
|
14
|
+
private readonly dataOptions;
|
|
15
|
+
private readonly modelRefs;
|
|
16
|
+
private readonly modelSubs;
|
|
17
|
+
private readonly modelAtts;
|
|
18
|
+
setGlobalOptions(options: GlobalOptions): void;
|
|
19
|
+
setGlobalOption<K extends keyof GlobalOptions>(key: K, value: GlobalOptions[K]): void;
|
|
20
|
+
getGlobalOptions(): GlobalOptions;
|
|
21
|
+
getGlobalOption<K extends keyof GlobalOptions>(key: K, defaultValue?: GlobalOptions[K]): GlobalOptions[K];
|
|
22
|
+
setDefaultModelOptions(options: DefaultModelRouterOptions): void;
|
|
23
|
+
setDefaultModelOption<K extends keyof ExtendedDefaultModelRouterOptions>(key: K, value: ExtendedDefaultModelRouterOptions[K]): void;
|
|
24
|
+
getDefaultModelOptions(): DefaultModelRouterOptions<unknown>;
|
|
25
|
+
getDefaultModelOption<K extends keyof ExtendedDefaultModelRouterOptions>(key: K, defaultValue?: ExtendedDefaultModelRouterOptions[K]): ExtendedDefaultModelRouterOptions<unknown>[K];
|
|
26
|
+
private createModelOptions;
|
|
27
|
+
private getOrCreateModelOptions;
|
|
28
|
+
setModelOptions<TModel = unknown>(modelName: string, options: ModelRouterOptions<TModel>): void;
|
|
29
|
+
setModelOption<K extends keyof ExtendedModelRouterOptions<TModel>, TModel = unknown>(modelName: string, key: K, value: ExtendedModelRouterOptions<TModel>[K]): void;
|
|
30
|
+
getModelOptions<TModel = unknown>(modelName: string): ModelRouterOptions<TModel>;
|
|
31
|
+
getModelOption<K extends keyof ExtendedModelRouterOptions<TModel>, TModel = unknown>(modelName: string, key: K | string, defaultValue?: ExtendedModelRouterOptions<TModel>[K]): ExtendedModelRouterOptions<TModel>[K];
|
|
32
|
+
getExactModelOption<K extends keyof ExtendedModelRouterOptions<TModel>, TModel = unknown>(modelName: string, key: K | string): ExtendedModelRouterOptions<TModel>[K];
|
|
33
|
+
getModelNames(): string[];
|
|
34
|
+
hasModel(modelName: string): boolean;
|
|
35
|
+
getModelJsonSchema(modelName: string): Record<string, unknown>;
|
|
36
|
+
private createDataOptions;
|
|
37
|
+
private getOrCreateDataOptions;
|
|
38
|
+
setDataOptions<TData = unknown>(dataName: string, options: DataRouterOptions<TData>): void;
|
|
39
|
+
setDataOption<K extends keyof DataRouterOptions<TData>, TData = unknown>(dataName: string, key: K, value: DataRouterOptions<TData>[K]): void;
|
|
40
|
+
getDataOptions<TData = unknown>(dataName: string): DataRouterOptions<TData>;
|
|
41
|
+
getDataOption<K extends keyof DataRouterOptions<TData>, TData = unknown>(dataName: string, key: K | string, defaultValue?: DataRouterOptions<TData>[K]): DataRouterOptions<TData>[K];
|
|
42
|
+
getExactDataOption<K extends keyof ExtendedDataRouterOptions<TData>, TData = unknown>(dataName: string, key: K | string): ExtendedDataRouterOptions<TData>[K];
|
|
43
|
+
getDataNames(): string[];
|
|
44
|
+
ensureModelMeta(modelName: string): void;
|
|
45
|
+
getModelRef(modelName: string, refPath: string): any;
|
|
46
|
+
getModelSub(modelName: string): string[];
|
|
47
|
+
getModelAtt(modelName: string): any[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
declare function macl(): (req: AccessRouterBaseRequest, res: Response, next: NextFunction) => Promise<void>;
|
|
809
51
|
interface GuardModelConditionID {
|
|
810
52
|
type: string;
|
|
811
53
|
key: string;
|
|
@@ -817,132 +59,201 @@ interface GuardModelCondition {
|
|
|
817
59
|
}
|
|
818
60
|
declare function guard(condition: string): any;
|
|
819
61
|
declare function guard(conditions: string[]): any;
|
|
820
|
-
declare function guard(conditionFunc:
|
|
62
|
+
declare function guard(conditionFunc: GuardHook<ModelRequest>): any;
|
|
821
63
|
declare function guard(modelCondition: GuardModelCondition): any;
|
|
822
64
|
|
|
823
|
-
type SetTargetOption$1 = {
|
|
824
|
-
(option:
|
|
825
|
-
(key: string, option: unknown):
|
|
65
|
+
type SetTargetOption$1<TRouter, TOption> = {
|
|
66
|
+
(option: TOption): TRouter;
|
|
67
|
+
(key: string, option: unknown): TRouter;
|
|
826
68
|
};
|
|
827
|
-
declare class
|
|
69
|
+
declare class DataRouter<TData = unknown> {
|
|
70
|
+
readonly runtime: AccessRuntime;
|
|
71
|
+
readonly dataName: string;
|
|
72
|
+
readonly router: JsonRouter;
|
|
73
|
+
readonly options: DataRouterOptions<TData>;
|
|
74
|
+
readonly fullBasePath: string;
|
|
75
|
+
constructor(dataName: string, initialOptions: DataRouterOptions<TData>, runtime?: AccessRuntime);
|
|
76
|
+
private getRequestSchema;
|
|
77
|
+
getService(req: DataRequest): DataService<TData>;
|
|
78
|
+
private assertAllowed;
|
|
79
|
+
private setCollectionRoutes;
|
|
80
|
+
private setDocumentRoutes;
|
|
81
|
+
set<K extends keyof DataRouterOptions<TData>>(key: K, value: DataRouterOptions<TData>[K]): this;
|
|
82
|
+
set(options: DataRouterOptions<TData>): this;
|
|
83
|
+
setOption<K extends keyof DataRouterOptions<TData>>(key: K, option: DataRouterOptions<TData>[K]): this;
|
|
84
|
+
setOptions(options: DataRouterOptions<TData>): this;
|
|
85
|
+
data: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['data']>;
|
|
86
|
+
listHardLimit: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['listHardLimit']>;
|
|
87
|
+
permissionSchema: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['permissionSchema']>;
|
|
88
|
+
operationAccess: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['operationAccess']>;
|
|
89
|
+
baseFilter: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['baseFilter']>;
|
|
90
|
+
overrideFilter: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['overrideFilter']>;
|
|
91
|
+
decorate: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['decorate']>;
|
|
92
|
+
decorateAll: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['decorateAll']>;
|
|
93
|
+
idField: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['idField']>;
|
|
94
|
+
resolveIdFilter: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['resolveIdFilter']>;
|
|
95
|
+
queryRouteSegment: SetTargetOption$1<DataRouter<TData>, DataRouterOptions<TData>['queryRouteSegment']>;
|
|
96
|
+
get routes(): Router;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
type SetTargetOption<TRouter, TOption> = {
|
|
100
|
+
(option: TOption): TRouter;
|
|
101
|
+
(key: string, option: unknown): TRouter;
|
|
102
|
+
};
|
|
103
|
+
declare class ModelRouter<TModel = unknown> {
|
|
104
|
+
readonly runtime: AccessRuntime;
|
|
828
105
|
readonly modelName: string;
|
|
829
106
|
readonly router: JsonRouter;
|
|
830
107
|
readonly model: Model;
|
|
831
|
-
readonly options: ModelRouterOptions
|
|
108
|
+
readonly options: ModelRouterOptions<TModel>;
|
|
832
109
|
readonly fullBasePath: string;
|
|
833
|
-
constructor(modelName: string, initialOptions: ModelRouterOptions);
|
|
110
|
+
constructor(modelName: string, initialOptions: ModelRouterOptions<TModel>, runtime?: AccessRuntime);
|
|
834
111
|
private getRequestSchema;
|
|
112
|
+
getService(req: ModelRequest): Service<TModel>;
|
|
113
|
+
getPublicService(req: ModelRequest): PublicService<TModel>;
|
|
835
114
|
private assertAllowed;
|
|
836
115
|
private setCollectionRoutes;
|
|
837
116
|
private setDocumentRoutes;
|
|
838
117
|
private setSubDocumentRoutes;
|
|
839
118
|
private logEndpoints;
|
|
840
|
-
set<K extends keyof ExtendedModelRouterOptions
|
|
841
|
-
|
|
842
|
-
|
|
119
|
+
set<K extends keyof ExtendedModelRouterOptions<TModel>>(key: K, value: ExtendedModelRouterOptions<TModel>[K]): this;
|
|
120
|
+
set(options: ModelRouterOptions<TModel>): this;
|
|
121
|
+
setOption<K extends keyof ExtendedModelRouterOptions<TModel>>(key: K, option: ExtendedModelRouterOptions<TModel>[K]): this;
|
|
122
|
+
setOptions(options: ModelRouterOptions<TModel>): this;
|
|
843
123
|
/**
|
|
844
124
|
* The maximum limit of the number of documents returned from the `list` operation.
|
|
845
125
|
*/
|
|
846
|
-
listHardLimit: SetTargetOption
|
|
126
|
+
listHardLimit: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['listHardLimit']>;
|
|
847
127
|
/**
|
|
848
128
|
* The object schema to define the access control policy for each model field.
|
|
849
129
|
*/
|
|
850
|
-
permissionSchema: SetTargetOption
|
|
130
|
+
permissionSchema: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['permissionSchema']>;
|
|
851
131
|
/**
|
|
852
132
|
* The object field to store the document permissions.
|
|
853
133
|
*/
|
|
854
|
-
documentPermissionField: SetTargetOption
|
|
134
|
+
documentPermissionField: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['documentPermissionField']>;
|
|
855
135
|
/**
|
|
856
|
-
* The
|
|
136
|
+
* The model fields always selected for ACL and response shaping.
|
|
857
137
|
*/
|
|
858
|
-
|
|
138
|
+
alwaysSelectFields: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['alwaysSelectFields']>;
|
|
859
139
|
/**
|
|
860
140
|
* The function called in the process of generating document permissions.
|
|
861
141
|
*/
|
|
862
|
-
docPermissions: SetTargetOption
|
|
142
|
+
docPermissions: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['docPermissions']>;
|
|
863
143
|
/**
|
|
864
|
-
* The access control policy for
|
|
144
|
+
* The access control policy for router operations.
|
|
865
145
|
* @operation `create`, `list`, `read`, `update`, `delete`
|
|
866
146
|
*/
|
|
867
|
-
|
|
147
|
+
operationAccess: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['operationAccess']>;
|
|
868
148
|
/**
|
|
869
149
|
* The base filter definitions applied in every query transaction.
|
|
870
150
|
* @operation `list`, `read`, `update`, `delete`
|
|
871
151
|
*/
|
|
872
|
-
baseFilter: SetTargetOption
|
|
152
|
+
baseFilter: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['baseFilter']>;
|
|
873
153
|
/**
|
|
874
154
|
* The override filter definitions applied in every query transaction.
|
|
875
155
|
* @operation `list`, `read`, `update`, `delete`
|
|
876
156
|
*/
|
|
877
|
-
overrideFilter: SetTargetOption
|
|
157
|
+
overrideFilter: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['overrideFilter']>;
|
|
878
158
|
/**
|
|
879
|
-
*
|
|
159
|
+
* Hook
|
|
880
160
|
*
|
|
881
161
|
* The function called before a new/update document data is processed in `prepare` hooks. This method is used to validate `write data` and throw an error if not valid.
|
|
882
162
|
* @operation `create`, `update`
|
|
883
163
|
*/
|
|
884
|
-
validate: SetTargetOption
|
|
164
|
+
validate: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['validate']>;
|
|
885
165
|
/**
|
|
886
|
-
*
|
|
166
|
+
* Hook
|
|
887
167
|
*
|
|
888
168
|
* The function called before a new document is created or an existing document is updated. This method is used to process raw data passed into the API endpoints.
|
|
889
169
|
* @operation `create`, `update`
|
|
890
170
|
*/
|
|
891
|
-
prepare: SetTargetOption
|
|
171
|
+
prepare: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['prepare']>;
|
|
892
172
|
/**
|
|
893
|
-
*
|
|
173
|
+
* Hook
|
|
894
174
|
*
|
|
895
175
|
* The function called before an updated document is saved.
|
|
896
176
|
* @operation `update`
|
|
897
177
|
*/
|
|
898
|
-
transform: SetTargetOption
|
|
178
|
+
transform: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['transform']>;
|
|
899
179
|
/**
|
|
900
|
-
*
|
|
180
|
+
* Hook
|
|
901
181
|
*
|
|
902
182
|
* The function called after a new document is created or an updated document is saved.
|
|
903
183
|
* @operation `create`, `update`
|
|
904
184
|
*/
|
|
905
|
-
|
|
185
|
+
afterPersist: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['afterPersist']>;
|
|
906
186
|
/**
|
|
907
|
-
*
|
|
187
|
+
* Hook
|
|
908
188
|
*
|
|
909
|
-
* The function called after
|
|
189
|
+
* The function called after an updated document changes have been finalized.
|
|
910
190
|
* @operation `update`
|
|
911
191
|
*/
|
|
912
|
-
|
|
192
|
+
onChange: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['onChange']>;
|
|
193
|
+
/**
|
|
194
|
+
* Hook
|
|
195
|
+
*
|
|
196
|
+
* The function called before a document is deleted.
|
|
197
|
+
* @operation `delete`
|
|
198
|
+
*/
|
|
199
|
+
beforeDelete: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['beforeDelete']>;
|
|
913
200
|
/**
|
|
914
|
-
*
|
|
201
|
+
* Hook
|
|
202
|
+
*
|
|
203
|
+
* The function called after a document is deleted.
|
|
204
|
+
* @operation `delete`
|
|
205
|
+
*/
|
|
206
|
+
afterDelete: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['afterDelete']>;
|
|
207
|
+
/**
|
|
208
|
+
* Hook
|
|
915
209
|
*
|
|
916
210
|
* The function called before response data is sent. This method is used to process raw data to apply custom logic before sending the result.
|
|
917
211
|
* @operation `list`, `read`, `create`, `update`
|
|
918
212
|
*/
|
|
919
|
-
decorate: SetTargetOption
|
|
213
|
+
decorate: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['decorate']>;
|
|
920
214
|
/**
|
|
921
|
-
*
|
|
215
|
+
* Hook
|
|
922
216
|
*
|
|
923
|
-
* The
|
|
217
|
+
* The functions are called before response data is sent and after `decorate` hooks run. This method is used to process and filter multiple document objects before sending the result.
|
|
924
218
|
* @operation `list`
|
|
925
219
|
*/
|
|
926
|
-
decorateAll: SetTargetOption
|
|
220
|
+
decorateAll: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['decorateAll']>;
|
|
221
|
+
/**
|
|
222
|
+
* The field matched against the `id` route param.
|
|
223
|
+
* @operation `read`, `update`, `delete`
|
|
224
|
+
*/
|
|
225
|
+
idField: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['idField']>;
|
|
927
226
|
/**
|
|
928
|
-
* The
|
|
929
|
-
* @option `string` | `Function`
|
|
227
|
+
* The function used to resolve the `id` route param into a document filter.
|
|
930
228
|
* @operation `read`, `update`, `delete`
|
|
931
229
|
*/
|
|
932
|
-
|
|
230
|
+
resolveIdFilter: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['resolveIdFilter']>;
|
|
231
|
+
/**
|
|
232
|
+
* The route segment used for advanced query endpoints.
|
|
233
|
+
*/
|
|
234
|
+
queryRouteSegment: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['queryRouteSegment']>;
|
|
235
|
+
/**
|
|
236
|
+
* The route segment used for advanced mutation endpoints.
|
|
237
|
+
*/
|
|
238
|
+
mutationRouteSegment: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['mutationRouteSegment']>;
|
|
933
239
|
/**
|
|
934
240
|
* The default values used when missing in the operations.
|
|
935
241
|
*/
|
|
936
|
-
defaults: SetTargetOption
|
|
242
|
+
defaults: SetTargetOption<ModelRouter<TModel>, ModelRouterOptions<TModel>['defaults']>;
|
|
937
243
|
get routes(): Router;
|
|
938
244
|
}
|
|
939
245
|
|
|
940
246
|
declare class RootRouter {
|
|
247
|
+
readonly runtime: AccessRuntime;
|
|
941
248
|
router: JsonRouter;
|
|
942
249
|
basename: string;
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
private
|
|
250
|
+
operationAccess: Validation;
|
|
251
|
+
private readonly modelOperations;
|
|
252
|
+
private readonly dataOperations;
|
|
253
|
+
constructor(options?: RootRouterOptions, runtime?: AccessRuntime);
|
|
254
|
+
private wrapResult;
|
|
255
|
+
private hasTarget;
|
|
256
|
+
private isAllowed;
|
|
946
257
|
private processOp;
|
|
947
258
|
private groupItemsByOrder;
|
|
948
259
|
private assertAllowed;
|
|
@@ -950,51 +261,26 @@ declare class RootRouter {
|
|
|
950
261
|
get routes(): Router;
|
|
951
262
|
}
|
|
952
263
|
|
|
953
|
-
type
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
};
|
|
957
|
-
declare class DataRouter {
|
|
958
|
-
readonly dataName: string;
|
|
959
|
-
readonly router: JsonRouter;
|
|
960
|
-
readonly options: DataRouterOptions;
|
|
961
|
-
readonly fullBasePath: string;
|
|
962
|
-
constructor(dataName: string, initialOptions: DataRouterOptions);
|
|
963
|
-
private getRequestSchema;
|
|
964
|
-
private assertAllowed;
|
|
965
|
-
private setCollectionRoutes;
|
|
966
|
-
private setDocumentRoutes;
|
|
967
|
-
set<K extends keyof DataRouterOptions>(keyOrOptions: K | DataRouterOptions, value?: unknown): this;
|
|
968
|
-
setOption<K extends keyof DataRouterOptions>(key: K, option: DataRouterOptions[K]): this;
|
|
969
|
-
setOptions(options: DataRouterOptions): this;
|
|
970
|
-
data: SetTargetOption;
|
|
971
|
-
listHardLimit: SetTargetOption;
|
|
972
|
-
permissionSchema: SetTargetOption;
|
|
973
|
-
routeGuard: SetTargetOption;
|
|
974
|
-
baseFilter: SetTargetOption;
|
|
975
|
-
overrideFilter: SetTargetOption;
|
|
976
|
-
decorate: SetTargetOption;
|
|
977
|
-
decorateAll: SetTargetOption;
|
|
978
|
-
identifier: SetTargetOption;
|
|
979
|
-
get routes(): Router;
|
|
980
|
-
}
|
|
264
|
+
type AccessRouterInstance = ModelRouter<any> | DataRouter<any> | RootRouter;
|
|
265
|
+
type CombinedRouteInput = Router | AccessRouterInstance;
|
|
266
|
+
declare function combineRoutes(...inputs: CombinedRouteInput[]): Router;
|
|
981
267
|
|
|
982
268
|
declare const setGlobalOptions: (options: GlobalOptions) => void;
|
|
983
269
|
declare const setGlobalOption: <K extends keyof GlobalOptions>(key: K, value: GlobalOptions[K]) => void;
|
|
984
270
|
declare const getGlobalOptions: () => GlobalOptions;
|
|
985
271
|
declare const getGlobalOption: <K extends keyof GlobalOptions>(key: K, defaultValue?: GlobalOptions[K]) => GlobalOptions[K];
|
|
986
272
|
|
|
987
|
-
declare const setModelOptions: (modelName: string, options: ModelRouterOptions) => void;
|
|
988
|
-
declare const setModelOption: <K extends keyof ExtendedModelRouterOptions>(modelName: string, key: K, value: ExtendedModelRouterOptions[K]) => void;
|
|
989
|
-
declare const getModelOptions: (modelName: string) => ModelRouterOptions
|
|
990
|
-
declare const getModelOption: <K extends keyof ExtendedModelRouterOptions>(modelName: string, key: K | string, defaultValue?: ExtendedModelRouterOptions[K]) => ExtendedModelRouterOptions[K];
|
|
273
|
+
declare const setModelOptions: <TModel = unknown>(modelName: string, options: ModelRouterOptions<TModel>) => void;
|
|
274
|
+
declare const setModelOption: <K extends keyof ExtendedModelRouterOptions<TModel>, TModel = unknown>(modelName: string, key: K, value: ExtendedModelRouterOptions<TModel>[K]) => void;
|
|
275
|
+
declare const getModelOptions: <TModel = unknown>(modelName: string) => ModelRouterOptions<TModel>;
|
|
276
|
+
declare const getModelOption: <K extends keyof ExtendedModelRouterOptions<TModel>, TModel = unknown>(modelName: string, key: K | string, defaultValue?: ExtendedModelRouterOptions<TModel>[K]) => ExtendedModelRouterOptions<TModel>[K];
|
|
991
277
|
declare const getModelNames: () => string[];
|
|
992
278
|
declare const getModelJsonSchema: (modelName: string) => Record<string, unknown>;
|
|
993
279
|
|
|
994
280
|
declare const setDefaultModelOptions: (options: DefaultModelRouterOptions) => void;
|
|
995
281
|
declare const setDefaultModelOption: <K extends keyof ExtendedDefaultModelRouterOptions>(key: K, value: ExtendedDefaultModelRouterOptions[K]) => void;
|
|
996
|
-
declare const getDefaultModelOptions: () => DefaultModelRouterOptions
|
|
997
|
-
declare const getDefaultModelOption: <K extends keyof ExtendedDefaultModelRouterOptions>(key: K, defaultValue?: ExtendedDefaultModelRouterOptions[K]) => ExtendedDefaultModelRouterOptions[K];
|
|
282
|
+
declare const getDefaultModelOptions: () => DefaultModelRouterOptions<unknown>;
|
|
283
|
+
declare const getDefaultModelOption: <K extends keyof ExtendedDefaultModelRouterOptions>(key: K, defaultValue?: ExtendedDefaultModelRouterOptions[K]) => ExtendedDefaultModelRouterOptions<unknown>[K];
|
|
998
284
|
|
|
999
285
|
interface Options {
|
|
1000
286
|
virtualPermissionField?: string;
|
|
@@ -1002,559 +288,13 @@ interface Options {
|
|
|
1002
288
|
}
|
|
1003
289
|
declare function permissionsPlugin(schema: any, options: Options): void;
|
|
1004
290
|
|
|
1005
|
-
declare const MIDDLEWARE: unique symbol;
|
|
1006
|
-
declare const DATA_MIDDLEWARE: unique symbol;
|
|
1007
|
-
declare const CORE: unique symbol;
|
|
1008
|
-
declare const PERMISSIONS: unique symbol;
|
|
1009
|
-
declare const PERMISSION_KEYS: unique symbol;
|
|
1010
|
-
|
|
1011
|
-
type ListQueryInput = {
|
|
1012
|
-
skip?: string;
|
|
1013
|
-
limit?: string;
|
|
1014
|
-
page?: string;
|
|
1015
|
-
page_size?: string;
|
|
1016
|
-
skim?: 'true' | 'false';
|
|
1017
|
-
include_permissions?: 'true' | 'false';
|
|
1018
|
-
include_count?: 'true' | 'false';
|
|
1019
|
-
include_extra_headers?: 'true' | 'false';
|
|
1020
|
-
};
|
|
1021
|
-
type CreateQueryInput = {
|
|
1022
|
-
include_permissions?: 'true' | 'false';
|
|
1023
|
-
};
|
|
1024
|
-
type ReadQueryInput = {
|
|
1025
|
-
include_permissions?: 'true' | 'false';
|
|
1026
|
-
try_list?: 'true' | 'false';
|
|
1027
|
-
};
|
|
1028
|
-
type UpdateQueryInput = {
|
|
1029
|
-
returning_all?: 'true' | 'false';
|
|
1030
|
-
};
|
|
1031
|
-
type UpsertQueryInput = {
|
|
1032
|
-
returning_all?: 'true' | 'false';
|
|
1033
|
-
include_permissions?: 'true' | 'false';
|
|
1034
|
-
};
|
|
1035
|
-
type AdvancedListBody = {
|
|
1036
|
-
query?: Filter | unknown[];
|
|
1037
|
-
filter?: Filter | unknown[];
|
|
1038
|
-
select?: Projection;
|
|
1039
|
-
sort?: Sort;
|
|
1040
|
-
populate?: Populate[] | string;
|
|
1041
|
-
include?: Include | Include[];
|
|
1042
|
-
tasks?: Task | Task[];
|
|
1043
|
-
skip?: string | number;
|
|
1044
|
-
limit?: string | number;
|
|
1045
|
-
page?: string | number;
|
|
1046
|
-
pageSize?: string | number;
|
|
1047
|
-
options?: {
|
|
1048
|
-
skim?: boolean;
|
|
1049
|
-
includePermissions?: boolean;
|
|
1050
|
-
includeCount?: boolean;
|
|
1051
|
-
includeExtraHeaders?: boolean;
|
|
1052
|
-
populateAccess?: unknown;
|
|
1053
|
-
};
|
|
1054
|
-
};
|
|
1055
|
-
type CountBody = {
|
|
1056
|
-
query?: Filter | unknown[];
|
|
1057
|
-
filter?: Filter | unknown[];
|
|
1058
|
-
access?: unknown;
|
|
1059
|
-
};
|
|
1060
|
-
type AdvancedReadFilterBody = {
|
|
1061
|
-
filter?: Filter | unknown[];
|
|
1062
|
-
select?: Projection;
|
|
1063
|
-
sort?: Sort;
|
|
1064
|
-
populate?: Populate[] | string;
|
|
1065
|
-
include?: Include | Include[];
|
|
1066
|
-
tasks?: Task | Task[];
|
|
1067
|
-
options?: {
|
|
1068
|
-
skim?: boolean;
|
|
1069
|
-
includePermissions?: boolean;
|
|
1070
|
-
tryList?: boolean;
|
|
1071
|
-
populateAccess?: unknown;
|
|
1072
|
-
};
|
|
1073
|
-
};
|
|
1074
|
-
type AdvancedReadBody = {
|
|
1075
|
-
select?: Projection;
|
|
1076
|
-
populate?: Populate[] | string;
|
|
1077
|
-
include?: Include | Include[];
|
|
1078
|
-
tasks?: Task | Task[];
|
|
1079
|
-
options?: {
|
|
1080
|
-
skim?: boolean;
|
|
1081
|
-
includePermissions?: boolean;
|
|
1082
|
-
tryList?: boolean;
|
|
1083
|
-
populateAccess?: unknown;
|
|
1084
|
-
};
|
|
1085
|
-
};
|
|
1086
|
-
type AdvancedCreateBody = {
|
|
1087
|
-
data: unknown;
|
|
1088
|
-
select?: Projection;
|
|
1089
|
-
populate?: Populate[] | string;
|
|
1090
|
-
tasks?: Task | Task[];
|
|
1091
|
-
options?: {
|
|
1092
|
-
includePermissions?: boolean;
|
|
1093
|
-
populateAccess?: unknown;
|
|
1094
|
-
};
|
|
1095
|
-
};
|
|
1096
|
-
type AdvancedUpdateBody = {
|
|
1097
|
-
data: unknown;
|
|
1098
|
-
select?: Projection;
|
|
1099
|
-
populate?: Populate[] | string;
|
|
1100
|
-
tasks?: Task | Task[];
|
|
1101
|
-
options?: {
|
|
1102
|
-
returningAll?: boolean;
|
|
1103
|
-
includePermissions?: boolean;
|
|
1104
|
-
populateAccess?: unknown;
|
|
1105
|
-
};
|
|
1106
|
-
};
|
|
1107
|
-
type AdvancedUpsertBody = {
|
|
1108
|
-
data: Record<string, unknown>;
|
|
1109
|
-
select?: Projection;
|
|
1110
|
-
populate?: Populate[] | string;
|
|
1111
|
-
tasks?: Task | Task[];
|
|
1112
|
-
options?: {
|
|
1113
|
-
returningAll?: boolean;
|
|
1114
|
-
includePermissions?: boolean;
|
|
1115
|
-
populateAccess?: unknown;
|
|
1116
|
-
};
|
|
1117
|
-
};
|
|
1118
|
-
type DistinctBody = {
|
|
1119
|
-
query?: Filter | unknown[];
|
|
1120
|
-
filter?: Filter | unknown[];
|
|
1121
|
-
};
|
|
1122
|
-
type SubListBody = {
|
|
1123
|
-
filter?: Filter;
|
|
1124
|
-
fields?: string[];
|
|
1125
|
-
};
|
|
1126
|
-
type SubReadBody = {
|
|
1127
|
-
fields?: string[];
|
|
1128
|
-
populate?: SubPopulate | SubPopulate[] | string | string[];
|
|
1129
|
-
};
|
|
1130
|
-
declare const rootQuerySchema: z.ZodArray<z.ZodObject<{
|
|
1131
|
-
model: z.ZodString;
|
|
1132
|
-
op: z.ZodString;
|
|
1133
|
-
id: z.ZodOptional<z.ZodString>;
|
|
1134
|
-
field: z.ZodOptional<z.ZodString>;
|
|
1135
|
-
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1136
|
-
data: z.ZodOptional<z.ZodUnknown>;
|
|
1137
|
-
args: z.ZodOptional<z.ZodUnknown>;
|
|
1138
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
1139
|
-
order: z.ZodOptional<z.ZodNumber>;
|
|
1140
|
-
}, z.core.$loose>>;
|
|
1141
|
-
declare const listBodySchema: z.ZodObject<{
|
|
1142
|
-
query: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1143
|
-
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1144
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1145
|
-
sort: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>], null>>, z.ZodNull]>>;
|
|
1146
|
-
populate: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1147
|
-
path: z.ZodString;
|
|
1148
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1149
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1150
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1151
|
-
read: "read";
|
|
1152
|
-
list: "list";
|
|
1153
|
-
}>>;
|
|
1154
|
-
}, z.core.$loose>]>>, z.ZodObject<{
|
|
1155
|
-
path: z.ZodString;
|
|
1156
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1157
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1158
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1159
|
-
read: "read";
|
|
1160
|
-
list: "list";
|
|
1161
|
-
}>>;
|
|
1162
|
-
}, z.core.$loose>]>>;
|
|
1163
|
-
include: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1164
|
-
model: z.ZodString;
|
|
1165
|
-
op: z.ZodEnum<{
|
|
1166
|
-
read: "read";
|
|
1167
|
-
list: "list";
|
|
1168
|
-
count: "count";
|
|
1169
|
-
}>;
|
|
1170
|
-
path: z.ZodString;
|
|
1171
|
-
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1172
|
-
localField: z.ZodString;
|
|
1173
|
-
foreignField: z.ZodString;
|
|
1174
|
-
args: z.ZodOptional<z.ZodUnknown>;
|
|
1175
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
1176
|
-
}, z.core.$loose>, z.ZodArray<z.ZodObject<{
|
|
1177
|
-
model: z.ZodString;
|
|
1178
|
-
op: z.ZodEnum<{
|
|
1179
|
-
read: "read";
|
|
1180
|
-
list: "list";
|
|
1181
|
-
count: "count";
|
|
1182
|
-
}>;
|
|
1183
|
-
path: z.ZodString;
|
|
1184
|
-
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1185
|
-
localField: z.ZodString;
|
|
1186
|
-
foreignField: z.ZodString;
|
|
1187
|
-
args: z.ZodOptional<z.ZodUnknown>;
|
|
1188
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
1189
|
-
}, z.core.$loose>>]>>;
|
|
1190
|
-
tasks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1191
|
-
type: z.ZodString;
|
|
1192
|
-
args: z.ZodUnknown;
|
|
1193
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1194
|
-
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
1195
|
-
type: z.ZodString;
|
|
1196
|
-
args: z.ZodUnknown;
|
|
1197
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1198
|
-
}, z.core.$strip>>]>>;
|
|
1199
|
-
skip: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1200
|
-
limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1201
|
-
page: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1202
|
-
pageSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1203
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
1204
|
-
skim: z.ZodOptional<z.ZodBoolean>;
|
|
1205
|
-
includePermissions: z.ZodOptional<z.ZodBoolean>;
|
|
1206
|
-
includeCount: z.ZodOptional<z.ZodBoolean>;
|
|
1207
|
-
includeExtraHeaders: z.ZodOptional<z.ZodBoolean>;
|
|
1208
|
-
populateAccess: z.ZodOptional<z.ZodUnknown>;
|
|
1209
|
-
}, z.core.$loose>>;
|
|
1210
|
-
}, z.core.$loose>;
|
|
1211
|
-
declare const dataListBodySchema: z.ZodObject<{
|
|
1212
|
-
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1213
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1214
|
-
sort: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>], null>>, z.ZodNull]>>;
|
|
1215
|
-
skip: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1216
|
-
limit: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1217
|
-
page: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1218
|
-
pageSize: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
1219
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
1220
|
-
includeCount: z.ZodOptional<z.ZodBoolean>;
|
|
1221
|
-
includeExtraHeaders: z.ZodOptional<z.ZodBoolean>;
|
|
1222
|
-
}, z.core.$loose>>;
|
|
1223
|
-
}, z.core.$loose>;
|
|
1224
|
-
declare const countBodySchema: z.ZodObject<{
|
|
1225
|
-
query: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1226
|
-
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1227
|
-
access: z.ZodOptional<z.ZodUnknown>;
|
|
1228
|
-
}, z.core.$loose>;
|
|
1229
|
-
declare const readFilterBodySchema: z.ZodObject<{
|
|
1230
|
-
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1231
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1232
|
-
sort: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>>, z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<1>, z.ZodLiteral<"asc">, z.ZodLiteral<"ascending">, z.ZodLiteral<"desc">, z.ZodLiteral<"descending">]>], null>>, z.ZodNull]>>;
|
|
1233
|
-
populate: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1234
|
-
path: z.ZodString;
|
|
1235
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1236
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1237
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1238
|
-
read: "read";
|
|
1239
|
-
list: "list";
|
|
1240
|
-
}>>;
|
|
1241
|
-
}, z.core.$loose>]>>, z.ZodObject<{
|
|
1242
|
-
path: z.ZodString;
|
|
1243
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1244
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1245
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1246
|
-
read: "read";
|
|
1247
|
-
list: "list";
|
|
1248
|
-
}>>;
|
|
1249
|
-
}, z.core.$loose>]>>;
|
|
1250
|
-
include: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1251
|
-
model: z.ZodString;
|
|
1252
|
-
op: z.ZodEnum<{
|
|
1253
|
-
read: "read";
|
|
1254
|
-
list: "list";
|
|
1255
|
-
count: "count";
|
|
1256
|
-
}>;
|
|
1257
|
-
path: z.ZodString;
|
|
1258
|
-
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1259
|
-
localField: z.ZodString;
|
|
1260
|
-
foreignField: z.ZodString;
|
|
1261
|
-
args: z.ZodOptional<z.ZodUnknown>;
|
|
1262
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
1263
|
-
}, z.core.$loose>, z.ZodArray<z.ZodObject<{
|
|
1264
|
-
model: z.ZodString;
|
|
1265
|
-
op: z.ZodEnum<{
|
|
1266
|
-
read: "read";
|
|
1267
|
-
list: "list";
|
|
1268
|
-
count: "count";
|
|
1269
|
-
}>;
|
|
1270
|
-
path: z.ZodString;
|
|
1271
|
-
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1272
|
-
localField: z.ZodString;
|
|
1273
|
-
foreignField: z.ZodString;
|
|
1274
|
-
args: z.ZodOptional<z.ZodUnknown>;
|
|
1275
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
1276
|
-
}, z.core.$loose>>]>>;
|
|
1277
|
-
tasks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1278
|
-
type: z.ZodString;
|
|
1279
|
-
args: z.ZodUnknown;
|
|
1280
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1281
|
-
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
1282
|
-
type: z.ZodString;
|
|
1283
|
-
args: z.ZodUnknown;
|
|
1284
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1285
|
-
}, z.core.$strip>>]>>;
|
|
1286
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
1287
|
-
skim: z.ZodOptional<z.ZodBoolean>;
|
|
1288
|
-
includePermissions: z.ZodOptional<z.ZodBoolean>;
|
|
1289
|
-
tryList: z.ZodOptional<z.ZodBoolean>;
|
|
1290
|
-
populateAccess: z.ZodOptional<z.ZodUnknown>;
|
|
1291
|
-
}, z.core.$loose>>;
|
|
1292
|
-
}, z.core.$loose>;
|
|
1293
|
-
declare const dataReadFilterBodySchema: z.ZodObject<{
|
|
1294
|
-
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1295
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1296
|
-
options: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
1297
|
-
}, z.core.$loose>;
|
|
1298
|
-
declare const readByIdBodySchema: z.ZodObject<{
|
|
1299
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1300
|
-
populate: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1301
|
-
path: z.ZodString;
|
|
1302
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1303
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1304
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1305
|
-
read: "read";
|
|
1306
|
-
list: "list";
|
|
1307
|
-
}>>;
|
|
1308
|
-
}, z.core.$loose>]>>, z.ZodObject<{
|
|
1309
|
-
path: z.ZodString;
|
|
1310
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1311
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1312
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1313
|
-
read: "read";
|
|
1314
|
-
list: "list";
|
|
1315
|
-
}>>;
|
|
1316
|
-
}, z.core.$loose>]>>;
|
|
1317
|
-
include: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1318
|
-
model: z.ZodString;
|
|
1319
|
-
op: z.ZodEnum<{
|
|
1320
|
-
read: "read";
|
|
1321
|
-
list: "list";
|
|
1322
|
-
count: "count";
|
|
1323
|
-
}>;
|
|
1324
|
-
path: z.ZodString;
|
|
1325
|
-
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1326
|
-
localField: z.ZodString;
|
|
1327
|
-
foreignField: z.ZodString;
|
|
1328
|
-
args: z.ZodOptional<z.ZodUnknown>;
|
|
1329
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
1330
|
-
}, z.core.$loose>, z.ZodArray<z.ZodObject<{
|
|
1331
|
-
model: z.ZodString;
|
|
1332
|
-
op: z.ZodEnum<{
|
|
1333
|
-
read: "read";
|
|
1334
|
-
list: "list";
|
|
1335
|
-
count: "count";
|
|
1336
|
-
}>;
|
|
1337
|
-
path: z.ZodString;
|
|
1338
|
-
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1339
|
-
localField: z.ZodString;
|
|
1340
|
-
foreignField: z.ZodString;
|
|
1341
|
-
args: z.ZodOptional<z.ZodUnknown>;
|
|
1342
|
-
options: z.ZodOptional<z.ZodUnknown>;
|
|
1343
|
-
}, z.core.$loose>>]>>;
|
|
1344
|
-
tasks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1345
|
-
type: z.ZodString;
|
|
1346
|
-
args: z.ZodUnknown;
|
|
1347
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1348
|
-
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
1349
|
-
type: z.ZodString;
|
|
1350
|
-
args: z.ZodUnknown;
|
|
1351
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1352
|
-
}, z.core.$strip>>]>>;
|
|
1353
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
1354
|
-
skim: z.ZodOptional<z.ZodBoolean>;
|
|
1355
|
-
includePermissions: z.ZodOptional<z.ZodBoolean>;
|
|
1356
|
-
tryList: z.ZodOptional<z.ZodBoolean>;
|
|
1357
|
-
populateAccess: z.ZodOptional<z.ZodUnknown>;
|
|
1358
|
-
}, z.core.$loose>>;
|
|
1359
|
-
}, z.core.$loose>;
|
|
1360
|
-
declare const dataReadByIdBodySchema: z.ZodObject<{
|
|
1361
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1362
|
-
options: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
|
|
1363
|
-
}, z.core.$loose>;
|
|
1364
|
-
declare const advancedCreateBodySchema: z.ZodObject<{
|
|
1365
|
-
data: z.ZodUnknown;
|
|
1366
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1367
|
-
populate: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1368
|
-
path: z.ZodString;
|
|
1369
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1370
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1371
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1372
|
-
read: "read";
|
|
1373
|
-
list: "list";
|
|
1374
|
-
}>>;
|
|
1375
|
-
}, z.core.$loose>]>>, z.ZodObject<{
|
|
1376
|
-
path: z.ZodString;
|
|
1377
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1378
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1379
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1380
|
-
read: "read";
|
|
1381
|
-
list: "list";
|
|
1382
|
-
}>>;
|
|
1383
|
-
}, z.core.$loose>]>>;
|
|
1384
|
-
tasks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1385
|
-
type: z.ZodString;
|
|
1386
|
-
args: z.ZodUnknown;
|
|
1387
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1388
|
-
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
1389
|
-
type: z.ZodString;
|
|
1390
|
-
args: z.ZodUnknown;
|
|
1391
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1392
|
-
}, z.core.$strip>>]>>;
|
|
1393
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
1394
|
-
includePermissions: z.ZodOptional<z.ZodBoolean>;
|
|
1395
|
-
populateAccess: z.ZodOptional<z.ZodUnknown>;
|
|
1396
|
-
}, z.core.$loose>>;
|
|
1397
|
-
}, z.core.$loose>;
|
|
1398
|
-
declare const createBodySchema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
1399
|
-
declare const updateBodySchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1400
|
-
declare const advancedUpdateBodySchema: z.ZodObject<{
|
|
1401
|
-
data: z.ZodUnknown;
|
|
1402
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1403
|
-
populate: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1404
|
-
path: z.ZodString;
|
|
1405
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1406
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1407
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1408
|
-
read: "read";
|
|
1409
|
-
list: "list";
|
|
1410
|
-
}>>;
|
|
1411
|
-
}, z.core.$loose>]>>, z.ZodObject<{
|
|
1412
|
-
path: z.ZodString;
|
|
1413
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1414
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1415
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1416
|
-
read: "read";
|
|
1417
|
-
list: "list";
|
|
1418
|
-
}>>;
|
|
1419
|
-
}, z.core.$loose>]>>;
|
|
1420
|
-
tasks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1421
|
-
type: z.ZodString;
|
|
1422
|
-
args: z.ZodUnknown;
|
|
1423
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1424
|
-
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
1425
|
-
type: z.ZodString;
|
|
1426
|
-
args: z.ZodUnknown;
|
|
1427
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1428
|
-
}, z.core.$strip>>]>>;
|
|
1429
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
1430
|
-
returningAll: z.ZodOptional<z.ZodBoolean>;
|
|
1431
|
-
includePermissions: z.ZodOptional<z.ZodBoolean>;
|
|
1432
|
-
populateAccess: z.ZodOptional<z.ZodUnknown>;
|
|
1433
|
-
}, z.core.$loose>>;
|
|
1434
|
-
}, z.core.$loose>;
|
|
1435
|
-
declare const upsertBodySchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1436
|
-
declare const advancedUpsertBodySchema: z.ZodObject<{
|
|
1437
|
-
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
1438
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1439
|
-
populate: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1440
|
-
path: z.ZodString;
|
|
1441
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1442
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1443
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1444
|
-
read: "read";
|
|
1445
|
-
list: "list";
|
|
1446
|
-
}>>;
|
|
1447
|
-
}, z.core.$loose>]>>, z.ZodObject<{
|
|
1448
|
-
path: z.ZodString;
|
|
1449
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1450
|
-
match: z.ZodOptional<z.ZodUnknown>;
|
|
1451
|
-
access: z.ZodOptional<z.ZodEnum<{
|
|
1452
|
-
read: "read";
|
|
1453
|
-
list: "list";
|
|
1454
|
-
}>>;
|
|
1455
|
-
}, z.core.$loose>]>>;
|
|
1456
|
-
tasks: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1457
|
-
type: z.ZodString;
|
|
1458
|
-
args: z.ZodUnknown;
|
|
1459
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1460
|
-
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
1461
|
-
type: z.ZodString;
|
|
1462
|
-
args: z.ZodUnknown;
|
|
1463
|
-
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1464
|
-
}, z.core.$strip>>]>>;
|
|
1465
|
-
options: z.ZodOptional<z.ZodObject<{
|
|
1466
|
-
returningAll: z.ZodOptional<z.ZodBoolean>;
|
|
1467
|
-
includePermissions: z.ZodOptional<z.ZodBoolean>;
|
|
1468
|
-
populateAccess: z.ZodOptional<z.ZodUnknown>;
|
|
1469
|
-
}, z.core.$loose>>;
|
|
1470
|
-
}, z.core.$loose>;
|
|
1471
|
-
declare const distinctBodySchema: z.ZodObject<{
|
|
1472
|
-
query: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1473
|
-
filter: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodUnknown>]>>;
|
|
1474
|
-
}, z.core.$loose>;
|
|
1475
|
-
declare const subListBodySchema: z.ZodObject<{
|
|
1476
|
-
filter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
1477
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1478
|
-
}, z.core.$loose>;
|
|
1479
|
-
declare const subMutationBodySchema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>]>;
|
|
1480
|
-
declare const subReadBodySchema: z.ZodObject<{
|
|
1481
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1482
|
-
populate: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
1483
|
-
path: z.ZodString;
|
|
1484
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1485
|
-
}, z.core.$loose>]>>, z.ZodObject<{
|
|
1486
|
-
path: z.ZodString;
|
|
1487
|
-
select: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<-1>]>>]>>;
|
|
1488
|
-
}, z.core.$loose>]>>;
|
|
1489
|
-
}, z.core.$loose>;
|
|
1490
|
-
declare function parsePathParam(value: string | string[] | undefined, parameter: string): string;
|
|
1491
|
-
declare function parseQuery<TSchema extends z.ZodTypeAny>(schema: TSchema, value: unknown): z.output<TSchema>;
|
|
1492
|
-
declare function parseBody<TSchema extends z.ZodTypeAny>(schema: TSchema, value: unknown): z.output<TSchema>;
|
|
1493
|
-
declare function parseBodyWithSchema<TSchema extends z.ZodTypeAny>(schema: TSchema, value: unknown, userSchema?: z.ZodTypeAny): z.output<TSchema>;
|
|
1494
|
-
declare function parseNestedBodyWithSchema(schema: z.ZodTypeAny, value: unknown, nestedKey: string, userSchema?: z.ZodTypeAny): Record<string, unknown>;
|
|
1495
|
-
declare const requestSchemas: {
|
|
1496
|
-
listQuery: z.ZodObject<{
|
|
1497
|
-
skip: z.ZodOptional<z.ZodString>;
|
|
1498
|
-
limit: z.ZodOptional<z.ZodString>;
|
|
1499
|
-
page: z.ZodOptional<z.ZodString>;
|
|
1500
|
-
page_size: z.ZodOptional<z.ZodString>;
|
|
1501
|
-
skim: z.ZodOptional<z.ZodEnum<{
|
|
1502
|
-
true: "true";
|
|
1503
|
-
false: "false";
|
|
1504
|
-
}>>;
|
|
1505
|
-
include_permissions: z.ZodOptional<z.ZodEnum<{
|
|
1506
|
-
true: "true";
|
|
1507
|
-
false: "false";
|
|
1508
|
-
}>>;
|
|
1509
|
-
include_count: z.ZodOptional<z.ZodEnum<{
|
|
1510
|
-
true: "true";
|
|
1511
|
-
false: "false";
|
|
1512
|
-
}>>;
|
|
1513
|
-
include_extra_headers: z.ZodOptional<z.ZodEnum<{
|
|
1514
|
-
true: "true";
|
|
1515
|
-
false: "false";
|
|
1516
|
-
}>>;
|
|
1517
|
-
}, z.core.$loose>;
|
|
1518
|
-
createQuery: z.ZodObject<{
|
|
1519
|
-
include_permissions: z.ZodOptional<z.ZodEnum<{
|
|
1520
|
-
true: "true";
|
|
1521
|
-
false: "false";
|
|
1522
|
-
}>>;
|
|
1523
|
-
}, z.core.$loose>;
|
|
1524
|
-
readQuery: z.ZodObject<{
|
|
1525
|
-
include_permissions: z.ZodOptional<z.ZodEnum<{
|
|
1526
|
-
true: "true";
|
|
1527
|
-
false: "false";
|
|
1528
|
-
}>>;
|
|
1529
|
-
try_list: z.ZodOptional<z.ZodEnum<{
|
|
1530
|
-
true: "true";
|
|
1531
|
-
false: "false";
|
|
1532
|
-
}>>;
|
|
1533
|
-
}, z.core.$loose>;
|
|
1534
|
-
updateQuery: z.ZodObject<{
|
|
1535
|
-
returning_all: z.ZodOptional<z.ZodEnum<{
|
|
1536
|
-
true: "true";
|
|
1537
|
-
false: "false";
|
|
1538
|
-
}>>;
|
|
1539
|
-
}, z.core.$loose>;
|
|
1540
|
-
upsertQuery: z.ZodObject<{
|
|
1541
|
-
returning_all: z.ZodOptional<z.ZodEnum<{
|
|
1542
|
-
true: "true";
|
|
1543
|
-
false: "false";
|
|
1544
|
-
}>>;
|
|
1545
|
-
include_permissions: z.ZodOptional<z.ZodEnum<{
|
|
1546
|
-
true: "true";
|
|
1547
|
-
false: "false";
|
|
1548
|
-
}>>;
|
|
1549
|
-
}, z.core.$loose>;
|
|
1550
|
-
};
|
|
1551
|
-
|
|
1552
291
|
type CreateRouter = {
|
|
1553
|
-
(
|
|
292
|
+
<TModel>(model: mongoose.Model<TModel>, options: ModelRouterOptions<TModel>): ModelRouter<TModel>;
|
|
293
|
+
<TModel>(modelName: string, options: ModelRouterOptions<TModel>): ModelRouter<TModel>;
|
|
1554
294
|
(options: RootRouterOptions): RootRouter;
|
|
1555
295
|
};
|
|
1556
296
|
type CreateDataRouter = {
|
|
1557
|
-
(dataName: string, options: DataRouterOptions): DataRouter
|
|
297
|
+
<TData>(dataName: string, options: DataRouterOptions<TData>): DataRouter<TData>;
|
|
1558
298
|
};
|
|
1559
299
|
type WttSet = {
|
|
1560
300
|
<K extends keyof GlobalOptions>(key: K, value: GlobalOptions[K]): void;
|
|
@@ -1563,8 +303,10 @@ type WttSet = {
|
|
|
1563
303
|
}): void;
|
|
1564
304
|
};
|
|
1565
305
|
interface Wtt {
|
|
306
|
+
runtime: AccessRuntime;
|
|
1566
307
|
createRouter: CreateRouter;
|
|
1567
308
|
createDataRouter: CreateDataRouter;
|
|
309
|
+
combineRoutes: typeof combineRoutes;
|
|
1568
310
|
set: WttSet;
|
|
1569
311
|
setGlobalOptions: typeof setGlobalOptions;
|
|
1570
312
|
setGlobalOption: typeof setGlobalOption;
|
|
@@ -1584,6 +326,8 @@ interface Wtt {
|
|
|
1584
326
|
ModelRouter: typeof ModelRouter;
|
|
1585
327
|
DataRouter: typeof DataRouter;
|
|
1586
328
|
}
|
|
1587
|
-
|
|
329
|
+
type AccessRuntimeApi = typeof macl & Wtt;
|
|
330
|
+
declare function createAccessRuntime(): AccessRuntimeApi;
|
|
331
|
+
declare const acl: AccessRuntimeApi;
|
|
1588
332
|
|
|
1589
|
-
export {
|
|
333
|
+
export { AccessRuntime, type AccessRuntimeApi, type CombinedRouteInput, DataRouter, DataRouterOptions, GlobalOptions, ModelRouter, ModelRouterOptions, RootRouter, RootRouterOptions, acl, combineRoutes, createAccessRuntime, acl as default, getDefaultModelOption, getDefaultModelOptions, getGlobalOption, getGlobalOptions, getModelJsonSchema, getModelNames, getModelOption, getModelOptions, guard, permissionsPlugin, setDefaultModelOption, setDefaultModelOptions, setGlobalOption, setGlobalOptions, setModelOption, setModelOptions };
|