@web-ts-toolkit/access-router 0.64.0 → 0.65.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 +309 -3
- package/advanced.d.mts +1 -1
- package/advanced.d.ts +1 -1
- package/advanced.js +167 -26
- package/advanced.mjs +167 -26
- package/index.d.mts +2 -2
- package/index.d.ts +2 -2
- package/index.js +1845 -254
- package/index.mjs +1839 -247
- package/llms.txt +3 -2
- package/package.json +3 -3
- package/{parsers-Bdq0jg69.d.mts → parsers-h_oU4bB0.d.mts} +194 -9
- package/{parsers-Bdq0jg69.d.ts → parsers-h_oU4bB0.d.ts} +194 -9
package/advanced.js
CHANGED
|
@@ -146,6 +146,37 @@ var unsafeInitialOutputCopyOptions = [
|
|
|
146
146
|
"unsafeSkipReadInitialOutputSnapshotCopy"
|
|
147
147
|
];
|
|
148
148
|
var unsafeSnapshotOptions = [...unsafeSnapshotCheckOptions, ...unsafeInitialOutputCopyOptions];
|
|
149
|
+
var unsafeAuthorizationFastPathOptions = [
|
|
150
|
+
"unsafeUseListAuthorizationFastPath",
|
|
151
|
+
"unsafeUseReadAuthorizationFastPath"
|
|
152
|
+
];
|
|
153
|
+
var unsafeServerOptions = [...unsafeSnapshotOptions, ...unsafeAuthorizationFastPathOptions];
|
|
154
|
+
function authorizationFastPathPrerequisites(origin) {
|
|
155
|
+
const operation = origin === "read" ? "Read" : "List";
|
|
156
|
+
return [
|
|
157
|
+
`unsafeSkip${operation}DocumentSnapshotChecks`,
|
|
158
|
+
`unsafeSkip${operation}OutputSnapshotChecks`,
|
|
159
|
+
`unsafeSkip${operation}NestedDocumentSnapshotChecks`,
|
|
160
|
+
`unsafeSkip${operation}InitialOutputSnapshotCopy`
|
|
161
|
+
];
|
|
162
|
+
}
|
|
163
|
+
function captureAuthorizationFastPath(options, origin) {
|
|
164
|
+
const literalTrue = (key2) => {
|
|
165
|
+
const descriptor = Object.getOwnPropertyDescriptor(options, key2);
|
|
166
|
+
return !!descriptor && "value" in descriptor && descriptor.value === true;
|
|
167
|
+
};
|
|
168
|
+
const key = origin === "read" ? unsafeAuthorizationFastPathOptions[1] : unsafeAuthorizationFastPathOptions[0];
|
|
169
|
+
const requested = literalTrue(key);
|
|
170
|
+
const prerequisites = authorizationFastPathPrerequisites(origin).reduce(
|
|
171
|
+
(mask, key2, index) => mask | (literalTrue(key2) ? 1 << index : 0),
|
|
172
|
+
0
|
|
173
|
+
);
|
|
174
|
+
return Object.freeze({
|
|
175
|
+
origin,
|
|
176
|
+
mode: !requested ? "off" : prerequisites === 15 ? "active" : "dormant",
|
|
177
|
+
prerequisites
|
|
178
|
+
});
|
|
179
|
+
}
|
|
149
180
|
|
|
150
181
|
// src/validation/public-admission.ts
|
|
151
182
|
var privateControls = [
|
|
@@ -165,7 +196,7 @@ var privateControls = [
|
|
|
165
196
|
"skipParsing",
|
|
166
197
|
"skipAuthorization",
|
|
167
198
|
"alreadyAuthorized",
|
|
168
|
-
...
|
|
199
|
+
...unsafeServerOptions,
|
|
169
200
|
"operation"
|
|
170
201
|
];
|
|
171
202
|
var PublicAdmissionError = class extends import_express_json_router.default.clientErrors.BadRequestError {
|
|
@@ -175,42 +206,115 @@ var PublicAdmissionError = class extends import_express_json_router.default.clie
|
|
|
175
206
|
this.result = { success: false, kind: "error", code: "bad_request" /* BadRequest */, errors };
|
|
176
207
|
}
|
|
177
208
|
};
|
|
209
|
+
var defaultControlBuckets = [
|
|
210
|
+
"findOneArgs",
|
|
211
|
+
"findOneOptions",
|
|
212
|
+
"findByIdArgs",
|
|
213
|
+
"findByIdOptions",
|
|
214
|
+
"findArgs",
|
|
215
|
+
"findOptions",
|
|
216
|
+
"createArgs",
|
|
217
|
+
"createOptions",
|
|
218
|
+
"updateOneArgs",
|
|
219
|
+
"updateOneOptions",
|
|
220
|
+
"upsertOptions",
|
|
221
|
+
"updateByIdArgs",
|
|
222
|
+
"upsertArgs",
|
|
223
|
+
"updateByIdOptions",
|
|
224
|
+
"existsOptions",
|
|
225
|
+
"publicListArgs",
|
|
226
|
+
"publicListOptions",
|
|
227
|
+
"publicCreateArgs",
|
|
228
|
+
"publicCreateOptions",
|
|
229
|
+
"publicReadArgs",
|
|
230
|
+
"publicReadOptions",
|
|
231
|
+
"publicUpdateArgs",
|
|
232
|
+
"publicUpdateOptions"
|
|
233
|
+
];
|
|
178
234
|
function assertPublicAdmission(input, kind = "envelope") {
|
|
179
|
-
|
|
235
|
+
assertPublicControlAdmission(input, kind);
|
|
236
|
+
}
|
|
237
|
+
function assertPublicControlAdmission(input, kind) {
|
|
238
|
+
walkControlAdmission(
|
|
239
|
+
input,
|
|
240
|
+
kind,
|
|
241
|
+
(record2, path) => {
|
|
242
|
+
for (const key of privateControls) {
|
|
243
|
+
if (key in record2) {
|
|
244
|
+
throw new PublicAdmissionError(
|
|
245
|
+
unsafeServerOptions.includes(key) ? `Unsupported public control ${path}.${key}; this unsafe flag is server model configuration only` : `Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
(detail) => {
|
|
251
|
+
throw new PublicAdmissionError(detail);
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
function walkControlAdmission(input, kind, check, reject) {
|
|
256
|
+
const pending = [{ value: input, kind, path: "request", depth: 0 }];
|
|
180
257
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
258
|
+
let slots = 1;
|
|
181
259
|
while (pending.length) {
|
|
182
|
-
const { value, kind: slot, path } = pending.pop();
|
|
260
|
+
const { value, kind: slot, path, depth } = pending.pop();
|
|
183
261
|
if (!value || typeof value !== "object" && typeof value !== "function") continue;
|
|
184
262
|
const kinds = seen.get(value) ?? /* @__PURE__ */ new Set();
|
|
185
263
|
if (kinds.has(slot)) continue;
|
|
186
264
|
kinds.add(slot);
|
|
187
265
|
seen.set(value, kinds);
|
|
188
266
|
const add = (child, childKind, key) => {
|
|
189
|
-
|
|
267
|
+
if (child === void 0 || child === null) return;
|
|
268
|
+
if (++slots > 2e4 || depth >= 100) reject("control admission exceeds structural limits");
|
|
269
|
+
pending.push({ value: child, kind: childKind, path: `${path}.${key}`, depth: depth + 1 });
|
|
190
270
|
};
|
|
191
271
|
const record2 = value;
|
|
192
|
-
if (slot !== "data")
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
272
|
+
if (slot !== "data" && slot !== "policies") check(record2, path);
|
|
273
|
+
const read = (key) => {
|
|
274
|
+
let owner = value;
|
|
275
|
+
for (let depth2 = 0; owner; depth2++, owner = Object.getPrototypeOf(owner)) {
|
|
276
|
+
if (depth2 > 100) reject("control admission prototype depth exceeded");
|
|
277
|
+
const descriptor = Object.getOwnPropertyDescriptor(owner, key);
|
|
278
|
+
if (!descriptor) continue;
|
|
279
|
+
if (!("value" in descriptor)) reject(`accessor control/data property: ${path}.${key}`);
|
|
280
|
+
return descriptor.value;
|
|
199
281
|
}
|
|
200
|
-
|
|
282
|
+
return void 0;
|
|
283
|
+
};
|
|
201
284
|
if (Array.isArray(value)) {
|
|
202
|
-
value.
|
|
285
|
+
if (value.length > 2e4) reject("control admission array exceeds structural limits");
|
|
286
|
+
for (let index = 0; index < value.length; index++) {
|
|
287
|
+
if (index in value) add(read(String(index)), slot, String(index));
|
|
288
|
+
}
|
|
203
289
|
continue;
|
|
204
290
|
}
|
|
205
291
|
if (slot === "data") {
|
|
206
292
|
if (!(0, import_utils.isPlainObject)(value)) continue;
|
|
207
|
-
|
|
293
|
+
add(read("$$sq"), "envelope", "$$sq");
|
|
294
|
+
for (const key of Object.keys(value)) if (key !== "$$sq") add(read(key), "data", key);
|
|
208
295
|
continue;
|
|
209
296
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
297
|
+
if (slot === "defaults") {
|
|
298
|
+
const keys2 = /* @__PURE__ */ new Set([...Object.keys(value), ...defaultControlBuckets]);
|
|
299
|
+
if (keys2.size > 2e4) reject("control admission defaults exceeds structural limits");
|
|
300
|
+
for (const key of keys2) if (key in record2) add(read(key), "envelope", key);
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
if (slot === "policies") {
|
|
304
|
+
for (const key of Object.keys(value)) add(read(key), "policy", key);
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
if (slot === "policy") {
|
|
308
|
+
for (const key of ["rows", "outputFields", "inputFields", "operation"]) add(read(key), "policy", key);
|
|
309
|
+
add(read("related"), "policies", "related");
|
|
310
|
+
add(read("filter"), "data", "filter");
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
for (const key of ["args", "options", "sqOptions"]) add(read(key), "envelope", key);
|
|
314
|
+
add(read("include"), "include", "include");
|
|
315
|
+
add(read("populate"), "populate", "populate");
|
|
316
|
+
add(read("authorization"), "policy", "authorization");
|
|
317
|
+
for (const key of ["filter", "match", "data"]) add(read(key), "data", key);
|
|
214
318
|
}
|
|
215
319
|
}
|
|
216
320
|
function assertHydrationDefaults(defaults2) {
|
|
@@ -244,11 +348,8 @@ function assertHydrationDefaults(defaults2) {
|
|
|
244
348
|
}
|
|
245
349
|
}
|
|
246
350
|
function assertPublicDefaults(defaults2) {
|
|
351
|
+
assertPublicControlAdmission(defaults2, "defaults");
|
|
247
352
|
assertHydrationDefaults(defaults2);
|
|
248
|
-
assertPublicAdmission(defaults2);
|
|
249
|
-
if (defaults2 && typeof defaults2 === "object") {
|
|
250
|
-
for (const value of Object.values(defaults2)) assertPublicAdmission(value);
|
|
251
|
-
}
|
|
252
353
|
}
|
|
253
354
|
var requestAuthorization = Object.freeze({ outputFields: Object.freeze({ mode: "request" }) });
|
|
254
355
|
|
|
@@ -1810,7 +1911,7 @@ var modelOverrides = (options) => {
|
|
|
1810
1911
|
([key, value]) => value !== void 0 || key === "operationAccess" || isPopulatePolicyKey(key)
|
|
1811
1912
|
)
|
|
1812
1913
|
);
|
|
1813
|
-
for (const key of
|
|
1914
|
+
for (const key of unsafeServerOptions) if (key in result) result[key] = result[key] === true;
|
|
1814
1915
|
return cloneOptionsSnapshot(result);
|
|
1815
1916
|
};
|
|
1816
1917
|
var defaultDataOptions = {
|
|
@@ -2171,7 +2272,9 @@ var AccessRuntime = class {
|
|
|
2171
2272
|
unsafeSkipListNestedDocumentSnapshotChecks: false,
|
|
2172
2273
|
unsafeSkipReadNestedDocumentSnapshotChecks: false,
|
|
2173
2274
|
unsafeSkipListInitialOutputSnapshotCopy: false,
|
|
2174
|
-
unsafeSkipReadInitialOutputSnapshotCopy: false
|
|
2275
|
+
unsafeSkipReadInitialOutputSnapshotCopy: false,
|
|
2276
|
+
unsafeUseListAuthorizationFastPath: false,
|
|
2277
|
+
unsafeUseReadAuthorizationFastPath: false
|
|
2175
2278
|
}).build();
|
|
2176
2279
|
this.modelOptions = {};
|
|
2177
2280
|
this.modelOptionOverrides = {};
|
|
@@ -2359,6 +2462,12 @@ var AccessRuntime = class {
|
|
|
2359
2462
|
}
|
|
2360
2463
|
setDefaultModelOption(key, value) {
|
|
2361
2464
|
const keyStr = String(key);
|
|
2465
|
+
if (keyStr === "defaults") assertPublicDefaults(value);
|
|
2466
|
+
else if (keyStr.startsWith("defaults.")) {
|
|
2467
|
+
const proposed = {};
|
|
2468
|
+
(0, import_utils13.set)(proposed, keyStr.slice("defaults.".length), value);
|
|
2469
|
+
assertPublicDefaults(proposed);
|
|
2470
|
+
}
|
|
2362
2471
|
const draft = new OptionsManager(
|
|
2363
2472
|
this.getDefaultModelOptions()
|
|
2364
2473
|
).build();
|
|
@@ -2383,7 +2492,7 @@ var AccessRuntime = class {
|
|
|
2383
2492
|
for (const key of populatePolicyKeys) delete inherited[key];
|
|
2384
2493
|
const effective = { ...defaultModelOptions, ...inherited, ...overrides, modelName };
|
|
2385
2494
|
effective.basePath = normalizeBasePath(modelName, effective.basePath);
|
|
2386
|
-
for (const key of
|
|
2495
|
+
for (const key of unsafeServerOptions) effective[key] = effective[key] === true;
|
|
2387
2496
|
refreshPermissionMetadata(effective);
|
|
2388
2497
|
return cloneOptionsSnapshot(effective);
|
|
2389
2498
|
}
|
|
@@ -2398,7 +2507,7 @@ var AccessRuntime = class {
|
|
|
2398
2507
|
}
|
|
2399
2508
|
publishDefaultModelOptions(options) {
|
|
2400
2509
|
const next = { ...options };
|
|
2401
|
-
for (const key of
|
|
2510
|
+
for (const key of unsafeServerOptions) if (key in next) next[key] = next[key] === true;
|
|
2402
2511
|
const defaults2 = cloneOptionsSnapshot(next);
|
|
2403
2512
|
const models = new Map(
|
|
2404
2513
|
Object.keys(this.modelOptions).map((name) => [name, this.resolveModelOptions(name, void 0, defaults2)])
|
|
@@ -2428,6 +2537,7 @@ var AccessRuntime = class {
|
|
|
2428
2537
|
deferSnapshotWarnings(publish) {
|
|
2429
2538
|
if (this.pendingSnapshotWarnings) return publish();
|
|
2430
2539
|
const copyModes = this.initialOutputCopyModes();
|
|
2540
|
+
const fastModes = this.authorizationFastPathModes();
|
|
2431
2541
|
const pending = [];
|
|
2432
2542
|
this.pendingSnapshotWarnings = pending;
|
|
2433
2543
|
let result;
|
|
@@ -2437,6 +2547,7 @@ var AccessRuntime = class {
|
|
|
2437
2547
|
this.pendingSnapshotWarnings = void 0;
|
|
2438
2548
|
}
|
|
2439
2549
|
const nextCopyModes = this.initialOutputCopyModes();
|
|
2550
|
+
const nextFastModes = this.authorizationFastPathModes();
|
|
2440
2551
|
for (const { modelName, key } of pending) this.warnSnapshotFlag(modelName, key);
|
|
2441
2552
|
for (const [modelName, modes] of nextCopyModes) {
|
|
2442
2553
|
for (const operation of ["List", "Read"]) {
|
|
@@ -2453,8 +2564,38 @@ var AccessRuntime = class {
|
|
|
2453
2564
|
}
|
|
2454
2565
|
}
|
|
2455
2566
|
}
|
|
2567
|
+
for (const [modelName, modes] of nextFastModes) {
|
|
2568
|
+
for (const origin of ["list", "read"]) {
|
|
2569
|
+
const captured = modes[origin];
|
|
2570
|
+
const previous = fastModes.get(modelName)?.[origin];
|
|
2571
|
+
if (captured.mode === "off" || captured.mode === previous?.mode && (captured.mode !== "dormant" || captured.prerequisites === previous.prerequisites))
|
|
2572
|
+
continue;
|
|
2573
|
+
const key = origin === "read" ? "unsafeUseReadAuthorizationFastPath" : "unsafeUseListAuthorizationFastPath";
|
|
2574
|
+
const missing = authorizationFastPathPrerequisites(origin).filter(
|
|
2575
|
+
(_, index) => !(captured.prerequisites & 1 << index)
|
|
2576
|
+
);
|
|
2577
|
+
try {
|
|
2578
|
+
this.getGlobalOption("logger")?.warn?.(
|
|
2579
|
+
captured.mode === "active" ? `UNSAFE: ${origin} authorization fast path active (${key}=true); eligible query rows borrow source/grant/context leaves and omit repeated snapshots, isolation and descendant graph checks. Borrowed source/grant mutation, stale decisions, descendant replacement, lost native normalization/validation observations and loss of full unvisited source shape/bounds can change authorization outcomes, including denial becoming allowance. Actual operation/row/field rules, document hooks/getters, request/work limits and cheap exact root authority remain; shallow-unproven rows retain compatible copies and graph checks. Restore ${key}=false after the temporary workaround.` : `UNSAFE: ${key} is dormant; requires ${missing.map((flag) => `${flag}=true`).join(", ")}. Original snapshot flag behavior remains unchanged. Restore ${key}=false if not intended.`,
|
|
2580
|
+
{ modelName }
|
|
2581
|
+
);
|
|
2582
|
+
} catch {
|
|
2583
|
+
}
|
|
2584
|
+
}
|
|
2585
|
+
}
|
|
2456
2586
|
return result;
|
|
2457
2587
|
}
|
|
2588
|
+
authorizationFastPathModes() {
|
|
2589
|
+
return new Map(
|
|
2590
|
+
Object.entries(this.modelOptions).map(([modelName, manager]) => {
|
|
2591
|
+
const options = manager.fetch();
|
|
2592
|
+
return [
|
|
2593
|
+
modelName,
|
|
2594
|
+
{ list: captureAuthorizationFastPath(options, "list"), read: captureAuthorizationFastPath(options, "read") }
|
|
2595
|
+
];
|
|
2596
|
+
})
|
|
2597
|
+
);
|
|
2598
|
+
}
|
|
2458
2599
|
initialOutputCopyModes() {
|
|
2459
2600
|
return new Map(
|
|
2460
2601
|
Object.entries(this.modelOptions).map(([modelName, options]) => {
|
package/advanced.mjs
CHANGED
|
@@ -64,6 +64,37 @@ var unsafeInitialOutputCopyOptions = [
|
|
|
64
64
|
"unsafeSkipReadInitialOutputSnapshotCopy"
|
|
65
65
|
];
|
|
66
66
|
var unsafeSnapshotOptions = [...unsafeSnapshotCheckOptions, ...unsafeInitialOutputCopyOptions];
|
|
67
|
+
var unsafeAuthorizationFastPathOptions = [
|
|
68
|
+
"unsafeUseListAuthorizationFastPath",
|
|
69
|
+
"unsafeUseReadAuthorizationFastPath"
|
|
70
|
+
];
|
|
71
|
+
var unsafeServerOptions = [...unsafeSnapshotOptions, ...unsafeAuthorizationFastPathOptions];
|
|
72
|
+
function authorizationFastPathPrerequisites(origin) {
|
|
73
|
+
const operation = origin === "read" ? "Read" : "List";
|
|
74
|
+
return [
|
|
75
|
+
`unsafeSkip${operation}DocumentSnapshotChecks`,
|
|
76
|
+
`unsafeSkip${operation}OutputSnapshotChecks`,
|
|
77
|
+
`unsafeSkip${operation}NestedDocumentSnapshotChecks`,
|
|
78
|
+
`unsafeSkip${operation}InitialOutputSnapshotCopy`
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
function captureAuthorizationFastPath(options, origin) {
|
|
82
|
+
const literalTrue = (key2) => {
|
|
83
|
+
const descriptor = Object.getOwnPropertyDescriptor(options, key2);
|
|
84
|
+
return !!descriptor && "value" in descriptor && descriptor.value === true;
|
|
85
|
+
};
|
|
86
|
+
const key = origin === "read" ? unsafeAuthorizationFastPathOptions[1] : unsafeAuthorizationFastPathOptions[0];
|
|
87
|
+
const requested = literalTrue(key);
|
|
88
|
+
const prerequisites = authorizationFastPathPrerequisites(origin).reduce(
|
|
89
|
+
(mask, key2, index) => mask | (literalTrue(key2) ? 1 << index : 0),
|
|
90
|
+
0
|
|
91
|
+
);
|
|
92
|
+
return Object.freeze({
|
|
93
|
+
origin,
|
|
94
|
+
mode: !requested ? "off" : prerequisites === 15 ? "active" : "dormant",
|
|
95
|
+
prerequisites
|
|
96
|
+
});
|
|
97
|
+
}
|
|
67
98
|
|
|
68
99
|
// src/validation/public-admission.ts
|
|
69
100
|
var privateControls = [
|
|
@@ -83,7 +114,7 @@ var privateControls = [
|
|
|
83
114
|
"skipParsing",
|
|
84
115
|
"skipAuthorization",
|
|
85
116
|
"alreadyAuthorized",
|
|
86
|
-
...
|
|
117
|
+
...unsafeServerOptions,
|
|
87
118
|
"operation"
|
|
88
119
|
];
|
|
89
120
|
var PublicAdmissionError = class extends JsonRouter.clientErrors.BadRequestError {
|
|
@@ -93,42 +124,115 @@ var PublicAdmissionError = class extends JsonRouter.clientErrors.BadRequestError
|
|
|
93
124
|
this.result = { success: false, kind: "error", code: "bad_request" /* BadRequest */, errors };
|
|
94
125
|
}
|
|
95
126
|
};
|
|
127
|
+
var defaultControlBuckets = [
|
|
128
|
+
"findOneArgs",
|
|
129
|
+
"findOneOptions",
|
|
130
|
+
"findByIdArgs",
|
|
131
|
+
"findByIdOptions",
|
|
132
|
+
"findArgs",
|
|
133
|
+
"findOptions",
|
|
134
|
+
"createArgs",
|
|
135
|
+
"createOptions",
|
|
136
|
+
"updateOneArgs",
|
|
137
|
+
"updateOneOptions",
|
|
138
|
+
"upsertOptions",
|
|
139
|
+
"updateByIdArgs",
|
|
140
|
+
"upsertArgs",
|
|
141
|
+
"updateByIdOptions",
|
|
142
|
+
"existsOptions",
|
|
143
|
+
"publicListArgs",
|
|
144
|
+
"publicListOptions",
|
|
145
|
+
"publicCreateArgs",
|
|
146
|
+
"publicCreateOptions",
|
|
147
|
+
"publicReadArgs",
|
|
148
|
+
"publicReadOptions",
|
|
149
|
+
"publicUpdateArgs",
|
|
150
|
+
"publicUpdateOptions"
|
|
151
|
+
];
|
|
96
152
|
function assertPublicAdmission(input, kind = "envelope") {
|
|
97
|
-
|
|
153
|
+
assertPublicControlAdmission(input, kind);
|
|
154
|
+
}
|
|
155
|
+
function assertPublicControlAdmission(input, kind) {
|
|
156
|
+
walkControlAdmission(
|
|
157
|
+
input,
|
|
158
|
+
kind,
|
|
159
|
+
(record2, path) => {
|
|
160
|
+
for (const key of privateControls) {
|
|
161
|
+
if (key in record2) {
|
|
162
|
+
throw new PublicAdmissionError(
|
|
163
|
+
unsafeServerOptions.includes(key) ? `Unsupported public control ${path}.${key}; this unsafe flag is server model configuration only` : `Unsupported public control ${path}.${key}; use explicit per-call internal service options for backend authorization`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
(detail) => {
|
|
169
|
+
throw new PublicAdmissionError(detail);
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
function walkControlAdmission(input, kind, check, reject) {
|
|
174
|
+
const pending = [{ value: input, kind, path: "request", depth: 0 }];
|
|
98
175
|
const seen = /* @__PURE__ */ new WeakMap();
|
|
176
|
+
let slots = 1;
|
|
99
177
|
while (pending.length) {
|
|
100
|
-
const { value, kind: slot, path } = pending.pop();
|
|
178
|
+
const { value, kind: slot, path, depth } = pending.pop();
|
|
101
179
|
if (!value || typeof value !== "object" && typeof value !== "function") continue;
|
|
102
180
|
const kinds = seen.get(value) ?? /* @__PURE__ */ new Set();
|
|
103
181
|
if (kinds.has(slot)) continue;
|
|
104
182
|
kinds.add(slot);
|
|
105
183
|
seen.set(value, kinds);
|
|
106
184
|
const add = (child, childKind, key) => {
|
|
107
|
-
|
|
185
|
+
if (child === void 0 || child === null) return;
|
|
186
|
+
if (++slots > 2e4 || depth >= 100) reject("control admission exceeds structural limits");
|
|
187
|
+
pending.push({ value: child, kind: childKind, path: `${path}.${key}`, depth: depth + 1 });
|
|
108
188
|
};
|
|
109
189
|
const record2 = value;
|
|
110
|
-
if (slot !== "data")
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
190
|
+
if (slot !== "data" && slot !== "policies") check(record2, path);
|
|
191
|
+
const read = (key) => {
|
|
192
|
+
let owner = value;
|
|
193
|
+
for (let depth2 = 0; owner; depth2++, owner = Object.getPrototypeOf(owner)) {
|
|
194
|
+
if (depth2 > 100) reject("control admission prototype depth exceeded");
|
|
195
|
+
const descriptor = Object.getOwnPropertyDescriptor(owner, key);
|
|
196
|
+
if (!descriptor) continue;
|
|
197
|
+
if (!("value" in descriptor)) reject(`accessor control/data property: ${path}.${key}`);
|
|
198
|
+
return descriptor.value;
|
|
117
199
|
}
|
|
118
|
-
|
|
200
|
+
return void 0;
|
|
201
|
+
};
|
|
119
202
|
if (Array.isArray(value)) {
|
|
120
|
-
value.
|
|
203
|
+
if (value.length > 2e4) reject("control admission array exceeds structural limits");
|
|
204
|
+
for (let index = 0; index < value.length; index++) {
|
|
205
|
+
if (index in value) add(read(String(index)), slot, String(index));
|
|
206
|
+
}
|
|
121
207
|
continue;
|
|
122
208
|
}
|
|
123
209
|
if (slot === "data") {
|
|
124
210
|
if (!isPlainObject(value)) continue;
|
|
125
|
-
|
|
211
|
+
add(read("$$sq"), "envelope", "$$sq");
|
|
212
|
+
for (const key of Object.keys(value)) if (key !== "$$sq") add(read(key), "data", key);
|
|
126
213
|
continue;
|
|
127
214
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
215
|
+
if (slot === "defaults") {
|
|
216
|
+
const keys2 = /* @__PURE__ */ new Set([...Object.keys(value), ...defaultControlBuckets]);
|
|
217
|
+
if (keys2.size > 2e4) reject("control admission defaults exceeds structural limits");
|
|
218
|
+
for (const key of keys2) if (key in record2) add(read(key), "envelope", key);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (slot === "policies") {
|
|
222
|
+
for (const key of Object.keys(value)) add(read(key), "policy", key);
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (slot === "policy") {
|
|
226
|
+
for (const key of ["rows", "outputFields", "inputFields", "operation"]) add(read(key), "policy", key);
|
|
227
|
+
add(read("related"), "policies", "related");
|
|
228
|
+
add(read("filter"), "data", "filter");
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
for (const key of ["args", "options", "sqOptions"]) add(read(key), "envelope", key);
|
|
232
|
+
add(read("include"), "include", "include");
|
|
233
|
+
add(read("populate"), "populate", "populate");
|
|
234
|
+
add(read("authorization"), "policy", "authorization");
|
|
235
|
+
for (const key of ["filter", "match", "data"]) add(read(key), "data", key);
|
|
132
236
|
}
|
|
133
237
|
}
|
|
134
238
|
function assertHydrationDefaults(defaults2) {
|
|
@@ -162,11 +266,8 @@ function assertHydrationDefaults(defaults2) {
|
|
|
162
266
|
}
|
|
163
267
|
}
|
|
164
268
|
function assertPublicDefaults(defaults2) {
|
|
269
|
+
assertPublicControlAdmission(defaults2, "defaults");
|
|
165
270
|
assertHydrationDefaults(defaults2);
|
|
166
|
-
assertPublicAdmission(defaults2);
|
|
167
|
-
if (defaults2 && typeof defaults2 === "object") {
|
|
168
|
-
for (const value of Object.values(defaults2)) assertPublicAdmission(value);
|
|
169
|
-
}
|
|
170
271
|
}
|
|
171
272
|
var requestAuthorization = Object.freeze({ outputFields: Object.freeze({ mode: "request" }) });
|
|
172
273
|
|
|
@@ -1741,7 +1842,7 @@ var modelOverrides = (options) => {
|
|
|
1741
1842
|
([key, value]) => value !== void 0 || key === "operationAccess" || isPopulatePolicyKey(key)
|
|
1742
1843
|
)
|
|
1743
1844
|
);
|
|
1744
|
-
for (const key of
|
|
1845
|
+
for (const key of unsafeServerOptions) if (key in result) result[key] = result[key] === true;
|
|
1745
1846
|
return cloneOptionsSnapshot(result);
|
|
1746
1847
|
};
|
|
1747
1848
|
var defaultDataOptions = {
|
|
@@ -2102,7 +2203,9 @@ var AccessRuntime = class {
|
|
|
2102
2203
|
unsafeSkipListNestedDocumentSnapshotChecks: false,
|
|
2103
2204
|
unsafeSkipReadNestedDocumentSnapshotChecks: false,
|
|
2104
2205
|
unsafeSkipListInitialOutputSnapshotCopy: false,
|
|
2105
|
-
unsafeSkipReadInitialOutputSnapshotCopy: false
|
|
2206
|
+
unsafeSkipReadInitialOutputSnapshotCopy: false,
|
|
2207
|
+
unsafeUseListAuthorizationFastPath: false,
|
|
2208
|
+
unsafeUseReadAuthorizationFastPath: false
|
|
2106
2209
|
}).build();
|
|
2107
2210
|
this.modelOptions = {};
|
|
2108
2211
|
this.modelOptionOverrides = {};
|
|
@@ -2290,6 +2393,12 @@ var AccessRuntime = class {
|
|
|
2290
2393
|
}
|
|
2291
2394
|
setDefaultModelOption(key, value) {
|
|
2292
2395
|
const keyStr = String(key);
|
|
2396
|
+
if (keyStr === "defaults") assertPublicDefaults(value);
|
|
2397
|
+
else if (keyStr.startsWith("defaults.")) {
|
|
2398
|
+
const proposed = {};
|
|
2399
|
+
set3(proposed, keyStr.slice("defaults.".length), value);
|
|
2400
|
+
assertPublicDefaults(proposed);
|
|
2401
|
+
}
|
|
2293
2402
|
const draft = new OptionsManager(
|
|
2294
2403
|
this.getDefaultModelOptions()
|
|
2295
2404
|
).build();
|
|
@@ -2314,7 +2423,7 @@ var AccessRuntime = class {
|
|
|
2314
2423
|
for (const key of populatePolicyKeys) delete inherited[key];
|
|
2315
2424
|
const effective = { ...defaultModelOptions, ...inherited, ...overrides, modelName };
|
|
2316
2425
|
effective.basePath = normalizeBasePath(modelName, effective.basePath);
|
|
2317
|
-
for (const key of
|
|
2426
|
+
for (const key of unsafeServerOptions) effective[key] = effective[key] === true;
|
|
2318
2427
|
refreshPermissionMetadata(effective);
|
|
2319
2428
|
return cloneOptionsSnapshot(effective);
|
|
2320
2429
|
}
|
|
@@ -2329,7 +2438,7 @@ var AccessRuntime = class {
|
|
|
2329
2438
|
}
|
|
2330
2439
|
publishDefaultModelOptions(options) {
|
|
2331
2440
|
const next = { ...options };
|
|
2332
|
-
for (const key of
|
|
2441
|
+
for (const key of unsafeServerOptions) if (key in next) next[key] = next[key] === true;
|
|
2333
2442
|
const defaults2 = cloneOptionsSnapshot(next);
|
|
2334
2443
|
const models = new Map(
|
|
2335
2444
|
Object.keys(this.modelOptions).map((name) => [name, this.resolveModelOptions(name, void 0, defaults2)])
|
|
@@ -2359,6 +2468,7 @@ var AccessRuntime = class {
|
|
|
2359
2468
|
deferSnapshotWarnings(publish) {
|
|
2360
2469
|
if (this.pendingSnapshotWarnings) return publish();
|
|
2361
2470
|
const copyModes = this.initialOutputCopyModes();
|
|
2471
|
+
const fastModes = this.authorizationFastPathModes();
|
|
2362
2472
|
const pending = [];
|
|
2363
2473
|
this.pendingSnapshotWarnings = pending;
|
|
2364
2474
|
let result;
|
|
@@ -2368,6 +2478,7 @@ var AccessRuntime = class {
|
|
|
2368
2478
|
this.pendingSnapshotWarnings = void 0;
|
|
2369
2479
|
}
|
|
2370
2480
|
const nextCopyModes = this.initialOutputCopyModes();
|
|
2481
|
+
const nextFastModes = this.authorizationFastPathModes();
|
|
2371
2482
|
for (const { modelName, key } of pending) this.warnSnapshotFlag(modelName, key);
|
|
2372
2483
|
for (const [modelName, modes] of nextCopyModes) {
|
|
2373
2484
|
for (const operation of ["List", "Read"]) {
|
|
@@ -2384,8 +2495,38 @@ var AccessRuntime = class {
|
|
|
2384
2495
|
}
|
|
2385
2496
|
}
|
|
2386
2497
|
}
|
|
2498
|
+
for (const [modelName, modes] of nextFastModes) {
|
|
2499
|
+
for (const origin of ["list", "read"]) {
|
|
2500
|
+
const captured = modes[origin];
|
|
2501
|
+
const previous = fastModes.get(modelName)?.[origin];
|
|
2502
|
+
if (captured.mode === "off" || captured.mode === previous?.mode && (captured.mode !== "dormant" || captured.prerequisites === previous.prerequisites))
|
|
2503
|
+
continue;
|
|
2504
|
+
const key = origin === "read" ? "unsafeUseReadAuthorizationFastPath" : "unsafeUseListAuthorizationFastPath";
|
|
2505
|
+
const missing = authorizationFastPathPrerequisites(origin).filter(
|
|
2506
|
+
(_, index) => !(captured.prerequisites & 1 << index)
|
|
2507
|
+
);
|
|
2508
|
+
try {
|
|
2509
|
+
this.getGlobalOption("logger")?.warn?.(
|
|
2510
|
+
captured.mode === "active" ? `UNSAFE: ${origin} authorization fast path active (${key}=true); eligible query rows borrow source/grant/context leaves and omit repeated snapshots, isolation and descendant graph checks. Borrowed source/grant mutation, stale decisions, descendant replacement, lost native normalization/validation observations and loss of full unvisited source shape/bounds can change authorization outcomes, including denial becoming allowance. Actual operation/row/field rules, document hooks/getters, request/work limits and cheap exact root authority remain; shallow-unproven rows retain compatible copies and graph checks. Restore ${key}=false after the temporary workaround.` : `UNSAFE: ${key} is dormant; requires ${missing.map((flag) => `${flag}=true`).join(", ")}. Original snapshot flag behavior remains unchanged. Restore ${key}=false if not intended.`,
|
|
2511
|
+
{ modelName }
|
|
2512
|
+
);
|
|
2513
|
+
} catch {
|
|
2514
|
+
}
|
|
2515
|
+
}
|
|
2516
|
+
}
|
|
2387
2517
|
return result;
|
|
2388
2518
|
}
|
|
2519
|
+
authorizationFastPathModes() {
|
|
2520
|
+
return new Map(
|
|
2521
|
+
Object.entries(this.modelOptions).map(([modelName, manager]) => {
|
|
2522
|
+
const options = manager.fetch();
|
|
2523
|
+
return [
|
|
2524
|
+
modelName,
|
|
2525
|
+
{ list: captureAuthorizationFastPath(options, "list"), read: captureAuthorizationFastPath(options, "read") }
|
|
2526
|
+
];
|
|
2527
|
+
})
|
|
2528
|
+
);
|
|
2529
|
+
}
|
|
2389
2530
|
initialOutputCopyModes() {
|
|
2390
2531
|
return new Map(
|
|
2391
2532
|
Object.entries(this.modelOptions).map(([modelName, options]) => {
|
package/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose__default, { Schema } from 'mongoose';
|
|
2
2
|
import { Response, NextFunction, RequestHandler, Router } from 'express';
|
|
3
|
-
import { A as AccessRouterBaseRequest, aq as GuardHook, aT as ModelRequest, dR as AccessRuntime, _ as DataRouterOptions, Y as DataRequest, dS as DataService, aa as ExtendedDataRouterOptions, af as Filter, bo as Projection, cv as Sort, bk as Populate, aU as ModelRouterOptions, dT as Service, dU as PublicService, b3 as ModelVirtualRecordAccess, aZ as ModelVirtualDescriptor, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, ac as ExtendedModelRouterOptions, ds as Validation, cf as RootRouterOptions, dV as OpenApiRouterOptions, dW as OpenApiRegistryOptions, dX as OpenApiRouteDescriptor, dY as OpenApiDocumentOptions, dZ as OpenApiParameter, d_ as OpenApiSchema, d$ as OpenApiResponses, ao as GlobalOptions, a2 as DefaultModelRouterOptions, ab as ExtendedDefaultModelRouterOptions } from './parsers-
|
|
4
|
-
export { e0 as AccessRouterPermissionMap, e1 as AccessRouterPermissions, c as AccessRouterRequest, d as AccessRouterRequestExtensions, l as AjvErrorObjectLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, s as AuthorizedListResult, t as AuthorizedSingleResult, H as CreateAuthorization, N as DataFieldOptions, a7 as DocumentAuthorization, ad as FieldAuthorization, ae as FieldOperationAccess, ap as GlobalPermissionValue, ar as HydrationMode, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aG as MaybePromise, aH as ModelBaseFilterHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aM as ModelDocumentHook, aN as ModelHook, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, a_ as ModelVirtualDoc, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, e2 as OpenApiMethod, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, bg as PairedRouteAccess, bj as PermissionSchema, e3 as Permissions, bm as PopulatePlanningOptions, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bJ as RelatedAuthorization, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cG as SubOperationAccess, cK as SubRouteGuardOptions, cN as SubdocumentCreateAuthorization, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, e4 as defaultRuntime, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod } from './parsers-
|
|
3
|
+
import { A as AccessRouterBaseRequest, aq as GuardHook, aT as ModelRequest, dR as AccessRuntime, _ as DataRouterOptions, Y as DataRequest, dS as DataService, aa as ExtendedDataRouterOptions, af as Filter, bo as Projection, cv as Sort, bk as Populate, aU as ModelRouterOptions, dT as Service, dU as PublicService, b3 as ModelVirtualRecordAccess, aZ as ModelVirtualDescriptor, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, ac as ExtendedModelRouterOptions, ds as Validation, cf as RootRouterOptions, dV as OpenApiRouterOptions, dW as OpenApiRegistryOptions, dX as OpenApiRouteDescriptor, dY as OpenApiDocumentOptions, dZ as OpenApiParameter, d_ as OpenApiSchema, d$ as OpenApiResponses, ao as GlobalOptions, a2 as DefaultModelRouterOptions, ab as ExtendedDefaultModelRouterOptions } from './parsers-h_oU4bB0.mjs';
|
|
4
|
+
export { e0 as AccessRouterPermissionMap, e1 as AccessRouterPermissions, c as AccessRouterRequest, d as AccessRouterRequestExtensions, l as AjvErrorObjectLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, s as AuthorizedListResult, t as AuthorizedSingleResult, H as CreateAuthorization, N as DataFieldOptions, a7 as DocumentAuthorization, ad as FieldAuthorization, ae as FieldOperationAccess, ap as GlobalPermissionValue, ar as HydrationMode, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aG as MaybePromise, aH as ModelBaseFilterHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aM as ModelDocumentHook, aN as ModelHook, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, a_ as ModelVirtualDoc, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, e2 as OpenApiMethod, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, bg as PairedRouteAccess, bj as PermissionSchema, e3 as Permissions, bm as PopulatePlanningOptions, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bJ as RelatedAuthorization, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cG as SubOperationAccess, cK as SubRouteGuardOptions, cN as SubdocumentCreateAuthorization, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, e4 as defaultRuntime, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod } from './parsers-h_oU4bB0.mjs';
|
|
5
5
|
import JsonRouter from '@web-ts-toolkit/express-json-router';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose__default, { Schema } from 'mongoose';
|
|
2
2
|
import { Response, NextFunction, RequestHandler, Router } from 'express';
|
|
3
|
-
import { A as AccessRouterBaseRequest, aq as GuardHook, aT as ModelRequest, dR as AccessRuntime, _ as DataRouterOptions, Y as DataRequest, dS as DataService, aa as ExtendedDataRouterOptions, af as Filter, bo as Projection, cv as Sort, bk as Populate, aU as ModelRouterOptions, dT as Service, dU as PublicService, b3 as ModelVirtualRecordAccess, aZ as ModelVirtualDescriptor, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, ac as ExtendedModelRouterOptions, ds as Validation, cf as RootRouterOptions, dV as OpenApiRouterOptions, dW as OpenApiRegistryOptions, dX as OpenApiRouteDescriptor, dY as OpenApiDocumentOptions, dZ as OpenApiParameter, d_ as OpenApiSchema, d$ as OpenApiResponses, ao as GlobalOptions, a2 as DefaultModelRouterOptions, ab as ExtendedDefaultModelRouterOptions } from './parsers-
|
|
4
|
-
export { e0 as AccessRouterPermissionMap, e1 as AccessRouterPermissions, c as AccessRouterRequest, d as AccessRouterRequestExtensions, l as AjvErrorObjectLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, s as AuthorizedListResult, t as AuthorizedSingleResult, H as CreateAuthorization, N as DataFieldOptions, a7 as DocumentAuthorization, ad as FieldAuthorization, ae as FieldOperationAccess, ap as GlobalPermissionValue, ar as HydrationMode, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aG as MaybePromise, aH as ModelBaseFilterHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aM as ModelDocumentHook, aN as ModelHook, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, a_ as ModelVirtualDoc, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, e2 as OpenApiMethod, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, bg as PairedRouteAccess, bj as PermissionSchema, e3 as Permissions, bm as PopulatePlanningOptions, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bJ as RelatedAuthorization, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cG as SubOperationAccess, cK as SubRouteGuardOptions, cN as SubdocumentCreateAuthorization, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, e4 as defaultRuntime, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod } from './parsers-
|
|
3
|
+
import { A as AccessRouterBaseRequest, aq as GuardHook, aT as ModelRequest, dR as AccessRuntime, _ as DataRouterOptions, Y as DataRequest, dS as DataService, aa as ExtendedDataRouterOptions, af as Filter, bo as Projection, cv as Sort, bk as Populate, aU as ModelRouterOptions, dT as Service, dU as PublicService, b3 as ModelVirtualRecordAccess, aZ as ModelVirtualDescriptor, a$ as ModelVirtualGetter, b0 as ModelVirtualLeaf, ac as ExtendedModelRouterOptions, ds as Validation, cf as RootRouterOptions, dV as OpenApiRouterOptions, dW as OpenApiRegistryOptions, dX as OpenApiRouteDescriptor, dY as OpenApiDocumentOptions, dZ as OpenApiParameter, d_ as OpenApiSchema, d$ as OpenApiResponses, ao as GlobalOptions, a2 as DefaultModelRouterOptions, ab as ExtendedDefaultModelRouterOptions } from './parsers-h_oU4bB0.js';
|
|
4
|
+
export { e0 as AccessRouterPermissionMap, e1 as AccessRouterPermissions, c as AccessRouterRequest, d as AccessRouterRequestExtensions, l as AjvErrorObjectLike, n as AjvValidatorLike, o as AllowedOutputFieldOptions, p as ArkTypeErrorsLike, q as ArkTypeLike, s as AuthorizedListResult, t as AuthorizedSingleResult, H as CreateAuthorization, N as DataFieldOptions, a7 as DocumentAuthorization, ad as FieldAuthorization, ae as FieldOperationAccess, ap as GlobalPermissionValue, ar as HydrationMode, au as InputFieldAuthorization, av as InputFieldPath, aw as IoTsContextEntryLike, ax as IoTsDecodeErrorLike, ay as IoTsDecoderLike, az as JoiSchemaLike, aA as JoiValidationErrorDetailLike, aG as MaybePromise, aH as ModelBaseFilterHook, aJ as ModelDeleteHook, aK as ModelDocPermissionsHook, aM as ModelDocumentHook, aN as ModelHook, aP as ModelHydrationOptions, aQ as ModelIdentifierHook, aR as ModelListHook, aS as ModelOverrideFilterHook, aV as ModelValidateHook, aW as ModelVirtualAccess, aX as ModelVirtualAccessRecord, aY as ModelVirtualContext, a_ as ModelVirtualDoc, b1 as ModelVirtualPopulateDependency, b2 as ModelVirtualPopulateInputs, b4 as ModelVirtuals, b5 as MutationAuthorization, b6 as NewArgs, b7 as NewOptions, e2 as OpenApiMethod, b8 as OperationAccess, b9 as OperationAuthorization, ba as OutputAuthorization, bb as OutputFieldOptions, bc as OutputFieldPath, bd as OutputPlanningOptions, bg as PairedRouteAccess, bj as PermissionSchema, e3 as Permissions, bm as PopulatePlanningOptions, bA as PublicSubdocumentCreateOptions, bB as PublicSubdocumentListOptions, bC as PublicSubdocumentMutationOptions, bD as PublicSubdocumentReadOptions, bJ as RelatedAuthorization, bL as RequestSchemaAdapter, bM as RequestSchemaFailure, bN as RequestSchemaIssue, bO as RequestSchemaLike, bP as RequestSchemaOptions, bQ as RequestSchemaResult, bR as RequestSchemaSuccess, bS as RequestSchemaValidator, ci as RouteBaseAccess, cj as RouteGuardAccess, ck as RouteVariant, cl as RouteVariantAccess, cm as RowAuthorization, cq as ServiceAuthorization, cr as ServiceOutputContext, cs as ServiceOutputDecorator, cx as StandardSchemaFailure, cy as StandardSchemaInferOutput, cz as StandardSchemaIssue, cA as StandardSchemaPathSegment, cB as StandardSchemaResult, cC as StandardSchemaSuccess, cD as StandardSchemaV1, cG as SubOperationAccess, cK as SubRouteGuardOptions, cN as SubdocumentCreateAuthorization, cP as SubdocumentCreateOptions, cQ as SubdocumentCreateVisibilityAuthorization, cR as SubdocumentDeleteAuthorization, cS as SubdocumentDeleteOptions, cT as SubdocumentGateAuthorization, cV as SubdocumentInputAuthorization, cW as SubdocumentListOptions, cX as SubdocumentModel, cY as SubdocumentMutationAuthorization, cZ as SubdocumentName, c_ as SubdocumentOutputAuthorization, d1 as SubdocumentReadAuthorization, d2 as SubdocumentReadOptions, d4 as SubdocumentUpdateOptions, d5 as SubdocumentVirtuals, d6 as SubdocumentVisibilityAuthorization, d7 as SuperstructFailureLike, d8 as SuperstructValidateLike, dl as ValibotIssueLike, dm as ValibotPathItemLike, dn as ValibotSafeParseLike, dp as ValibotSafeParseResult, du as VineValidationErrorLike, dv as VineValidationMessageLike, dw as VineValidatorLike, dx as VirtualSubModel, dy as WithVirtuals, dz as YupSchemaLike, dA as YupValidationErrorLike, e4 as defaultRuntime, dB as defineRequestSchema, dC as fromAjv, dD as fromArkType, dE as fromIoTs, dF as fromJoi, dG as fromStandardSchema, dH as fromSuperstruct, dI as fromValibot, dJ as fromVine, dK as fromYup, dL as fromZod } from './parsers-h_oU4bB0.js';
|
|
5
5
|
import JsonRouter from '@web-ts-toolkit/express-json-router';
|
|
6
6
|
import 'zod';
|
|
7
7
|
|