prisma-generator-express 1.59.0 → 1.61.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 +150 -14
- package/dist/client/encodeQueryParams.js +19 -23
- package/dist/client/encodeQueryParams.js.map +1 -1
- package/dist/copy/operationDefinitions.d.ts +37 -0
- package/dist/copy/operationDefinitions.js +412 -0
- package/dist/copy/operationDefinitions.js.map +1 -0
- package/dist/generators/generateFastifyHandler.js +10 -41
- package/dist/generators/generateFastifyHandler.js.map +1 -1
- package/dist/generators/generateHonoHandler.js +10 -41
- package/dist/generators/generateHonoHandler.js.map +1 -1
- package/dist/generators/generateModelMetadata.d.ts +8 -0
- package/dist/generators/generateModelMetadata.js +77 -0
- package/dist/generators/generateModelMetadata.js.map +1 -0
- package/dist/generators/generateOperationCore.js +20 -30
- package/dist/generators/generateOperationCore.js.map +1 -1
- package/dist/generators/generateQueryBuilderHelper.js +1 -1
- package/dist/generators/generateQueryBuilderHelper.js.map +1 -1
- package/dist/generators/generateRouteConfigType.js +11 -57
- package/dist/generators/generateRouteConfigType.js.map +1 -1
- package/dist/generators/generateRouter.js +64 -177
- package/dist/generators/generateRouter.js.map +1 -1
- package/dist/generators/generateRouterFastify.js +59 -169
- package/dist/generators/generateRouterFastify.js.map +1 -1
- package/dist/generators/generateRouterHono.js +52 -152
- package/dist/generators/generateRouterHono.js.map +1 -1
- package/dist/generators/generateUnifiedHandler.js +7 -30
- package/dist/generators/generateUnifiedHandler.js.map +1 -1
- package/dist/generators/generateUnifiedScalarUI.js +9 -74
- package/dist/generators/generateUnifiedScalarUI.js.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/copyFiles.js +7 -0
- package/dist/utils/copyFiles.js.map +1 -1
- package/dist/utils/writeFileSafely.js +5 -12
- package/dist/utils/writeFileSafely.js.map +1 -1
- package/package.json +12 -2
- package/src/client/encodeQueryParams.ts +23 -36
- package/src/copy/autoIncludePlanner.ts +14 -23
- package/src/copy/autoIncludePlannerGuarded.ts +477 -0
- package/src/copy/autoIncludeRuntime.ts +269 -261
- package/src/copy/autoIncludeRuntimeGuarded.ts +379 -0
- package/src/copy/buildModelOpenApi.ts +248 -628
- package/src/copy/concurrency.ts +20 -0
- package/src/copy/docsRenderer.ts +63 -333
- package/src/copy/errorMapper.ts +126 -0
- package/src/copy/guardHelpers.ts +56 -0
- package/src/copy/materializedCount.ts +68 -0
- package/src/copy/materializedRouter.ts +33 -29
- package/src/copy/operationDefinitions.ts +359 -35
- package/src/copy/operationRuntime.ts +11 -605
- package/src/copy/pagination.ts +151 -0
- package/src/copy/scalarTypes.ts +2 -0
- package/src/copy/sse.ts +296 -0
- package/src/generators/generateFastifyHandler.ts +13 -47
- package/src/generators/generateHonoHandler.ts +13 -47
- package/src/generators/generateModelMetadata.ts +92 -0
- package/src/generators/generateOperationCore.ts +19 -32
- package/src/generators/generateQueryBuilderHelper.ts +1 -1
- package/src/generators/generateRouteConfigType.ts +9 -60
- package/src/generators/generateRouter.ts +88 -180
- package/src/generators/generateRouterFastify.ts +65 -172
- package/src/generators/generateRouterHono.ts +58 -155
- package/src/generators/generateUnifiedHandler.ts +8 -33
- package/src/generators/generateUnifiedScalarUI.ts +9 -91
- package/src/index.ts +13 -1
- package/src/utils/copyFiles.ts +7 -0
- package/src/utils/writeFileSafely.ts +5 -11
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Running `npx prisma generate` produces:
|
|
|
14
14
|
- Per-route and per-endpoint pagination config, including optional materialized-view count sources
|
|
15
15
|
- Router generator with middleware support (before/after hooks per operation)
|
|
16
16
|
- POST read endpoints for all read operations (for complex queries exceeding URL length limits)
|
|
17
|
-
- Express-only progressive read streaming over Server-Sent Events (SSE), using manual stages or auto-include splitting for supported relation reads, including deep `findMany` / `findManyPaginated` auto-include paths
|
|
17
|
+
- Express-only progressive read streaming over Server-Sent Events (SSE), using manual stages or auto-include splitting for supported relation reads, including unguarded deep `findMany` / `findManyPaginated` auto-include paths and guarded single-record auto-include paths
|
|
18
18
|
- Express-only standalone materialized view router for read-only access to registered PostgreSQL materialized views
|
|
19
19
|
- OpenAPI 3.1 spec (JSON and YAML endpoints registered automatically per router)
|
|
20
20
|
- Documentation helpers for contract view and Scalar UI (require manual mounting)
|
|
@@ -80,7 +80,7 @@ Some operations require newer versions:
|
|
|
80
80
|
|
|
81
81
|
The Hono target v1 is tested on Node.js runtimes only. See [Cloudflare Workers and edge runtimes](#cloudflare-workers-and-edge-runtimes).
|
|
82
82
|
|
|
83
|
-
Progressive Endpoint Composition over Server-Sent Events is currently supported by the Express target only. Express supports both manual staged streaming and auto-include streaming for supported relation reads
|
|
83
|
+
Progressive Endpoint Composition over Server-Sent Events is currently supported by the Express target only. Express supports both manual staged streaming and auto-include streaming for supported relation reads. Unguarded auto-include supports single-record reads and deep `findMany` / `findManyPaginated` reads within the configured planner limits. Guarded auto-include supports selected single-record read shapes while keeping every root and relation-stage query inside prisma-guard. Fastify and Hono continue to support normal JSON read and write routes.
|
|
84
84
|
|
|
85
85
|
### Database provider support
|
|
86
86
|
|
|
@@ -589,6 +589,8 @@ The downstream handler reads these values (`res.locals.guardShape`, `request.gua
|
|
|
589
589
|
|
|
590
590
|
When `shape` is absent, the handler calls Prisma directly with no guard enforcement.
|
|
591
591
|
|
|
592
|
+
For Express auto-include SSE on supported single-record reads, the router can also resolve the guard shape before planning the stream. It still executes the root query and every relation-stage query through prisma-guard. See [Guarded auto-include mode](#guarded-auto-include-mode).
|
|
593
|
+
|
|
592
594
|
Generated route config types treat `shape` as a named shape map. Use `default` for the normal single-shape case, and add other keys only when you need caller-based variants. The runtime still passes the map to `prisma-guard`; the `default` variant is selected when no caller is provided or no variant matches.
|
|
593
595
|
|
|
594
596
|
### Default shape per operation
|
|
@@ -1670,7 +1672,7 @@ Manual progressive SSE can be configured on Express GET read operations only:
|
|
|
1670
1672
|
- `aggregate`
|
|
1671
1673
|
- `groupBy`
|
|
1672
1674
|
|
|
1673
|
-
Auto-include progressive SSE supports these Express GET read operations:
|
|
1675
|
+
Auto-include progressive SSE supports these Express GET read operations when no guard shape is attached:
|
|
1674
1676
|
|
|
1675
1677
|
- `findUnique`
|
|
1676
1678
|
- `findUniqueOrThrow`
|
|
@@ -1679,7 +1681,16 @@ Auto-include progressive SSE supports these Express GET read operations:
|
|
|
1679
1681
|
- `findMany`
|
|
1680
1682
|
- `findManyPaginated`
|
|
1681
1683
|
|
|
1682
|
-
`findMany` and `findManyPaginated` support deep relation loading by flattening parent rows at each relation path, with fallback cases listed in [Auto-include behavior and limits](#auto-include-behavior-and-limits).
|
|
1684
|
+
Unguarded `findMany` and `findManyPaginated` support deep relation loading by flattening parent rows at each relation path, with fallback cases listed in [Auto-include behavior and limits](#auto-include-behavior-and-limits).
|
|
1685
|
+
|
|
1686
|
+
When a prisma-guard shape is attached, auto-include supports these single-record read operations:
|
|
1687
|
+
|
|
1688
|
+
- `findUnique`
|
|
1689
|
+
- `findUniqueOrThrow`
|
|
1690
|
+
- `findFirst`
|
|
1691
|
+
- `findFirstOrThrow`
|
|
1692
|
+
|
|
1693
|
+
Guarded `findMany` and `findManyPaginated` continue to use the configured fallback behavior. Normal guarded JSON reads are not affected.
|
|
1683
1694
|
|
|
1684
1695
|
If auto-include is configured on an unsupported operation, the router either falls back to single-result SSE or sends an SSE error depending on `fallback`.
|
|
1685
1696
|
|
|
@@ -2143,13 +2154,109 @@ Example deep event sequence:
|
|
|
2143
2154
|
```
|
|
2144
2155
|
|
|
2145
2156
|
|
|
2157
|
+
|
|
2158
|
+
### Guarded auto-include mode
|
|
2159
|
+
|
|
2160
|
+
Auto-include also works with prisma-guard on supported single-record Express reads.
|
|
2161
|
+
|
|
2162
|
+
When a route operation has both `progressive: { mode: 'autoInclude' }` and a guard `shape`, the router resolves the shape through prisma-guard before planning the stream. The request should not send `select`, `include`, or `omit`; the guard shape's default read projection is used as the response contract.
|
|
2163
|
+
|
|
2164
|
+
```ts
|
|
2165
|
+
import { force } from 'prisma-guard'
|
|
2166
|
+
|
|
2167
|
+
const userConfig = {
|
|
2168
|
+
guard: {
|
|
2169
|
+
variantHeader: 'x-api-variant',
|
|
2170
|
+
},
|
|
2171
|
+
|
|
2172
|
+
findFirst: {
|
|
2173
|
+
shape: {
|
|
2174
|
+
me: (ctx) => ({
|
|
2175
|
+
where: {
|
|
2176
|
+
id: { equals: force(ctx.userId) },
|
|
2177
|
+
},
|
|
2178
|
+
select: {
|
|
2179
|
+
id: true,
|
|
2180
|
+
email: true,
|
|
2181
|
+
profile: {
|
|
2182
|
+
select: {
|
|
2183
|
+
id: true,
|
|
2184
|
+
displayName: true,
|
|
2185
|
+
},
|
|
2186
|
+
},
|
|
2187
|
+
companies: {
|
|
2188
|
+
where: {
|
|
2189
|
+
company: {
|
|
2190
|
+
is: {
|
|
2191
|
+
deletedAt: { equals: null },
|
|
2192
|
+
},
|
|
2193
|
+
},
|
|
2194
|
+
},
|
|
2195
|
+
select: {
|
|
2196
|
+
company: {
|
|
2197
|
+
select: {
|
|
2198
|
+
id: true,
|
|
2199
|
+
name: true,
|
|
2200
|
+
},
|
|
2201
|
+
},
|
|
2202
|
+
role: {
|
|
2203
|
+
select: {
|
|
2204
|
+
role: true,
|
|
2205
|
+
},
|
|
2206
|
+
},
|
|
2207
|
+
},
|
|
2208
|
+
},
|
|
2209
|
+
},
|
|
2210
|
+
}),
|
|
2211
|
+
},
|
|
2212
|
+
progressive: {
|
|
2213
|
+
me: {
|
|
2214
|
+
enabled: true,
|
|
2215
|
+
mode: 'autoInclude',
|
|
2216
|
+
fallback: 'error',
|
|
2217
|
+
},
|
|
2218
|
+
},
|
|
2219
|
+
},
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
app.use('/', UserRouter(userConfig))
|
|
2223
|
+
```
|
|
2224
|
+
|
|
2225
|
+
Client request:
|
|
2226
|
+
|
|
2227
|
+
```http
|
|
2228
|
+
GET /user/first
|
|
2229
|
+
Accept: text/event-stream
|
|
2230
|
+
x-api-variant: me
|
|
2231
|
+
```
|
|
2232
|
+
|
|
2233
|
+
The guarded auto-include planner resolves the matched shape, applies the shape's default projection, strips direct relation branches from the root query, and loads those direct relations as follow-up guarded stage queries. The root query and every stage query execute through `prisma.model.guard(slicedShape, caller).method(args)`. Relation stages are never executed as raw Prisma delegate calls.
|
|
2234
|
+
|
|
2235
|
+
Direct relation stages stream as normal `field` events:
|
|
2236
|
+
|
|
2237
|
+
```json
|
|
2238
|
+
{ "type": "field", "key": "id", "value": "user-id" }
|
|
2239
|
+
```
|
|
2240
|
+
|
|
2241
|
+
```json
|
|
2242
|
+
{ "type": "field", "key": "profile", "value": { "id": "profile-id", "displayName": "Alice" } }
|
|
2243
|
+
```
|
|
2244
|
+
|
|
2245
|
+
```json
|
|
2246
|
+
{ "type": "field", "key": "companies", "value": [{ "company": { "id": "company-id", "name": "Acme" }, "role": { "role": "admin" } }] }
|
|
2247
|
+
```
|
|
2248
|
+
|
|
2249
|
+
The final `result` event contains the assembled object.
|
|
2250
|
+
|
|
2251
|
+
For guarded auto-include, `fallback: 'error'` is recommended during development so unsupported shapes are visible immediately. In production, `fallback: 'singleResult'` can be used to return one final SSE result through the normal guarded handler when the planner cannot split the shape.
|
|
2252
|
+
|
|
2146
2253
|
### Auto-include behavior and limits
|
|
2147
2254
|
|
|
2148
2255
|
Auto-include is designed for supported Prisma `include` and relation `select` trees on reads.
|
|
2149
2256
|
|
|
2150
2257
|
When `findManyPaginatedMode = "transaction"`, the root `findMany` and the total count run inside one interactive transaction, so `data` and `total` are mutually consistent. Relation stages, however, load **after** the transaction commits and are not part of it — relation batches can reflect writes committed between the root transaction and the stage queries.
|
|
2151
2258
|
|
|
2152
|
-
Supported root operations:
|
|
2259
|
+
Supported unguarded root operations:
|
|
2153
2260
|
|
|
2154
2261
|
- `findUnique`
|
|
2155
2262
|
- `findUniqueOrThrow`
|
|
@@ -2158,16 +2265,23 @@ Supported root operations:
|
|
|
2158
2265
|
- `findMany`
|
|
2159
2266
|
- `findManyPaginated`
|
|
2160
2267
|
|
|
2161
|
-
Supported
|
|
2268
|
+
Supported guarded root operations:
|
|
2269
|
+
|
|
2270
|
+
- `findUnique`
|
|
2271
|
+
- `findUniqueOrThrow`
|
|
2272
|
+
- `findFirst`
|
|
2273
|
+
- `findFirstOrThrow`
|
|
2274
|
+
|
|
2275
|
+
Supported unguarded single-record relation shapes:
|
|
2162
2276
|
|
|
2163
2277
|
- direct to-one relation includes/selects
|
|
2164
2278
|
- direct to-many relation includes/selects
|
|
2165
2279
|
- to-many relation args such as `where`, `orderBy`, `take`, `skip`, `cursor`, and `distinct`
|
|
2166
2280
|
- nested relation loading through to-one parents
|
|
2167
2281
|
|
|
2168
|
-
|
|
2282
|
+
Unguarded single-record auto-include falls back when a nested stage crosses a to-many parent. Direct to-many loading is still supported, but nested loading under that array is not handled by the single-record progressive runtime.
|
|
2169
2283
|
|
|
2170
|
-
Supported `findMany` and `findManyPaginated` relation shapes:
|
|
2284
|
+
Supported unguarded `findMany` and `findManyPaginated` relation shapes:
|
|
2171
2285
|
|
|
2172
2286
|
- direct and nested to-one relation includes/selects
|
|
2173
2287
|
- direct and nested to-many relation includes/selects
|
|
@@ -2175,11 +2289,33 @@ Supported `findMany` and `findManyPaginated` relation shapes:
|
|
|
2175
2289
|
- single-column link fields only
|
|
2176
2290
|
- nested depth up to the configured planner limit
|
|
2177
2291
|
|
|
2178
|
-
For `findMany` and `findManyPaginated`, each stage loads children with a batched query over the flattened parent rows at that stage's `parentPath`. Direct root stages stream `relationBatch` events. Depth-2-or-deeper stages stream `nestedRelationBatch` events with locator/value attachments, then also appear in the terminal `result` event.
|
|
2292
|
+
For unguarded `findMany` and `findManyPaginated`, each stage loads children with a batched query over the flattened parent rows at that stage's `parentPath`. Direct root stages stream `relationBatch` events. Depth-2-or-deeper stages stream `nestedRelationBatch` events with locator/value attachments, then also appear in the terminal `result` event.
|
|
2179
2293
|
|
|
2180
2294
|
`findMany` and `findManyPaginated` auto-include apply configured pagination limits to the root query before loading relation batches. If the client omits `take`, `pagination.defaultLimit` is applied when configured. If the client sends a large `take`, `pagination.maxLimit` is enforced before the root query runs.
|
|
2181
2295
|
|
|
2182
|
-
|
|
2296
|
+
Supported guarded single-record relation shapes:
|
|
2297
|
+
|
|
2298
|
+
- direct to-one relation `select` branches
|
|
2299
|
+
- direct to-many relation `select` branches
|
|
2300
|
+
- relation-level `where`, `orderBy`, `take`, `skip`, `cursor`, and `distinct` on direct to-many stages
|
|
2301
|
+
- nested `select` trees inside a direct relation stage, loaded as part of that guarded stage query
|
|
2302
|
+
|
|
2303
|
+
Guarded auto-include plans from the guard shape's default projection. Client-provided `select`, `include`, or `omit` is rejected for guarded auto-include and follows the configured fallback behavior. Normal guarded JSON reads still support client projection validation according to prisma-guard rules.
|
|
2304
|
+
|
|
2305
|
+
Guarded auto-include falls back when a shape uses an unsupported streaming form, including:
|
|
2306
|
+
|
|
2307
|
+
- client-provided `select`, `include`, or `omit`
|
|
2308
|
+
- shape-level `include` or `omit` in the auto-include plan
|
|
2309
|
+
- `_count` anywhere in the planned projection
|
|
2310
|
+
- implicit many-to-many relations
|
|
2311
|
+
- composite relation link fields
|
|
2312
|
+
- root relation filters in `where`, `orderBy`, or `cursor`
|
|
2313
|
+
- relation references in a staged relation's `orderBy` or `cursor`
|
|
2314
|
+
- link-field collisions in a staged relation `where`
|
|
2315
|
+
- planner limits for maximum stage count
|
|
2316
|
+
- guarded `findMany` or `findManyPaginated` auto-include
|
|
2317
|
+
|
|
2318
|
+
Unguarded auto-include falls back when a request uses an unsupported streaming form, including:
|
|
2183
2319
|
|
|
2184
2320
|
- `_count` in `select` or `include`
|
|
2185
2321
|
- implicit many-to-many relations
|
|
@@ -3140,7 +3276,7 @@ E2E=true
|
|
|
3140
3276
|
|
|
3141
3277
|
### E2E scalar-list support
|
|
3142
3278
|
|
|
3143
|
-
E2E SQLite scalar-list support is intentionally narrow
|
|
3279
|
+
E2E SQLite scalar-list support is intentionally narrow.
|
|
3144
3280
|
|
|
3145
3281
|
Supported:
|
|
3146
3282
|
|
|
@@ -3178,7 +3314,7 @@ basePrisma
|
|
|
3178
3314
|
|
|
3179
3315
|
Guard extension remains in the chain, but generated routers do not pass guard shapes when `E2E=true`.
|
|
3180
3316
|
|
|
3181
|
-
###
|
|
3317
|
+
### Supported E2E scalar-list scope
|
|
3182
3318
|
|
|
3183
3319
|
Supported:
|
|
3184
3320
|
|
|
@@ -3215,7 +3351,7 @@ Do not depend on SQLite-generated guard output for this path.
|
|
|
3215
3351
|
|
|
3216
3352
|
The SQLite schema is a derived test schema. It may intentionally erase Postgres-only field information such as scalar-list types. Guard correctness belongs to the production schema, not the SQLite test schema.
|
|
3217
3353
|
|
|
3218
|
-
|
|
3354
|
+
Global E2E guard drop keeps this path simple:
|
|
3219
3355
|
|
|
3220
3356
|
```text
|
|
3221
3357
|
production keeps guard
|
|
@@ -3258,4 +3394,4 @@ Hono
|
|
|
3258
3394
|
|
|
3259
3395
|
## License
|
|
3260
3396
|
|
|
3261
|
-
MIT
|
|
3397
|
+
MIT
|
|
@@ -2,34 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.encodeQueryParams = void 0;
|
|
4
4
|
const misc_1 = require("../copy/misc");
|
|
5
|
-
|
|
5
|
+
const bigintReplacer = (_key, value) => typeof value === 'bigint' ? value.toString() : value;
|
|
6
|
+
const encodeEntry = (key, value) => {
|
|
7
|
+
if (value === undefined)
|
|
8
|
+
return null;
|
|
9
|
+
const encodedKey = encodeURIComponent(key);
|
|
10
|
+
if (value === null)
|
|
11
|
+
return encodedKey + '=null';
|
|
6
12
|
if (typeof value === 'bigint') {
|
|
7
|
-
return value.toString();
|
|
13
|
+
return encodedKey + '=' + encodeURIComponent(value.toString());
|
|
8
14
|
}
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
if (typeof value === 'string') {
|
|
16
|
+
return encodedKey + '=' + encodeURIComponent(JSON.stringify(value));
|
|
17
|
+
}
|
|
18
|
+
if (Array.isArray(value) || (0, misc_1.isObject)(value)) {
|
|
19
|
+
return encodedKey + '=' + encodeURIComponent(JSON.stringify(value, bigintReplacer));
|
|
20
|
+
}
|
|
21
|
+
return encodedKey + '=' + encodeURIComponent(String(value));
|
|
22
|
+
};
|
|
11
23
|
const encodeQueryParams = (params) => {
|
|
12
24
|
const entries = [];
|
|
13
25
|
for (const [key, value] of Object.entries(params)) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
entries.push(`${encodeURIComponent(key)}=null`);
|
|
18
|
-
continue;
|
|
19
|
-
}
|
|
20
|
-
if (typeof value === 'bigint') {
|
|
21
|
-
entries.push(`${encodeURIComponent(key)}=${encodeURIComponent(value.toString())}`);
|
|
22
|
-
continue;
|
|
23
|
-
}
|
|
24
|
-
if (typeof value === 'string') {
|
|
25
|
-
entries.push(`${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value))}`);
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (Array.isArray(value) || (0, misc_1.isObject)(value)) {
|
|
29
|
-
entries.push(`${encodeURIComponent(key)}=${encodeURIComponent(JSON.stringify(value, replacer))}`);
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
entries.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
26
|
+
const entry = encodeEntry(key, value);
|
|
27
|
+
if (entry !== null)
|
|
28
|
+
entries.push(entry);
|
|
33
29
|
}
|
|
34
30
|
return entries.join('&');
|
|
35
31
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encodeQueryParams.js","sourceRoot":"","sources":["../../src/client/encodeQueryParams.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AAEvC,
|
|
1
|
+
{"version":3,"file":"encodeQueryParams.js","sourceRoot":"","sources":["../../src/client/encodeQueryParams.ts"],"names":[],"mappings":";;;AAAA,uCAAuC;AAEvC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,KAAc,EAAW,EAAE,CAC/D,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;AAEtD,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,KAAc,EAAiB,EAAE;IACjE,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IAEpC,MAAM,UAAU,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAA;IAE1C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,UAAU,GAAG,OAAO,CAAA;IAE/C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,UAAU,GAAG,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;IAChE,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,UAAU,GAAG,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;IACrE,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,IAAA,eAAQ,EAAC,KAAK,CAAC,EAAE,CAAC;QAC5C,OAAO,UAAU,GAAG,GAAG,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAA;IACrF,CAAC;IAED,OAAO,UAAU,GAAG,GAAG,GAAG,kBAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAA;AAC7D,CAAC,CAAA;AAEM,MAAM,iBAAiB,GAAG,CAAC,MAA+B,EAAU,EAAE;IAC3E,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACrC,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACzC,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC,CAAA;AAPY,QAAA,iBAAiB,qBAO7B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type HttpMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
2
|
+
export type OpKind = 'read' | 'write' | 'batch';
|
|
3
|
+
export interface OpMetadata {
|
|
4
|
+
name: string;
|
|
5
|
+
method: HttpMethod;
|
|
6
|
+
pathSuffix: string;
|
|
7
|
+
configKey: string;
|
|
8
|
+
kind: OpKind;
|
|
9
|
+
coreName: string;
|
|
10
|
+
successStatus: number;
|
|
11
|
+
requiredBodyFields: readonly string[];
|
|
12
|
+
supportsPostRead: boolean;
|
|
13
|
+
supportsProjection: boolean;
|
|
14
|
+
excludeFromEnableAll: boolean;
|
|
15
|
+
writeStrategyAffected: boolean;
|
|
16
|
+
errors: readonly number[];
|
|
17
|
+
responseDesc: string;
|
|
18
|
+
transport: string;
|
|
19
|
+
argsSchema: readonly string[];
|
|
20
|
+
requiredArgs: readonly string[];
|
|
21
|
+
notes: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const OPERATION_METADATA: readonly OpMetadata[];
|
|
24
|
+
export declare const OPERATION_BY_NAME: Record<string, OpMetadata>;
|
|
25
|
+
export declare const READ_OPERATIONS: readonly OpMetadata[];
|
|
26
|
+
export declare const WRITE_OPERATIONS: readonly OpMetadata[];
|
|
27
|
+
export declare const READ_OPERATION_NAMES: Set<string>;
|
|
28
|
+
export interface OperationDef {
|
|
29
|
+
name: string;
|
|
30
|
+
method: HttpMethod;
|
|
31
|
+
pathSuffix: string;
|
|
32
|
+
configKey: string;
|
|
33
|
+
excludeFromEnableAll?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare const OPERATION_DEFS: OperationDef[];
|
|
36
|
+
export declare function getPostReadPathSuffix(opName: string): string;
|
|
37
|
+
export declare function isOperationEnabled(config: Record<string, any>, def: OperationDef | OpMetadata): boolean;
|