prisma-generator-express 1.66.0 → 1.68.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.
Files changed (130) hide show
  1. package/README.md +188 -3432
  2. package/dist/client/encodeQueryParams.js +3 -1
  3. package/dist/client/encodeQueryParams.js.map +1 -1
  4. package/dist/copy/misc.d.ts +1 -0
  5. package/dist/copy/misc.js +14 -0
  6. package/dist/copy/misc.js.map +1 -1
  7. package/dist/copy/operationDefinitions.d.ts +4 -1
  8. package/dist/copy/operationDefinitions.js +133 -9
  9. package/dist/copy/operationDefinitions.js.map +1 -1
  10. package/dist/generators/generateFastifyHandler.d.ts +2 -2
  11. package/dist/generators/generateFastifyHandler.js +68 -12
  12. package/dist/generators/generateFastifyHandler.js.map +1 -1
  13. package/dist/generators/generateHonoHandler.d.ts +2 -2
  14. package/dist/generators/generateHonoHandler.js +53 -6
  15. package/dist/generators/generateHonoHandler.js.map +1 -1
  16. package/dist/generators/generateHonoOpenApi.d.ts +13 -0
  17. package/dist/generators/generateHonoOpenApi.js +70 -0
  18. package/dist/generators/generateHonoOpenApi.js.map +1 -0
  19. package/dist/generators/generateImportPrismaStatement.d.ts +1 -0
  20. package/dist/generators/generateImportPrismaStatement.js +6 -0
  21. package/dist/generators/generateImportPrismaStatement.js.map +1 -1
  22. package/dist/generators/generateMcpApp.d.ts +10 -0
  23. package/dist/generators/generateMcpApp.js +113 -0
  24. package/dist/generators/generateMcpApp.js.map +1 -0
  25. package/dist/generators/generateModelMcp.d.ts +9 -0
  26. package/dist/generators/generateModelMcp.js +145 -0
  27. package/dist/generators/generateModelMcp.js.map +1 -0
  28. package/dist/generators/generateModelMetadata.js +29 -15
  29. package/dist/generators/generateModelMetadata.js.map +1 -1
  30. package/dist/generators/generateOperationCore.d.ts +3 -3
  31. package/dist/generators/generateOperationCore.js +51 -16
  32. package/dist/generators/generateOperationCore.js.map +1 -1
  33. package/dist/generators/generateRelationMeta.js +2 -2
  34. package/dist/generators/generateRelationMeta.js.map +1 -1
  35. package/dist/generators/generateRouteConfigType.d.ts +2 -2
  36. package/dist/generators/generateRouteConfigType.js +29 -11
  37. package/dist/generators/generateRouteConfigType.js.map +1 -1
  38. package/dist/generators/generateRouter.d.ts +7 -4
  39. package/dist/generators/generateRouter.js +164 -65
  40. package/dist/generators/generateRouter.js.map +1 -1
  41. package/dist/generators/generateRouterFastify.d.ts +7 -4
  42. package/dist/generators/generateRouterFastify.js +106 -86
  43. package/dist/generators/generateRouterFastify.js.map +1 -1
  44. package/dist/generators/generateRouterHono.d.ts +7 -4
  45. package/dist/generators/generateRouterHono.js +59 -414
  46. package/dist/generators/generateRouterHono.js.map +1 -1
  47. package/dist/generators/generateRouterPartsHono.d.ts +14 -0
  48. package/dist/generators/generateRouterPartsHono.js +180 -0
  49. package/dist/generators/generateRouterPartsHono.js.map +1 -0
  50. package/dist/generators/generateUnifiedDocs.d.ts +1 -1
  51. package/dist/generators/generateUnifiedDocs.js +15 -8
  52. package/dist/generators/generateUnifiedDocs.js.map +1 -1
  53. package/dist/generators/generateUnifiedHandler.d.ts +2 -2
  54. package/dist/generators/generateUnifiedHandler.js +42 -18
  55. package/dist/generators/generateUnifiedHandler.js.map +1 -1
  56. package/dist/guardOptions.js +12 -7
  57. package/dist/guardOptions.js.map +1 -1
  58. package/dist/index.d.ts +3 -1
  59. package/dist/index.js +123 -4
  60. package/dist/index.js.map +1 -1
  61. package/dist/utils/copyFiles.d.ts +1 -1
  62. package/dist/utils/copyFiles.js +42 -7
  63. package/dist/utils/copyFiles.js.map +1 -1
  64. package/dist/utils/importExt.d.ts +1 -1
  65. package/dist/utils/mcpGate.d.ts +10 -0
  66. package/dist/utils/mcpGate.js +118 -0
  67. package/dist/utils/mcpGate.js.map +1 -0
  68. package/dist/utils/pathCasing.d.ts +4 -0
  69. package/dist/utils/pathCasing.js +40 -0
  70. package/dist/utils/pathCasing.js.map +1 -0
  71. package/dist/utils/resolveImportStyle.js +13 -5
  72. package/dist/utils/resolveImportStyle.js.map +1 -1
  73. package/dist/utils/writeFileSafely.js +6 -0
  74. package/dist/utils/writeFileSafely.js.map +1 -1
  75. package/package.json +22 -5
  76. package/src/bin.ts +1 -1
  77. package/src/client/encodeQueryParams.ts +39 -35
  78. package/src/constants.ts +1 -1
  79. package/src/copy/autoIncludePlanner.ts +93 -27
  80. package/src/copy/autoIncludePlannerGuarded.ts +171 -48
  81. package/src/copy/autoIncludeRuntimeGuarded.ts +25 -7
  82. package/src/copy/buildModelOpenApi.ts +229 -176
  83. package/src/copy/concurrency.ts +10 -8
  84. package/src/copy/docsRenderer.ts +14 -15
  85. package/src/copy/errorMapper.ts +68 -19
  86. package/src/copy/guardHelpers.ts +30 -9
  87. package/src/copy/materializedCount.ts +17 -5
  88. package/src/copy/mcpRuntime.ts +1017 -0
  89. package/src/copy/misc.ts +88 -68
  90. package/src/copy/ndjson.ts +72 -0
  91. package/src/copy/operationDefinitions.ts +177 -25
  92. package/src/copy/operationPipeline.ts +267 -0
  93. package/src/copy/operationRuntime.ts +124 -26
  94. package/src/copy/operationSchemas.ts +2773 -0
  95. package/src/copy/pagination.ts +35 -13
  96. package/src/copy/parseQueryParams.ts +47 -48
  97. package/src/copy/projectionDefaults.ts +6 -4
  98. package/src/copy/routeConfig.express.ts +16 -4
  99. package/src/copy/routeConfig.fastify.ts +16 -2
  100. package/src/copy/routeConfig.hono.ts +46 -14
  101. package/src/copy/routeConfig.ts +175 -40
  102. package/src/copy/routerParts.ts +524 -0
  103. package/src/copy/scalarTypes.ts +7 -2
  104. package/src/copy/sse.ts +72 -19
  105. package/src/generators/generateFastifyHandler.ts +77 -20
  106. package/src/generators/generateHonoHandler.ts +62 -14
  107. package/src/generators/generateHonoOpenApi.ts +93 -0
  108. package/src/generators/generateImportPrismaStatement.ts +93 -81
  109. package/src/generators/generateMcpApp.ts +133 -0
  110. package/src/generators/generateModelMcp.ts +208 -0
  111. package/src/generators/generateModelMetadata.ts +40 -22
  112. package/src/generators/generateOperationCore.ts +81 -33
  113. package/src/generators/generateRelationMeta.ts +23 -11
  114. package/src/generators/generateRouteConfigType.ts +39 -13
  115. package/src/generators/generateRouter.ts +171 -68
  116. package/src/generators/generateRouterFastify.ts +117 -89
  117. package/src/generators/generateRouterHono.ts +84 -464
  118. package/src/generators/generateRouterPartsHono.ts +220 -0
  119. package/src/generators/generateUnifiedDocs.ts +29 -8
  120. package/src/generators/generateUnifiedHandler.ts +47 -24
  121. package/src/generators/generateUnifiedScalarUI.ts +1 -1
  122. package/src/guardOptions.ts +105 -92
  123. package/src/index.ts +161 -6
  124. package/src/utils/copyFiles.ts +235 -168
  125. package/src/utils/importExt.ts +2 -2
  126. package/src/utils/mcpGate.ts +157 -0
  127. package/src/utils/pathCasing.ts +42 -0
  128. package/src/utils/resolveImportStyle.ts +37 -15
  129. package/src/utils/strings.ts +2 -2
  130. package/src/utils/writeFileSafely.ts +12 -2
