@stacksjs/orm 0.72.62 → 0.72.64
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 +26 -9
- package/dist/index.js +14 -14
- package/dist/routes.js +1 -1
- package/package.json +4 -4
package/dist/auto-crud.d.ts
CHANGED
|
@@ -159,17 +159,17 @@ declare function safeJSONOrEmpty(_s: string): unknown;
|
|
|
159
159
|
export declare function applyCasts(record: Record<string, any> | null | undefined, casts: Record<string, string | { get: (v: unknown) => unknown, set: (v: unknown) => unknown }> | null | undefined, direction: 'get' | 'set'): any;
|
|
160
160
|
export declare function validateWriteBody(data: Record<string, any>, model: any, hook: 'creating' | 'updating'): WriteValidationResult;
|
|
161
161
|
/**
|
|
162
|
-
*
|
|
162
|
+
* The already-registered route that would shadow a generated `method` + `path`,
|
|
163
|
+
* or undefined when the generated route is free to register.
|
|
163
164
|
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
* The parameter's NAME is the app's business. The shape is what decides whether
|
|
171
|
-
* this URL is already claimed.
|
|
165
|
+
* Pure, and separate from the logging wrapper in `../routes.ts`, so the rule can
|
|
166
|
+
* be tested without booting a router. The rule itself is the whole of
|
|
167
|
+
* stacksjs/stacks#2364: match on SHAPE, because a hand-written
|
|
168
|
+
* `/api/sites/{siteId}` and a generated `/api/sites/{id}` address the same URLs
|
|
169
|
+
* and a literal comparison sees two different strings, registers both, and lets
|
|
170
|
+
* the generated handler answer without the hand-written one's authorization.
|
|
172
171
|
*/
|
|
172
|
+
export declare function findShadowingRoute<T extends RegisteredRouteLike>(routes: readonly T[], method: string, path: string): T | undefined;
|
|
173
173
|
export declare function routeShape(path: string): string;
|
|
174
174
|
/**
|
|
175
175
|
* Resolve middleware lists for a model's `useApi` trait value (which may be
|
|
@@ -284,6 +284,23 @@ export declare const INDEX_DEFAULT_PER_PAGE: 15;
|
|
|
284
284
|
// Upper bound on ?per_page= so a single request can't ask for an
|
|
285
285
|
// unbounded page and exhaust memory.
|
|
286
286
|
export declare const INDEX_MAX_PER_PAGE: 100;
|
|
287
|
+
/**
|
|
288
|
+
* A route path with every parameter name flattened to `{}`.
|
|
289
|
+
*
|
|
290
|
+
* The "user routes win" guard compared paths literally, so an app's own
|
|
291
|
+
* `/api/sites/{siteId}` did not suppress the ORM's `/api/sites/{id}` — the two
|
|
292
|
+
* strings differ, so BOTH were registered and the ORM copy carried none of the
|
|
293
|
+
* app's authorization. The app had declared the endpoint and still got a second,
|
|
294
|
+
* unguarded one it never wrote (stacksjs/stacks#2224).
|
|
295
|
+
*
|
|
296
|
+
* The parameter's NAME is the app's business. The shape is what decides whether
|
|
297
|
+
* this URL is already claimed.
|
|
298
|
+
*/
|
|
299
|
+
/** The subset of a registered route this matching needs. */
|
|
300
|
+
export declare interface RegisteredRouteLike {
|
|
301
|
+
method?: string
|
|
302
|
+
path?: unknown
|
|
303
|
+
}
|
|
287
304
|
/**
|
|
288
305
|
* Pagination `meta` for the auto-CRUD index envelope (`{ data, meta }`).
|
|
289
306
|
*
|