@prisma/query-plan-executor 7.3.0 → 7.4.0-dev.10

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 (3) hide show
  1. package/dist/index.d.ts +149 -139
  2. package/dist/index.js +576 -35
  3. package/package.json +7 -7
package/dist/index.js CHANGED
@@ -101325,7 +101325,7 @@ __export(index_exports, {
101325
101325
  module.exports = __toCommonJS(index_exports);
101326
101326
 
101327
101327
  // package.json
101328
- var version = "7.3.0";
101328
+ var version = "7.4.0-dev.10";
101329
101329
 
101330
101330
  // ../../node_modules/.pnpm/temporal-polyfill@0.3.0/node_modules/temporal-polyfill/chunks/internal.js
101331
101331
  function clampProp(e2, n2, t2, o2, r2) {
@@ -106189,7 +106189,7 @@ function createConsoleLogger(logFormat, logLevel) {
106189
106189
  return new Logger(sink);
106190
106190
  }
106191
106191
 
106192
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/utils/url.js
106192
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/utils/url.js
106193
106193
  var splitPath = (path3) => {
106194
106194
  const paths = path3.split("/");
106195
106195
  if (paths[0] === "") {
@@ -106391,7 +106391,7 @@ var getQueryParams = (url2, key) => {
106391
106391
  };
106392
106392
  var decodeURIComponent_ = decodeURIComponent;
106393
106393
 
106394
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/utils/cookie.js
106394
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/utils/cookie.js
106395
106395
  var validCookieNameRegEx = /^[\w!#$%&'*.^`|~+-]+$/;
106396
106396
  var validCookieValueRegEx = /^[ !#-:<-[\]-~]*$/;
106397
106397
  var parse = (cookie, name6) => {
@@ -106424,7 +106424,7 @@ var parse = (cookie, name6) => {
106424
106424
  return parsedCookie;
106425
106425
  };
106426
106426
 
106427
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/helper/cookie/index.js
106427
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/helper/cookie/index.js
106428
106428
  var getCookie = (c2, key, prefix) => {
106429
106429
  const cookie = c2.req.raw.headers.get("Cookie");
106430
106430
  if (typeof key === "string") {
@@ -106447,15 +106447,25 @@ var getCookie = (c2, key, prefix) => {
106447
106447
  return obj;
106448
106448
  };
106449
106449
 
106450
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/http-exception.js
106450
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/http-exception.js
106451
106451
  var HTTPException = class extends Error {
106452
106452
  res;
106453
106453
  status;
106454
+ /**
106455
+ * Creates an instance of `HTTPException`.
106456
+ * @param status - HTTP status code for the exception. Defaults to 500.
106457
+ * @param options - Additional options for the exception.
106458
+ */
106454
106459
  constructor(status = 500, options) {
106455
106460
  super(options?.message, { cause: options?.cause });
106456
106461
  this.res = options?.res;
106457
106462
  this.status = status;
106458
106463
  }
106464
+ /**
106465
+ * Returns the response object associated with the exception.
106466
+ * If a response object is not provided, a new response is created with the error message and status code.
106467
+ * @returns The response object.
106468
+ */
106459
106469
  getResponse() {
106460
106470
  if (this.res) {
106461
106471
  const newResponse = new Response(this.res.body, {
@@ -106470,7 +106480,7 @@ var HTTPException = class extends Error {
106470
106480
  }
106471
106481
  };
106472
106482
 
106473
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/utils/buffer.js
106483
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/utils/buffer.js
106474
106484
  var bufferToFormData = (arrayBuffer, contentType) => {
106475
106485
  const response = new Response(arrayBuffer, {
106476
106486
  headers: {
@@ -106480,7 +106490,7 @@ var bufferToFormData = (arrayBuffer, contentType) => {
106480
106490
  return response.formData();
106481
106491
  };
106482
106492
 
106483
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/validator/validator.js
106493
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/validator/validator.js
106484
106494
  var jsonRegex = /^application\/([a-z-\.]+\+)?json(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
106485
106495
  var multipartRegex = /^multipart\/form-data(;\s?boundary=[a-zA-Z0-9'"()+_,\-./:=?]+)?$/;
106486
106496
  var urlencodedRegex = /^application\/x-www-form-urlencoded(;\s*[a-zA-Z0-9\-]+\=([^;]+))*$/;
@@ -106561,7 +106571,7 @@ var validator = (target, validationFunc) => {
106561
106571
  };
106562
106572
  };
106563
106573
 
106564
- // ../../node_modules/.pnpm/@hono+zod-validator@0.7.2_hono@4.10.6_zod@4.1.3/node_modules/@hono/zod-validator/dist/index.js
106574
+ // ../../node_modules/.pnpm/@hono+zod-validator@0.7.2_hono@4.11.7_zod@4.1.3/node_modules/@hono/zod-validator/dist/index.js
106565
106575
  var zValidator = (target, schema, hook, options) => (
106566
106576
  // @ts-expect-error not typed well
106567
106577
  validator(target, async (value, c2) => {
@@ -111647,7 +111657,7 @@ function createTimeoutIfDefined(cb, ms) {
111647
111657
  return ms !== void 0 ? setTimeout(cb, ms) : void 0;
111648
111658
  }
111649
111659
 
111650
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/compose.js
111660
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/compose.js
111651
111661
  var compose = (middleware, onError, onNotFound) => {
111652
111662
  return (context2, next) => {
111653
111663
  let index = -1;
@@ -111691,10 +111701,10 @@ var compose = (middleware, onError, onNotFound) => {
111691
111701
  };
111692
111702
  };
111693
111703
 
111694
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/request/constants.js
111695
- var GET_MATCH_RESULT = Symbol();
111704
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/request/constants.js
111705
+ var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
111696
111706
 
111697
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/utils/body.js
111707
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/utils/body.js
111698
111708
  var parseBody = async (request3, options = /* @__PURE__ */ Object.create(null)) => {
111699
111709
  const { all = false, dot = false } = options;
111700
111710
  const headers = request3 instanceof HonoRequest ? request3.raw.headers : request3.headers;
@@ -111763,13 +111773,40 @@ var handleParsingNestedValues = (form, key, value) => {
111763
111773
  });
111764
111774
  };
111765
111775
 
111766
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/request.js
111776
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/request.js
111767
111777
  var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
111768
111778
  var HonoRequest = class {
111779
+ /**
111780
+ * `.raw` can get the raw Request object.
111781
+ *
111782
+ * @see {@link https://hono.dev/docs/api/request#raw}
111783
+ *
111784
+ * @example
111785
+ * ```ts
111786
+ * // For Cloudflare Workers
111787
+ * app.post('/', async (c) => {
111788
+ * const metadata = c.req.raw.cf?.hostMetadata?
111789
+ * ...
111790
+ * })
111791
+ * ```
111792
+ */
111769
111793
  raw;
111770
111794
  #validatedData;
111795
+ // Short name of validatedData
111771
111796
  #matchResult;
111772
111797
  routeIndex = 0;
111798
+ /**
111799
+ * `.path` can get the pathname of the request.
111800
+ *
111801
+ * @see {@link https://hono.dev/docs/api/request#path}
111802
+ *
111803
+ * @example
111804
+ * ```ts
111805
+ * app.get('/about/me', (c) => {
111806
+ * const pathname = c.req.path // `/about/me`
111807
+ * })
111808
+ * ```
111809
+ */
111773
111810
  path;
111774
111811
  bodyCache = {};
111775
111812
  constructor(request3, path3 = "/", matchResult = [[]]) {
@@ -111836,45 +111873,175 @@ var HonoRequest = class {
111836
111873
  }
111837
111874
  return bodyCache[key] = raw3[key]();
111838
111875
  };
111876
+ /**
111877
+ * `.json()` can parse Request body of type `application/json`
111878
+ *
111879
+ * @see {@link https://hono.dev/docs/api/request#json}
111880
+ *
111881
+ * @example
111882
+ * ```ts
111883
+ * app.post('/entry', async (c) => {
111884
+ * const body = await c.req.json()
111885
+ * })
111886
+ * ```
111887
+ */
111839
111888
  json() {
111840
111889
  return this.#cachedBody("text").then((text) => JSON.parse(text));
111841
111890
  }
111891
+ /**
111892
+ * `.text()` can parse Request body of type `text/plain`
111893
+ *
111894
+ * @see {@link https://hono.dev/docs/api/request#text}
111895
+ *
111896
+ * @example
111897
+ * ```ts
111898
+ * app.post('/entry', async (c) => {
111899
+ * const body = await c.req.text()
111900
+ * })
111901
+ * ```
111902
+ */
111842
111903
  text() {
111843
111904
  return this.#cachedBody("text");
111844
111905
  }
111906
+ /**
111907
+ * `.arrayBuffer()` parse Request body as an `ArrayBuffer`
111908
+ *
111909
+ * @see {@link https://hono.dev/docs/api/request#arraybuffer}
111910
+ *
111911
+ * @example
111912
+ * ```ts
111913
+ * app.post('/entry', async (c) => {
111914
+ * const body = await c.req.arrayBuffer()
111915
+ * })
111916
+ * ```
111917
+ */
111845
111918
  arrayBuffer() {
111846
111919
  return this.#cachedBody("arrayBuffer");
111847
111920
  }
111921
+ /**
111922
+ * Parses the request body as a `Blob`.
111923
+ * @example
111924
+ * ```ts
111925
+ * app.post('/entry', async (c) => {
111926
+ * const body = await c.req.blob();
111927
+ * });
111928
+ * ```
111929
+ * @see https://hono.dev/docs/api/request#blob
111930
+ */
111848
111931
  blob() {
111849
111932
  return this.#cachedBody("blob");
111850
111933
  }
111934
+ /**
111935
+ * Parses the request body as `FormData`.
111936
+ * @example
111937
+ * ```ts
111938
+ * app.post('/entry', async (c) => {
111939
+ * const body = await c.req.formData();
111940
+ * });
111941
+ * ```
111942
+ * @see https://hono.dev/docs/api/request#formdata
111943
+ */
111851
111944
  formData() {
111852
111945
  return this.#cachedBody("formData");
111853
111946
  }
111947
+ /**
111948
+ * Adds validated data to the request.
111949
+ *
111950
+ * @param target - The target of the validation.
111951
+ * @param data - The validated data to add.
111952
+ */
111854
111953
  addValidatedData(target, data) {
111855
111954
  this.#validatedData[target] = data;
111856
111955
  }
111857
111956
  valid(target) {
111858
111957
  return this.#validatedData[target];
111859
111958
  }
111959
+ /**
111960
+ * `.url()` can get the request url strings.
111961
+ *
111962
+ * @see {@link https://hono.dev/docs/api/request#url}
111963
+ *
111964
+ * @example
111965
+ * ```ts
111966
+ * app.get('/about/me', (c) => {
111967
+ * const url = c.req.url // `http://localhost:8787/about/me`
111968
+ * ...
111969
+ * })
111970
+ * ```
111971
+ */
111860
111972
  get url() {
111861
111973
  return this.raw.url;
111862
111974
  }
111975
+ /**
111976
+ * `.method()` can get the method name of the request.
111977
+ *
111978
+ * @see {@link https://hono.dev/docs/api/request#method}
111979
+ *
111980
+ * @example
111981
+ * ```ts
111982
+ * app.get('/about/me', (c) => {
111983
+ * const method = c.req.method // `GET`
111984
+ * })
111985
+ * ```
111986
+ */
111863
111987
  get method() {
111864
111988
  return this.raw.method;
111865
111989
  }
111866
111990
  get [GET_MATCH_RESULT]() {
111867
111991
  return this.#matchResult;
111868
111992
  }
111993
+ /**
111994
+ * `.matchedRoutes()` can return a matched route in the handler
111995
+ *
111996
+ * @deprecated
111997
+ *
111998
+ * Use matchedRoutes helper defined in "hono/route" instead.
111999
+ *
112000
+ * @see {@link https://hono.dev/docs/api/request#matchedroutes}
112001
+ *
112002
+ * @example
112003
+ * ```ts
112004
+ * app.use('*', async function logger(c, next) {
112005
+ * await next()
112006
+ * c.req.matchedRoutes.forEach(({ handler, method, path }, i) => {
112007
+ * const name = handler.name || (handler.length < 2 ? '[handler]' : '[middleware]')
112008
+ * console.log(
112009
+ * method,
112010
+ * ' ',
112011
+ * path,
112012
+ * ' '.repeat(Math.max(10 - path.length, 0)),
112013
+ * name,
112014
+ * i === c.req.routeIndex ? '<- respond from here' : ''
112015
+ * )
112016
+ * })
112017
+ * })
112018
+ * ```
112019
+ */
111869
112020
  get matchedRoutes() {
111870
112021
  return this.#matchResult[0].map(([[, route]]) => route);
111871
112022
  }
112023
+ /**
112024
+ * `routePath()` can retrieve the path registered within the handler
112025
+ *
112026
+ * @deprecated
112027
+ *
112028
+ * Use routePath helper defined in "hono/route" instead.
112029
+ *
112030
+ * @see {@link https://hono.dev/docs/api/request#routepath}
112031
+ *
112032
+ * @example
112033
+ * ```ts
112034
+ * app.get('/posts/:id', (c) => {
112035
+ * return c.json({ path: c.req.routePath })
112036
+ * })
112037
+ * ```
112038
+ */
111872
112039
  get routePath() {
111873
112040
  return this.#matchResult[0].map(([[, route]]) => route)[this.routeIndex].path;
111874
112041
  }
111875
112042
  };
111876
112043
 
111877
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/utils/html.js
112044
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/utils/html.js
111878
112045
  var HtmlEscapedCallbackPhase = {
111879
112046
  Stringify: 1,
111880
112047
  BeforeStream: 2,
@@ -111916,7 +112083,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context2, buffer) =>
111916
112083
  }
111917
112084
  };
111918
112085
 
111919
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/context.js
112086
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/context.js
111920
112087
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
111921
112088
  var setDefaultContentType = (contentType, headers) => {
111922
112089
  return {
@@ -111927,9 +112094,37 @@ var setDefaultContentType = (contentType, headers) => {
111927
112094
  var Context = class {
111928
112095
  #rawRequest;
111929
112096
  #req;
112097
+ /**
112098
+ * `.env` can get bindings (environment variables, secrets, KV namespaces, D1 database, R2 bucket etc.) in Cloudflare Workers.
112099
+ *
112100
+ * @see {@link https://hono.dev/docs/api/context#env}
112101
+ *
112102
+ * @example
112103
+ * ```ts
112104
+ * // Environment object for Cloudflare Workers
112105
+ * app.get('*', async c => {
112106
+ * const counter = c.env.COUNTER
112107
+ * })
112108
+ * ```
112109
+ */
111930
112110
  env = {};
111931
112111
  #var;
111932
112112
  finalized = false;
112113
+ /**
112114
+ * `.error` can get the error object from the middleware if the Handler throws an error.
112115
+ *
112116
+ * @see {@link https://hono.dev/docs/api/context#error}
112117
+ *
112118
+ * @example
112119
+ * ```ts
112120
+ * app.use('*', async (c, next) => {
112121
+ * await next()
112122
+ * if (c.error) {
112123
+ * // do something...
112124
+ * }
112125
+ * })
112126
+ * ```
112127
+ */
111933
112128
  error;
111934
112129
  #status;
111935
112130
  #executionCtx;
@@ -111940,6 +112135,12 @@ var Context = class {
111940
112135
  #preparedHeaders;
111941
112136
  #matchResult;
111942
112137
  #path;
112138
+ /**
112139
+ * Creates an instance of the Context class.
112140
+ *
112141
+ * @param req - The Request object.
112142
+ * @param options - Optional configuration options for the context.
112143
+ */
111943
112144
  constructor(req, options) {
111944
112145
  this.#rawRequest = req;
111945
112146
  if (options) {
@@ -111950,10 +112151,19 @@ var Context = class {
111950
112151
  this.#matchResult = options.matchResult;
111951
112152
  }
111952
112153
  }
112154
+ /**
112155
+ * `.req` is the instance of {@link HonoRequest}.
112156
+ */
111953
112157
  get req() {
111954
112158
  this.#req ??= new HonoRequest(this.#rawRequest, this.#path, this.#matchResult);
111955
112159
  return this.#req;
111956
112160
  }
112161
+ /**
112162
+ * @see {@link https://hono.dev/docs/api/context#event}
112163
+ * The FetchEvent associated with the current request.
112164
+ *
112165
+ * @throws Will throw an error if the context does not have a FetchEvent.
112166
+ */
111957
112167
  get event() {
111958
112168
  if (this.#executionCtx && "respondWith" in this.#executionCtx) {
111959
112169
  return this.#executionCtx;
@@ -111961,6 +112171,12 @@ var Context = class {
111961
112171
  throw Error("This context has no FetchEvent");
111962
112172
  }
111963
112173
  }
112174
+ /**
112175
+ * @see {@link https://hono.dev/docs/api/context#executionctx}
112176
+ * The ExecutionContext associated with the current request.
112177
+ *
112178
+ * @throws Will throw an error if the context does not have an ExecutionContext.
112179
+ */
111964
112180
  get executionCtx() {
111965
112181
  if (this.#executionCtx) {
111966
112182
  return this.#executionCtx;
@@ -111968,11 +112184,20 @@ var Context = class {
111968
112184
  throw Error("This context has no ExecutionContext");
111969
112185
  }
111970
112186
  }
112187
+ /**
112188
+ * @see {@link https://hono.dev/docs/api/context#res}
112189
+ * The Response object for the current request.
112190
+ */
111971
112191
  get res() {
111972
112192
  return this.#res ||= new Response(null, {
111973
112193
  headers: this.#preparedHeaders ??= new Headers()
111974
112194
  });
111975
112195
  }
112196
+ /**
112197
+ * Sets the Response object for the current request.
112198
+ *
112199
+ * @param _res - The Response object to set.
112200
+ */
111976
112201
  set res(_res) {
111977
112202
  if (this.#res && _res) {
111978
112203
  _res = new Response(_res.body, _res);
@@ -111994,15 +112219,75 @@ var Context = class {
111994
112219
  this.#res = _res;
111995
112220
  this.finalized = true;
111996
112221
  }
112222
+ /**
112223
+ * `.render()` can create a response within a layout.
112224
+ *
112225
+ * @see {@link https://hono.dev/docs/api/context#render-setrenderer}
112226
+ *
112227
+ * @example
112228
+ * ```ts
112229
+ * app.get('/', (c) => {
112230
+ * return c.render('Hello!')
112231
+ * })
112232
+ * ```
112233
+ */
111997
112234
  render = (...args) => {
111998
112235
  this.#renderer ??= (content) => this.html(content);
111999
112236
  return this.#renderer(...args);
112000
112237
  };
112238
+ /**
112239
+ * Sets the layout for the response.
112240
+ *
112241
+ * @param layout - The layout to set.
112242
+ * @returns The layout function.
112243
+ */
112001
112244
  setLayout = (layout) => this.#layout = layout;
112245
+ /**
112246
+ * Gets the current layout for the response.
112247
+ *
112248
+ * @returns The current layout function.
112249
+ */
112002
112250
  getLayout = () => this.#layout;
112251
+ /**
112252
+ * `.setRenderer()` can set the layout in the custom middleware.
112253
+ *
112254
+ * @see {@link https://hono.dev/docs/api/context#render-setrenderer}
112255
+ *
112256
+ * @example
112257
+ * ```tsx
112258
+ * app.use('*', async (c, next) => {
112259
+ * c.setRenderer((content) => {
112260
+ * return c.html(
112261
+ * <html>
112262
+ * <body>
112263
+ * <p>{content}</p>
112264
+ * </body>
112265
+ * </html>
112266
+ * )
112267
+ * })
112268
+ * await next()
112269
+ * })
112270
+ * ```
112271
+ */
112003
112272
  setRenderer = (renderer) => {
112004
112273
  this.#renderer = renderer;
112005
112274
  };
112275
+ /**
112276
+ * `.header()` can set headers.
112277
+ *
112278
+ * @see {@link https://hono.dev/docs/api/context#header}
112279
+ *
112280
+ * @example
112281
+ * ```ts
112282
+ * app.get('/welcome', (c) => {
112283
+ * // Set headers
112284
+ * c.header('X-Message', 'Hello!')
112285
+ * c.header('Content-Type', 'text/plain')
112286
+ *
112287
+ * return c.body('Thank you for coming')
112288
+ * })
112289
+ * ```
112290
+ */
112006
112291
  header = (name6, value, options) => {
112007
112292
  if (this.finalized) {
112008
112293
  this.#res = new Response(this.#res.body, this.#res);
@@ -112019,13 +112304,50 @@ var Context = class {
112019
112304
  status = (status) => {
112020
112305
  this.#status = status;
112021
112306
  };
112307
+ /**
112308
+ * `.set()` can set the value specified by the key.
112309
+ *
112310
+ * @see {@link https://hono.dev/docs/api/context#set-get}
112311
+ *
112312
+ * @example
112313
+ * ```ts
112314
+ * app.use('*', async (c, next) => {
112315
+ * c.set('message', 'Hono is hot!!')
112316
+ * await next()
112317
+ * })
112318
+ * ```
112319
+ */
112022
112320
  set = (key, value) => {
112023
112321
  this.#var ??= /* @__PURE__ */ new Map();
112024
112322
  this.#var.set(key, value);
112025
112323
  };
112324
+ /**
112325
+ * `.get()` can use the value specified by the key.
112326
+ *
112327
+ * @see {@link https://hono.dev/docs/api/context#set-get}
112328
+ *
112329
+ * @example
112330
+ * ```ts
112331
+ * app.get('/', (c) => {
112332
+ * const message = c.get('message')
112333
+ * return c.text(`The message is "${message}"`)
112334
+ * })
112335
+ * ```
112336
+ */
112026
112337
  get = (key) => {
112027
112338
  return this.#var ? this.#var.get(key) : void 0;
112028
112339
  };
112340
+ /**
112341
+ * `.var` can access the value of a variable.
112342
+ *
112343
+ * @see {@link https://hono.dev/docs/api/context#var}
112344
+ *
112345
+ * @example
112346
+ * ```ts
112347
+ * const result = c.var.client.oneMethod()
112348
+ * ```
112349
+ */
112350
+ // c.var.propName is a read-only
112029
112351
  get var() {
112030
112352
  if (!this.#var) {
112031
112353
  return {};
@@ -112060,7 +112382,40 @@ var Context = class {
112060
112382
  return new Response(data, { status, headers: responseHeaders });
112061
112383
  }
112062
112384
  newResponse = (...args) => this.#newResponse(...args);
112385
+ /**
112386
+ * `.body()` can return the HTTP response.
112387
+ * You can set headers with `.header()` and set HTTP status code with `.status`.
112388
+ * This can also be set in `.text()`, `.json()` and so on.
112389
+ *
112390
+ * @see {@link https://hono.dev/docs/api/context#body}
112391
+ *
112392
+ * @example
112393
+ * ```ts
112394
+ * app.get('/welcome', (c) => {
112395
+ * // Set headers
112396
+ * c.header('X-Message', 'Hello!')
112397
+ * c.header('Content-Type', 'text/plain')
112398
+ * // Set HTTP status code
112399
+ * c.status(201)
112400
+ *
112401
+ * // Return the response body
112402
+ * return c.body('Thank you for coming')
112403
+ * })
112404
+ * ```
112405
+ */
112063
112406
  body = (data, arg, headers) => this.#newResponse(data, arg, headers);
112407
+ /**
112408
+ * `.text()` can render text as `Content-Type:text/plain`.
112409
+ *
112410
+ * @see {@link https://hono.dev/docs/api/context#text}
112411
+ *
112412
+ * @example
112413
+ * ```ts
112414
+ * app.get('/say', (c) => {
112415
+ * return c.text('Hello!')
112416
+ * })
112417
+ * ```
112418
+ */
112064
112419
  text = (text, arg, headers) => {
112065
112420
  return !this.#preparedHeaders && !this.#status && !arg && !headers && !this.finalized ? new Response(text) : this.#newResponse(
112066
112421
  text,
@@ -112068,6 +112423,18 @@ var Context = class {
112068
112423
  setDefaultContentType(TEXT_PLAIN, headers)
112069
112424
  );
112070
112425
  };
112426
+ /**
112427
+ * `.json()` can render JSON as `Content-Type:application/json`.
112428
+ *
112429
+ * @see {@link https://hono.dev/docs/api/context#json}
112430
+ *
112431
+ * @example
112432
+ * ```ts
112433
+ * app.get('/api', (c) => {
112434
+ * return c.json({ message: 'Hello!' })
112435
+ * })
112436
+ * ```
112437
+ */
112071
112438
  json = (object2, arg, headers) => {
112072
112439
  return this.#newResponse(
112073
112440
  JSON.stringify(object2),
@@ -112079,21 +112446,50 @@ var Context = class {
112079
112446
  const res = (html2) => this.#newResponse(html2, arg, setDefaultContentType("text/html; charset=UTF-8", headers));
112080
112447
  return typeof html === "object" ? resolveCallback(html, HtmlEscapedCallbackPhase.Stringify, false, {}).then(res) : res(html);
112081
112448
  };
112449
+ /**
112450
+ * `.redirect()` can Redirect, default status code is 302.
112451
+ *
112452
+ * @see {@link https://hono.dev/docs/api/context#redirect}
112453
+ *
112454
+ * @example
112455
+ * ```ts
112456
+ * app.get('/redirect', (c) => {
112457
+ * return c.redirect('/')
112458
+ * })
112459
+ * app.get('/redirect-permanently', (c) => {
112460
+ * return c.redirect('/', 301)
112461
+ * })
112462
+ * ```
112463
+ */
112082
112464
  redirect = (location, status) => {
112083
112465
  const locationString = String(location);
112084
112466
  this.header(
112085
112467
  "Location",
112468
+ // Multibyes should be encoded
112469
+ // eslint-disable-next-line no-control-regex
112086
112470
  !/[^\x00-\xFF]/.test(locationString) ? locationString : encodeURI(locationString)
112087
112471
  );
112088
112472
  return this.newResponse(null, status ?? 302);
112089
112473
  };
112474
+ /**
112475
+ * `.notFound()` can return the Not Found Response.
112476
+ *
112477
+ * @see {@link https://hono.dev/docs/api/context#notfound}
112478
+ *
112479
+ * @example
112480
+ * ```ts
112481
+ * app.get('/notfound', (c) => {
112482
+ * return c.notFound()
112483
+ * })
112484
+ * ```
112485
+ */
112090
112486
  notFound = () => {
112091
112487
  this.#notFoundHandler ??= () => new Response();
112092
112488
  return this.#notFoundHandler(this);
112093
112489
  };
112094
112490
  };
112095
112491
 
112096
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/router.js
112492
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/router.js
112097
112493
  var METHOD_NAME_ALL = "ALL";
112098
112494
  var METHOD_NAME_ALL_LOWERCASE = "all";
112099
112495
  var METHODS = ["get", "post", "put", "delete", "options", "patch"];
@@ -112101,10 +112497,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
112101
112497
  var UnsupportedPathError = class extends Error {
112102
112498
  };
112103
112499
 
112104
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/utils/constants.js
112500
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/utils/constants.js
112105
112501
  var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
112106
112502
 
112107
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/hono-base.js
112503
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/hono-base.js
112108
112504
  var notFoundHandler = (c2) => {
112109
112505
  return c2.text("404 Not Found", 404);
112110
112506
  };
@@ -112116,7 +112512,7 @@ var errorHandler = (err, c2) => {
112116
112512
  console.error(err);
112117
112513
  return c2.text("Internal Server Error", 500);
112118
112514
  };
112119
- var Hono = class {
112515
+ var Hono = class _Hono {
112120
112516
  get;
112121
112517
  post;
112122
112518
  put;
@@ -112126,8 +112522,13 @@ var Hono = class {
112126
112522
  all;
112127
112523
  on;
112128
112524
  use;
112525
+ /*
112526
+ This class is like an abstract class and does not have a router.
112527
+ To use it, inherit the class and implement router in the constructor.
112528
+ */
112129
112529
  router;
112130
112530
  getPath;
112531
+ // Cannot use `#` because it requires visibility at JavaScript runtime.
112131
112532
  _basePath = "/";
112132
112533
  #path = "/";
112133
112534
  routes = [];
@@ -112174,7 +112575,7 @@ var Hono = class {
112174
112575
  this.getPath = strict ?? true ? options.getPath ?? getPath : getPathNoStrict;
112175
112576
  }
112176
112577
  #clone() {
112177
- const clone3 = new Hono({
112578
+ const clone3 = new _Hono({
112178
112579
  router: this.router,
112179
112580
  getPath: this.getPath
112180
112581
  });
@@ -112184,7 +112585,26 @@ var Hono = class {
112184
112585
  return clone3;
112185
112586
  }
112186
112587
  #notFoundHandler = notFoundHandler;
112588
+ // Cannot use `#` because it requires visibility at JavaScript runtime.
112187
112589
  errorHandler = errorHandler;
112590
+ /**
112591
+ * `.route()` allows grouping other Hono instance in routes.
112592
+ *
112593
+ * @see {@link https://hono.dev/docs/api/routing#grouping}
112594
+ *
112595
+ * @param {string} path - base Path
112596
+ * @param {Hono} app - other Hono instance
112597
+ * @returns {Hono} routed Hono instance
112598
+ *
112599
+ * @example
112600
+ * ```ts
112601
+ * const app = new Hono()
112602
+ * const app2 = new Hono()
112603
+ *
112604
+ * app2.get("/user", (c) => c.text("user"))
112605
+ * app.route("/api", app2) // GET /api/user
112606
+ * ```
112607
+ */
112188
112608
  route(path3, app) {
112189
112609
  const subApp = this.basePath(path3);
112190
112610
  app.routes.map((r2) => {
@@ -112199,19 +112619,95 @@ var Hono = class {
112199
112619
  });
112200
112620
  return this;
112201
112621
  }
112622
+ /**
112623
+ * `.basePath()` allows base paths to be specified.
112624
+ *
112625
+ * @see {@link https://hono.dev/docs/api/routing#base-path}
112626
+ *
112627
+ * @param {string} path - base Path
112628
+ * @returns {Hono} changed Hono instance
112629
+ *
112630
+ * @example
112631
+ * ```ts
112632
+ * const api = new Hono().basePath('/api')
112633
+ * ```
112634
+ */
112202
112635
  basePath(path3) {
112203
112636
  const subApp = this.#clone();
112204
112637
  subApp._basePath = mergePath(this._basePath, path3);
112205
112638
  return subApp;
112206
112639
  }
112640
+ /**
112641
+ * `.onError()` handles an error and returns a customized Response.
112642
+ *
112643
+ * @see {@link https://hono.dev/docs/api/hono#error-handling}
112644
+ *
112645
+ * @param {ErrorHandler} handler - request Handler for error
112646
+ * @returns {Hono} changed Hono instance
112647
+ *
112648
+ * @example
112649
+ * ```ts
112650
+ * app.onError((err, c) => {
112651
+ * console.error(`${err}`)
112652
+ * return c.text('Custom Error Message', 500)
112653
+ * })
112654
+ * ```
112655
+ */
112207
112656
  onError = (handler) => {
112208
112657
  this.errorHandler = handler;
112209
112658
  return this;
112210
112659
  };
112660
+ /**
112661
+ * `.notFound()` allows you to customize a Not Found Response.
112662
+ *
112663
+ * @see {@link https://hono.dev/docs/api/hono#not-found}
112664
+ *
112665
+ * @param {NotFoundHandler} handler - request handler for not-found
112666
+ * @returns {Hono} changed Hono instance
112667
+ *
112668
+ * @example
112669
+ * ```ts
112670
+ * app.notFound((c) => {
112671
+ * return c.text('Custom 404 Message', 404)
112672
+ * })
112673
+ * ```
112674
+ */
112211
112675
  notFound = (handler) => {
112212
112676
  this.#notFoundHandler = handler;
112213
112677
  return this;
112214
112678
  };
112679
+ /**
112680
+ * `.mount()` allows you to mount applications built with other frameworks into your Hono application.
112681
+ *
112682
+ * @see {@link https://hono.dev/docs/api/hono#mount}
112683
+ *
112684
+ * @param {string} path - base Path
112685
+ * @param {Function} applicationHandler - other Request Handler
112686
+ * @param {MountOptions} [options] - options of `.mount()`
112687
+ * @returns {Hono} mounted Hono instance
112688
+ *
112689
+ * @example
112690
+ * ```ts
112691
+ * import { Router as IttyRouter } from 'itty-router'
112692
+ * import { Hono } from 'hono'
112693
+ * // Create itty-router application
112694
+ * const ittyRouter = IttyRouter()
112695
+ * // GET /itty-router/hello
112696
+ * ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
112697
+ *
112698
+ * const app = new Hono()
112699
+ * app.mount('/itty-router', ittyRouter.handle)
112700
+ * ```
112701
+ *
112702
+ * @example
112703
+ * ```ts
112704
+ * const app = new Hono()
112705
+ * // Send the request to another application without modification.
112706
+ * app.mount('/app', anotherApp, {
112707
+ * replaceRequest: (req) => req,
112708
+ * })
112709
+ * ```
112710
+ */
112215
112711
  mount(path3, applicationHandler, options) {
112216
112712
  let replaceRequest;
112217
112713
  let optionHandler;
@@ -112311,9 +112807,32 @@ var Hono = class {
112311
112807
  }
112312
112808
  })();
112313
112809
  }
112810
+ /**
112811
+ * `.fetch()` will be entry point of your app.
112812
+ *
112813
+ * @see {@link https://hono.dev/docs/api/hono#fetch}
112814
+ *
112815
+ * @param {Request} request - request Object of request
112816
+ * @param {Env} Env - env Object
112817
+ * @param {ExecutionContext} - context of execution
112818
+ * @returns {Response | Promise<Response>} response of request
112819
+ *
112820
+ */
112314
112821
  fetch = (request3, ...rest) => {
112315
112822
  return this.#dispatch(request3, rest[1], rest[0], request3.method);
112316
112823
  };
112824
+ /**
112825
+ * `.request()` is a useful method for testing.
112826
+ * You can pass a URL or pathname to send a GET request.
112827
+ * app will return a Response object.
112828
+ * ```ts
112829
+ * test('GET /hello is ok', async () => {
112830
+ * const res = await app.request('/hello')
112831
+ * expect(res.status).toBe(200)
112832
+ * })
112833
+ * ```
112834
+ * @see https://hono.dev/docs/api/hono#request
112835
+ */
112317
112836
  request = (input, requestInit, Env, executionCtx) => {
112318
112837
  if (input instanceof Request) {
112319
112838
  return this.fetch(requestInit ? new Request(input, requestInit) : input, Env, executionCtx);
@@ -112328,6 +112847,23 @@ var Hono = class {
112328
112847
  executionCtx
112329
112848
  );
112330
112849
  };
112850
+ /**
112851
+ * `.fire()` automatically adds a global fetch event listener.
112852
+ * This can be useful for environments that adhere to the Service Worker API, such as non-ES module Cloudflare Workers.
112853
+ * @deprecated
112854
+ * Use `fire` from `hono/service-worker` instead.
112855
+ * ```ts
112856
+ * import { Hono } from 'hono'
112857
+ * import { fire } from 'hono/service-worker'
112858
+ *
112859
+ * const app = new Hono()
112860
+ * // ...
112861
+ * fire(app)
112862
+ * ```
112863
+ * @see https://hono.dev/docs/api/hono#fire
112864
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
112865
+ * @see https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/
112866
+ */
112331
112867
  fire = () => {
112332
112868
  addEventListener("fetch", (event) => {
112333
112869
  event.respondWith(this.#dispatch(event.request, event, void 0, event.request.method));
@@ -112335,7 +112871,7 @@ var Hono = class {
112335
112871
  };
112336
112872
  };
112337
112873
 
112338
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/router/reg-exp-router/matcher.js
112874
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/router/reg-exp-router/matcher.js
112339
112875
  var emptyParam = [];
112340
112876
  function match(method, path3) {
112341
112877
  const matchers = this.buildAllMatchers();
@@ -112356,11 +112892,11 @@ function match(method, path3) {
112356
112892
  return match2(method, path3);
112357
112893
  }
112358
112894
 
112359
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/router/reg-exp-router/node.js
112895
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/router/reg-exp-router/node.js
112360
112896
  var LABEL_REG_EXP_STR = "[^/]+";
112361
112897
  var ONLY_WILDCARD_REG_EXP_STR = ".*";
112362
112898
  var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
112363
- var PATH_ERROR = Symbol();
112899
+ var PATH_ERROR = /* @__PURE__ */ Symbol();
112364
112900
  var regExpMetaChars = new Set(".\\+*[^]$()");
112365
112901
  function compareKey(a2, b2) {
112366
112902
  if (a2.length === 1) {
@@ -112381,7 +112917,7 @@ function compareKey(a2, b2) {
112381
112917
  }
112382
112918
  return a2.length === b2.length ? a2 < b2 ? -1 : 1 : b2.length - a2.length;
112383
112919
  }
112384
- var Node = class {
112920
+ var Node = class _Node {
112385
112921
  #index;
112386
112922
  #varIndex;
112387
112923
  #children = /* @__PURE__ */ Object.create(null);
@@ -112421,7 +112957,7 @@ var Node = class {
112421
112957
  if (pathErrorCheckOnly) {
112422
112958
  return;
112423
112959
  }
112424
- node = this.#children[regexpStr] = new Node();
112960
+ node = this.#children[regexpStr] = new _Node();
112425
112961
  if (name6 !== "") {
112426
112962
  node.#varIndex = context2.varIndex++;
112427
112963
  }
@@ -112440,7 +112976,7 @@ var Node = class {
112440
112976
  if (pathErrorCheckOnly) {
112441
112977
  return;
112442
112978
  }
112443
- node = this.#children[token] = new Node();
112979
+ node = this.#children[token] = new _Node();
112444
112980
  }
112445
112981
  }
112446
112982
  node.insert(restTokens, index, paramMap, context2, pathErrorCheckOnly);
@@ -112464,7 +113000,7 @@ var Node = class {
112464
113000
  }
112465
113001
  };
112466
113002
 
112467
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/router/reg-exp-router/trie.js
113003
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/router/reg-exp-router/trie.js
112468
113004
  var Trie = class {
112469
113005
  #context = { varIndex: 0 };
112470
113006
  #root = new Node();
@@ -112520,7 +113056,7 @@ var Trie = class {
112520
113056
  }
112521
113057
  };
112522
113058
 
112523
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/router/reg-exp-router/router.js
113059
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/router/reg-exp-router/router.js
112524
113060
  var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
112525
113061
  var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
112526
113062
  function buildWildcardRegExp(path3) {
@@ -112699,7 +113235,7 @@ var RegExpRouter = class {
112699
113235
  }
112700
113236
  };
112701
113237
 
112702
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/router/smart-router/router.js
113238
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/router/smart-router/router.js
112703
113239
  var SmartRouter = class {
112704
113240
  name = "SmartRouter";
112705
113241
  #routers = [];
@@ -112754,9 +113290,9 @@ var SmartRouter = class {
112754
113290
  }
112755
113291
  };
112756
113292
 
112757
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/router/trie-router/node.js
113293
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/router/trie-router/node.js
112758
113294
  var emptyParams = /* @__PURE__ */ Object.create(null);
112759
- var Node2 = class {
113295
+ var Node2 = class _Node2 {
112760
113296
  #methods;
112761
113297
  #children;
112762
113298
  #patterns;
@@ -112789,7 +113325,7 @@ var Node2 = class {
112789
113325
  }
112790
113326
  continue;
112791
113327
  }
112792
- curNode.#children[key] = new Node2();
113328
+ curNode.#children[key] = new _Node2();
112793
113329
  if (pattern) {
112794
113330
  curNode.#patterns.push(pattern);
112795
113331
  possibleKeys.push(pattern[1]);
@@ -112912,7 +113448,7 @@ var Node2 = class {
112912
113448
  }
112913
113449
  };
112914
113450
 
112915
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/router/trie-router/router.js
113451
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/router/trie-router/router.js
112916
113452
  var TrieRouter = class {
112917
113453
  name = "TrieRouter";
112918
113454
  #node;
@@ -112934,8 +113470,13 @@ var TrieRouter = class {
112934
113470
  }
112935
113471
  };
112936
113472
 
112937
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/hono.js
113473
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/hono.js
112938
113474
  var Hono2 = class extends Hono {
113475
+ /**
113476
+ * Creates an instance of the Hono class.
113477
+ *
113478
+ * @param options - Optional configuration options for the Hono instance.
113479
+ */
112939
113480
  constructor(options = {}) {
112940
113481
  super(options);
112941
113482
  this.router = options.router ?? new SmartRouter({
@@ -115630,7 +116171,7 @@ function logQuery(event) {
115630
116171
  });
115631
116172
  }
115632
116173
 
115633
- // ../../node_modules/.pnpm/hono@4.10.6/node_modules/hono/dist/helper/factory/index.js
116174
+ // ../../node_modules/.pnpm/hono@4.11.7/node_modules/hono/dist/helper/factory/index.js
115634
116175
  var createMiddleware = (middleware) => middleware;
115635
116176
 
115636
116177
  // src/server/middleware/client-telemetry.ts