@@ -1,7 +1,13 @@
1
1
  import { HttpError, LOG_PREFIX } from './errorMapper'
2
- import { assertGuard, buildCountShape, type PrismaDelegateLike } from './guardHelpers'
3
- import { countFromMaterializedView } from './materializedCount'
2
+ import {
3
+ assertGuard,
4
+ buildCountShape,
5
+ type PrismaDelegateLike,
6
+ } from './guardHelpers'
4
7
  import { isPlainObject } from './misc'
8
+ // legacy self-contained behavior restored: the materialized-view module is
9
+ // small and statically owned by pagination (phase 9 budget re-measured)
10
+ import { countFromMaterializedView } from './materializedCount'
5
11
  import type { PaginationConfig, PaginationCountSource } from './routeConfig'
6
12
 
7
13
  export const DISTINCT_COUNT_LIMIT = 100000
@@ -13,11 +19,16 @@ export function applyPaginationLimits(
13
19
  ): Record<string, unknown> {
14
20
  if (!config) return query
15
21
  const result: Record<string, unknown> = { ...query }
16
- if (!hasGuardShape && result.take === undefined && config.defaultLimit !== undefined) {
22
+ if (
23
+ !hasGuardShape &&
24
+ result.take === undefined &&
25
+ config.defaultLimit !== undefined
26
+ ) {
17
27
  result.take = config.defaultLimit
18
28
  }
19
29
  if (config.maxLimit !== undefined && result.take !== undefined) {
20
- const takeNum = typeof result.take === 'number' ? result.take : Number(result.take)
30
+ const takeNum =
31
+ typeof result.take === 'number' ? result.take : Number(result.take)
21
32
  if (!Number.isFinite(takeNum)) {
22
33
  throw new HttpError(400, 'Invalid take: must be a finite number')
23
34
  }
@@ -65,7 +76,10 @@ export function mergePaginationConfig(
65
76
  ...(base ?? {}),
66
77
  ...(override ?? {}),
67
78
  }
68
- const mergedCountSource = mergeCountSource(base?.countSource, override?.countSource)
79
+ const mergedCountSource = mergeCountSource(
80
+ base?.countSource,
81
+ override?.countSource,
82
+ )
69
83
  if (mergedCountSource) {
70
84
  merged.countSource = mergedCountSource
71
85
  } else {
@@ -76,7 +90,8 @@ export function mergePaginationConfig(
76
90
 
77
91
  export function normalizeDistinct(value: unknown): string[] {
78
92
  if (typeof value === 'string') return [value]
79
- if (Array.isArray(value)) return value.filter((v): v is string => typeof v === 'string')
93
+ if (Array.isArray(value))
94
+ return value.filter((v): v is string => typeof v === 'string')
80
95
  return []
81
96
  }
82
97
 
@@ -106,7 +121,13 @@ export async function countForPagination(
106
121
  whereIsEmpty &&
107
122
  distinctIsEmpty
108
123
  ) {
109
- return countFromMaterializedView(rawClient ?? delegate, countSource)
124
+ return countFromMaterializedView(
125
+ rawClient ?? delegate,
126
+ countSource as Extract<
127
+ PaginationCountSource,
128
+ { type: 'materializedView' }
129
+ >,
130
+ )
110
131
  }
111
132
 
112
133
  const hasDistinct = normalizedDistinct.length > 0
@@ -118,10 +139,9 @@ export async function countForPagination(
118
139
  if (query.where) countArgs.where = query.where
119
140
  if (countShape) {
120
141
  assertGuard(delegate)
121
- return (await delegate.guard(
122
- countShape as Record<string, unknown>,
123
- caller,
124
- ).count(countArgs)) as number
142
+ return (await delegate
143
+ .guard(countShape as Record<string, unknown>, caller)
144
+ .count(countArgs)) as number
125
145
  }
126
146
  return (await delegate.count(countArgs)) as number
127
147
  }
@@ -140,7 +160,9 @@ export async function countForPagination(
140
160
  if (results.length > effectiveLimit) {
141
161
  console.warn(
142
162
  LOG_PREFIX,
143
- 'Distinct count exceeds ' + effectiveLimit + ', falling back to approximate total',
163
+ 'Distinct count exceeds ' +
164
+ effectiveLimit +
165
+ ', falling back to approximate total',
144
166
  )
145
167
  return runCount()
146
168
  }
@@ -148,4 +170,4 @@ export async function countForPagination(
148
170
  }
149
171
 
150
172
  return runCount()
151
- }
173
+ }
@@ -1,48 +1,47 @@
1
- import { isObject, isSafeKey, sanitizeKeys } from './misc'
2
-
3
- type QueryParams =
4
- | string
5
- | Record<string, unknown>
6
- | string[]
7
- | Record<string, unknown>[]
8
- | undefined
9
-
10
- const NUMERIC_KEYS = new Set(['take', 'skip'])
11
- const INTEGER_RE = /^-?\d+$/
12
-
13
- const parseQueryValue = (value: string, key?: string): unknown => {
14
- if (value.startsWith('{') || value.startsWith('[') || value.startsWith('"')) {
15
- try {
16
- const parsed = JSON.parse(value)
17
- return sanitizeKeys(parsed)
18
- } catch {
19
- }
20
- }
21
- if (value === 'true') return true
22
- if (value === 'false') return false
23
- if (value === 'null') return null
24
- if (key && NUMERIC_KEYS.has(key) && INTEGER_RE.test(value)) {
25
- return parseInt(value, 10)
26
- }
27
- return value
28
- }
29
-
30
- export const parseQueryParams = (params: QueryParams): unknown => {
31
- if (typeof params === 'string') return parseQueryValue(params)
32
- if (Array.isArray(params)) {
33
- return params.map((item) =>
34
- typeof item === 'string' ? parseQueryValue(item) : sanitizeKeys(item),
35
- )
36
- }
37
- if (isObject(params)) {
38
- const parsedParams: Record<string, unknown> = {}
39
- for (const key of Object.keys(params)) {
40
- if (!isSafeKey(key)) continue
41
- const raw = params[key]
42
- parsedParams[key] =
43
- typeof raw === 'string' ? parseQueryValue(raw, key) : sanitizeKeys(raw)
44
- }
45
- return parsedParams
46
- }
47
- return params
48
- }
1
+ import { isObject, isSafeKey, sanitizeKeys } from './misc'
2
+
3
+ type QueryParams =
4
+ | string
5
+ | Record<string, unknown>
6
+ | string[]
7
+ | Record<string, unknown>[]
8
+ | undefined
9
+
10
+ const NUMERIC_KEYS = new Set(['take', 'skip'])
11
+ const INTEGER_RE = /^-?\d+$/
12
+
13
+ const parseQueryValue = (value: string, key?: string): unknown => {
14
+ if (value.startsWith('{') || value.startsWith('[') || value.startsWith('"')) {
15
+ try {
16
+ const parsed = JSON.parse(value)
17
+ return sanitizeKeys(parsed)
18
+ } catch {}
19
+ }
20
+ if (value === 'true') return true
21
+ if (value === 'false') return false
22
+ if (value === 'null') return null
23
+ if (key && NUMERIC_KEYS.has(key) && INTEGER_RE.test(value)) {
24
+ return parseInt(value, 10)
25
+ }
26
+ return value
27
+ }
28
+
29
+ export const parseQueryParams = (params: QueryParams): unknown => {
30
+ if (typeof params === 'string') return parseQueryValue(params)
31
+ if (Array.isArray(params)) {
32
+ return params.map((item) =>
33
+ typeof item === 'string' ? parseQueryValue(item) : sanitizeKeys(item),
34
+ )
35
+ }
36
+ if (isObject(params)) {
37
+ const parsedParams: Record<string, unknown> = {}
38
+ for (const key of Object.keys(params)) {
39
+ if (!isSafeKey(key)) continue
40
+ const raw = params[key]
41
+ parsedParams[key] =
42
+ typeof raw === 'string' ? parseQueryValue(raw, key) : sanitizeKeys(raw)
43
+ }
44
+ return parsedParams
45
+ }
46
+ return params
47
+ }
@@ -64,8 +64,7 @@ function emptyForced(): WhereForced {
64
64
 
65
65
  function hasForced(f: WhereForced): boolean {
66
66
  return (
67
- Object.keys(f.conditions).length > 0 ||
68
- Object.keys(f.relations).length > 0
67
+ Object.keys(f.conditions).length > 0 || Object.keys(f.relations).length > 0
69
68
  )
70
69
  }
71
70
 
@@ -423,7 +422,10 @@ export async function applyDroppedGuard(
423
422
  : emptyForced()
424
423
 
425
424
  const forcedData =
426
- opKind === 'create' || opKind === 'createMany' || opKind === 'update' || opKind === 'updateMany'
425
+ opKind === 'create' ||
426
+ opKind === 'createMany' ||
427
+ opKind === 'update' ||
428
+ opKind === 'updateMany'
427
429
  ? isPlainObject(resolved.data)
428
430
  ? extractForcedFromDataConfig(resolved.data)
429
431
  : {}
@@ -474,4 +476,4 @@ export async function applyDroppedGuard(
474
476
  if (Object.keys(forcedUpdate).length > 0) {
475
477
  target.update = mergeForcedData(target.update, forcedUpdate)
476
478
  }
477
- }
479
+ }
@@ -4,6 +4,7 @@ import type {
4
4
  BaseRouteConfig,
5
5
  ProgressiveStage,
6
6
  ProgressiveVariantConfig,
7
+ PrismaClientLike,
7
8
  QueryBuilderConfig,
8
9
  OpenApiServerConfig,
9
10
  OpenApiSecuritySchemeConfig,
@@ -21,6 +22,7 @@ export type {
21
22
  FindManyPaginatedMode,
22
23
  PaginationConfig,
23
24
  PaginationCountSource,
25
+ PrismaClientLike,
24
26
  }
25
27
 
26
28
  export type {
@@ -40,13 +42,13 @@ export type OperationConfig<TShape = Record<string, unknown>> =
40
42
  export type ReadOperationConfig<
41
43
  TShape = Record<string, unknown>,
42
44
  TCtx = unknown,
43
- TPrisma = any,
45
+ TPrisma extends PrismaClientLike = PrismaClientLike,
44
46
  > = BaseOperationConfig<RequestHandler, TShape> & {
45
47
  progressive?: Record<string, ProgressiveVariantConfig>
46
48
  progressiveStages?: Record<string, ProgressiveStage<TCtx, TPrisma>>
47
49
  }
48
50
 
49
- type ReadOperationOverrides<TShape, TCtx, TPrisma> = {
51
+ type ReadOperationOverrides<TShape, TCtx, TPrisma extends PrismaClientLike> = {
50
52
  findFirst?: ReadOperationConfig<TShape, TCtx, TPrisma> | false
51
53
  findFirstOrThrow?: ReadOperationConfig<TShape, TCtx, TPrisma> | false
52
54
  findUnique?: ReadOperationConfig<TShape, TCtx, TPrisma> | false
@@ -61,6 +63,16 @@ type ReadOperationOverrides<TShape, TCtx, TPrisma> = {
61
63
  export type RouteConfig<
62
64
  TShape = Record<string, unknown>,
63
65
  TCtx = unknown,
64
- TPrisma = any,
66
+ TPrisma extends PrismaClientLike = PrismaClientLike,
65
67
  > = BaseRouteConfig<RequestHandler, Request, TShape, TCtx> &
66
- ReadOperationOverrides<TShape, TCtx, TPrisma>
68
+ ReadOperationOverrides<TShape, TCtx, TPrisma> & {
69
+ /**
70
+ * Honour `PGE_DROP_GUARD=true` in the environment as a guard bypass
71
+ * (deprecated alias: `E2E=true`). **Default `false` for this target.**
72
+ *
73
+ * Only the explicit `true` enables it; false or omitted means the
74
+ * environment cannot drop guards. The generation-time `dropGuard` literal
75
+ * is independent of this control and unchanged.
76
+ */
77
+ allowE2EGuardBypass?: boolean
78
+ }
@@ -9,6 +9,7 @@ import type {
9
9
  FindManyPaginatedMode,
10
10
  PaginationConfig,
11
11
  PaginationCountSource,
12
+ PrismaClientLike,
12
13
  } from './routeConfig'
13
14
 
14
15
  export type {
@@ -19,6 +20,7 @@ export type {
19
20
  FindManyPaginatedMode,
20
21
  PaginationConfig,
21
22
  PaginationCountSource,
23
+ PrismaClientLike,
22
24
  }
23
25
 
24
26
  export type FastifyHookHandler = (
@@ -29,5 +31,17 @@ export type FastifyHookHandler = (
29
31
  export type OperationConfig<TShape = Record<string, unknown>> =
30
32
  BaseOperationConfig<FastifyHookHandler, TShape>
31
33
 
32
- export type RouteConfig<TShape = Record<string, unknown>, TCtx = unknown> =
33
- BaseRouteConfig<FastifyHookHandler, FastifyRequest, TShape, TCtx>
34
+ export type RouteConfig<
35
+ TShape = Record<string, unknown>,
36
+ TCtx = unknown,
37
+ > = BaseRouteConfig<FastifyHookHandler, FastifyRequest, TShape, TCtx> & {
38
+ /**
39
+ * Honour `PGE_DROP_GUARD=true` in the environment as a guard bypass
40
+ * (deprecated alias: `E2E=true`). **Default `false` for this target.**
41
+ *
42
+ * Only the explicit `true` enables it; false or omitted means the
43
+ * environment cannot drop guards. The generation-time `dropGuard` literal
44
+ * is independent of this control and unchanged.
45
+ */
46
+ allowE2EGuardBypass?: boolean
47
+ }
@@ -1,5 +1,6 @@
1
+ import type { RuntimeOperationOverride } from './operationRuntime'
2
+ import type { HttpError } from './errorMapper'
1
3
  import type { Context } from 'hono'
2
- import type { GuardVariantResolution } from './guardVariantRouting'
3
4
  import type {
4
5
  BaseOperationConfig,
5
6
  BaseRouteConfig,
@@ -10,6 +11,7 @@ import type {
10
11
  FindManyPaginatedMode,
11
12
  PaginationConfig,
12
13
  PaginationCountSource,
14
+ PrismaClientLike,
13
15
  } from './routeConfig'
14
16
 
15
17
  export type {
@@ -20,6 +22,7 @@ export type {
20
22
  FindManyPaginatedMode,
21
23
  PaginationConfig,
22
24
  PaginationCountSource,
25
+ PrismaClientLike,
23
26
  }
24
27
 
25
28
  export type HonoEnvBase = {
@@ -27,7 +30,22 @@ export type HonoEnvBase = {
27
30
  Bindings?: Record<string, unknown>
28
31
  }
29
32
 
33
+ /**
34
+ * A stored, already-classified stage failure. `settleStage` rethrows the
35
+ * `HttpError` unchanged; where that happens is the adapter's ordering choice.
36
+ */
37
+ export type StoredStageFailure = { ok: false; failure: HttpError }
38
+
30
39
  export type HonoInternalVariables = {
40
+ operationOverride?: RuntimeOperationOverride
41
+ /**
42
+ * Memoized application-context resolver (new key).
43
+ *
44
+ * @deprecated keep-populated alias of the pre-1.x key below; existing typed
45
+ * hooks read `resolveOperationContext`, so the router writes BOTH.
46
+ */
47
+ resolveOperationContext?: () => unknown | Promise<unknown>
48
+ getContext?: () => Promise<unknown>
31
49
  prisma?: unknown
32
50
  postgres?: unknown
33
51
  sqlite?: unknown
@@ -37,12 +55,28 @@ export type HonoInternalVariables = {
37
55
  guardShape?: Record<string, unknown>
38
56
  guardCaller?: string
39
57
  guardVariantKey?: string
40
- guardVariantFailure?: Extract<GuardVariantResolution, { ok: false }>
41
58
  /**
42
- * Set when `validateResolvedShapes` refuses what a shape function returned.
59
+ * Stored, already-classified variant failure (new internal key).
60
+ */
61
+ guardVariantStageFailure?: StoredStageFailure
62
+ /**
63
+ * Raw variant resolution — the pre-1.x public shape. Still populated so
64
+ * existing typed hooks reading `.code` keep compiling and running.
43
65
  *
44
- * It was written by the router and never declared here, so the emitted router
45
- * failed to typecheck at exactly the line that implements the control.
66
+ * @deprecated read `guardVariantStageFailure` for the classified failure.
67
+ */
68
+ guardVariantFailure?: Extract<
69
+ import('./guardVariantRouting').GuardVariantResolution,
70
+ { ok: false }
71
+ >
72
+ /**
73
+ * Stored, already-classified shape failure (new internal key).
74
+ */
75
+ guardShapeStageFailure?: StoredStageFailure
76
+ /**
77
+ * Pre-1.x string form of the shape-resolution problem. Still populated.
78
+ *
79
+ * @deprecated read `guardShapeStageFailure` for the classified failure.
46
80
  */
47
81
  guardShapeFailure?: string
48
82
  resultData?: unknown
@@ -51,7 +85,7 @@ export type HonoInternalVariables = {
51
85
 
52
86
  export type GeneratedHonoEnv<TEnv extends HonoEnvBase = HonoEnvBase> = {
53
87
  Variables: HonoInternalVariables & TEnv['Variables']
54
- Bindings: TEnv['Bindings']
88
+ Bindings: NonNullable<TEnv['Bindings']>
55
89
  }
56
90
 
57
91
  export type HonoBeforeHook<TEnv extends HonoEnvBase = HonoEnvBase> = (
@@ -63,16 +97,13 @@ export type HonoAfterHook<TEnv extends HonoEnvBase = HonoEnvBase> = (
63
97
  ) => Promise<Response | void> | Response | void
64
98
 
65
99
  /** @deprecated use HonoBeforeHook or HonoAfterHook */
66
- export type HonoHookHandler<TEnv extends HonoEnvBase = HonoEnvBase> = HonoBeforeHook<TEnv>
100
+ export type HonoHookHandler<TEnv extends HonoEnvBase = HonoEnvBase> =
101
+ HonoBeforeHook<TEnv>
67
102
 
68
103
  export type OperationConfig<
69
104
  TShape = Record<string, unknown>,
70
105
  TEnv extends HonoEnvBase = HonoEnvBase,
71
- > = BaseOperationConfig<
72
- HonoBeforeHook<TEnv>,
73
- TShape,
74
- HonoAfterHook<TEnv>
75
- >
106
+ > = BaseOperationConfig<HonoBeforeHook<TEnv>, TShape, HonoAfterHook<TEnv>>
76
107
 
77
108
  export type UpdateEachConfig<TEnv extends HonoEnvBase = HonoEnvBase> = {
78
109
  before?: HonoBeforeHook<TEnv>[]
@@ -180,7 +211,8 @@ export type RouteConfig<
180
211
  guardResolutionOrder?: 'after-hooks' | 'before-hooks'
181
212
 
182
213
  /**
183
- * Honour `E2E=true` in the environment as a guard bypass. **Default `true`.**
214
+ * Honour `PGE_DROP_GUARD=true` in the environment as a guard bypass
215
+ * (deprecated alias: `E2E=true`). **Default `true`.**
184
216
  *
185
217
  * Upstream behaviour, and a real hazard on an edge runtime where that variable
186
218
  * is an ordinary config var — set on staging, copied forward, flagged as
@@ -218,4 +250,4 @@ export type RouteConfig<
218
250
  count?: OperationConfig<TShape, TEnv> | false
219
251
  groupBy?: OperationConfig<TShape, TEnv> | false
220
252
  updateEach?: UpdateEachConfig<TEnv>
221
- }
253
+ }