@stacksjs/orm 0.73.3 → 0.74.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/dist/auto-crud.d.ts +33 -0
- package/dist/index.js +12 -25
- package/dist/routes.js +1 -1
- package/package.json +30 -4
package/dist/auto-crud.d.ts
CHANGED
|
@@ -232,6 +232,34 @@ export declare function buildIndexMeta(url: URL, page: number, perPage: number,
|
|
|
232
232
|
* solely in `buildIndexMeta`.
|
|
233
233
|
*/
|
|
234
234
|
export declare function buildIndexPaginator(url: URL, page: number, perPage: number, rowCount: number, hasMore: boolean, total?: number): IndexPaginator;
|
|
235
|
+
/**
|
|
236
|
+
* Resolve the row-scoping policy from config, with an env override.
|
|
237
|
+
*
|
|
238
|
+
* `'warn'` is the default because anything else is a breaking change to
|
|
239
|
+
* published behaviour: `'deny'` stops registering `store` / `update` /
|
|
240
|
+
* `destroy` for every model that declares no ownership, which in this
|
|
241
|
+
* framework's own model set is 62 of the 82 models that use the trait -
|
|
242
|
+
* `User` and `Team` among them.
|
|
243
|
+
*
|
|
244
|
+
* The env override exists so CI can run the strict posture without editing
|
|
245
|
+
* config, which is how an app finds out what it would lose before committing
|
|
246
|
+
* to it. An unrecognised value falls back to the default rather than throwing:
|
|
247
|
+
* a typo in a security setting should not take the API down, and the boot
|
|
248
|
+
* warning still names every unscoped model either way.
|
|
249
|
+
*/
|
|
250
|
+
export declare function resolveRowScopingPolicy(configured: unknown, envOverride?: string | null): ApiRowScopingPolicy;
|
|
251
|
+
/**
|
|
252
|
+
* The one-line-per-boot report about models publishing unscoped mutating routes.
|
|
253
|
+
*
|
|
254
|
+
* Aggregated deliberately. The sibling warning about public reads was demoted
|
|
255
|
+
* to `debug` because 15 lines on every boot about intended behaviour is how a
|
|
256
|
+
* warning stops being read; 62 lines would be worse. One line that names the
|
|
257
|
+
* count, the models and the two ways to fix it stays readable and stays
|
|
258
|
+
* actionable.
|
|
259
|
+
*
|
|
260
|
+
* Returns null when there is nothing to report, so the caller logs nothing.
|
|
261
|
+
*/
|
|
262
|
+
export declare function describeUnscopedMutatingModels(modelNames: readonly string[], policy: ApiRowScopingPolicy): string | null;
|
|
235
263
|
/**
|
|
236
264
|
* Columns every auto-CRUD table carries regardless of declared attributes.
|
|
237
265
|
* Members of the read allowlist (sort/filter) alongside the model's own
|
|
@@ -363,3 +391,8 @@ export declare interface IndexPaginator {
|
|
|
363
391
|
*/
|
|
364
392
|
export type WriteValidationResult = | { valid: true }
|
|
365
393
|
| { valid: false, errors: Record<string, string[]> }
|
|
394
|
+
/**
|
|
395
|
+
* What to do about a model whose generated mutating routes have no row-level
|
|
396
|
+
* scoping. See `ApiSecurityOptions` in @stacksjs/types for the full reasoning.
|
|
397
|
+
*/
|
|
398
|
+
export type ApiRowScopingPolicy = 'warn' | 'deny';
|