@trpc/server 11.0.0-rc.592 → 11.0.0-rc.593

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 (38) hide show
  1. package/dist/bundle-analysis.json +106 -90
  2. package/dist/observable/behaviorSubject.d.ts +15 -0
  3. package/dist/observable/behaviorSubject.d.ts.map +1 -0
  4. package/dist/observable/behaviorSubject.js +40 -0
  5. package/dist/observable/behaviorSubject.mjs +38 -0
  6. package/dist/observable/index.d.ts +3 -3
  7. package/dist/observable/index.d.ts.map +1 -1
  8. package/dist/observable/index.js +4 -0
  9. package/dist/observable/index.mjs +2 -1
  10. package/dist/observable/operators.d.ts +2 -0
  11. package/dist/observable/operators.d.ts.map +1 -1
  12. package/dist/observable/operators.js +35 -0
  13. package/dist/observable/operators.mjs +34 -1
  14. package/dist/unstable-core-do-not-import/http/resolveResponse.d.ts.map +1 -1
  15. package/dist/unstable-core-do-not-import/http/resolveResponse.js +143 -77
  16. package/dist/unstable-core-do-not-import/http/resolveResponse.mjs +145 -79
  17. package/dist/unstable-core-do-not-import/stream/sse.d.ts +21 -20
  18. package/dist/unstable-core-do-not-import/stream/sse.d.ts.map +1 -1
  19. package/dist/unstable-core-do-not-import/stream/sse.js +46 -110
  20. package/dist/unstable-core-do-not-import/stream/sse.mjs +46 -110
  21. package/dist/unstable-core-do-not-import/stream/sse.types.d.ts +31 -0
  22. package/dist/unstable-core-do-not-import/stream/sse.types.d.ts.map +1 -0
  23. package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts +1 -1
  24. package/dist/unstable-core-do-not-import/stream/utils/asyncIterable.d.ts.map +1 -1
  25. package/dist/unstable-core-do-not-import/types.d.ts +5 -0
  26. package/dist/unstable-core-do-not-import/types.d.ts.map +1 -1
  27. package/dist/unstable-core-do-not-import.d.ts +1 -0
  28. package/dist/unstable-core-do-not-import.d.ts.map +1 -1
  29. package/package.json +2 -2
  30. package/src/observable/behaviorSubject.ts +55 -0
  31. package/src/observable/index.ts +22 -3
  32. package/src/observable/operators.ts +47 -0
  33. package/src/unstable-core-do-not-import/http/resolveResponse.ts +169 -97
  34. package/src/unstable-core-do-not-import/stream/sse.ts +87 -152
  35. package/src/unstable-core-do-not-import/stream/sse.types.ts +44 -0
  36. package/src/unstable-core-do-not-import/stream/utils/asyncIterable.ts +1 -1
  37. package/src/unstable-core-do-not-import/types.ts +8 -0
  38. package/src/unstable-core-do-not-import.ts +1 -0
@@ -93,7 +93,42 @@ function tap(observer) {
93
93
  });
94
94
  };
95
95
  }
96
+ const distinctUnsetMarker = Symbol();
97
+ function distinctUntilChanged(compare = (a, b)=>a === b) {
98
+ return (source)=>{
99
+ return observable.observable((destination)=>{
100
+ let lastValue = distinctUnsetMarker;
101
+ return source.subscribe({
102
+ next (value) {
103
+ if (lastValue !== distinctUnsetMarker && compare(lastValue, value)) {
104
+ return;
105
+ }
106
+ lastValue = value;
107
+ destination.next(value);
108
+ },
109
+ error (error) {
110
+ destination.error(error);
111
+ },
112
+ complete () {
113
+ destination.complete();
114
+ }
115
+ });
116
+ });
117
+ };
118
+ }
119
+ const isDeepEqual = (a, b)=>{
120
+ if (a === b) {
121
+ return true;
122
+ }
123
+ const bothAreObjects = a && b && typeof a === 'object' && typeof b === 'object';
124
+ return !!bothAreObjects && Object.keys(a).length === Object.keys(b).length && Object.entries(a).every(([k, v])=>isDeepEqual(v, b[k]));
125
+ };
126
+ function distinctUntilDeepChanged() {
127
+ return distinctUntilChanged(isDeepEqual);
128
+ }
96
129
 
130
+ exports.distinctUntilChanged = distinctUntilChanged;
131
+ exports.distinctUntilDeepChanged = distinctUntilDeepChanged;
97
132
  exports.map = map;
98
133
  exports.share = share;
99
134
  exports.tap = tap;
@@ -91,5 +91,38 @@ function tap(observer) {
91
91
  });
92
92
  };
93
93
  }
94
+ const distinctUnsetMarker = Symbol();
95
+ function distinctUntilChanged(compare = (a, b)=>a === b) {
96
+ return (source)=>{
97
+ return observable((destination)=>{
98
+ let lastValue = distinctUnsetMarker;
99
+ return source.subscribe({
100
+ next (value) {
101
+ if (lastValue !== distinctUnsetMarker && compare(lastValue, value)) {
102
+ return;
103
+ }
104
+ lastValue = value;
105
+ destination.next(value);
106
+ },
107
+ error (error) {
108
+ destination.error(error);
109
+ },
110
+ complete () {
111
+ destination.complete();
112
+ }
113
+ });
114
+ });
115
+ };
116
+ }
117
+ const isDeepEqual = (a, b)=>{
118
+ if (a === b) {
119
+ return true;
120
+ }
121
+ const bothAreObjects = a && b && typeof a === 'object' && typeof b === 'object';
122
+ return !!bothAreObjects && Object.keys(a).length === Object.keys(b).length && Object.entries(a).every(([k, v])=>isDeepEqual(v, b[k]));
123
+ };
124
+ function distinctUntilDeepChanged() {
125
+ return distinctUntilChanged(isDeepEqual);
126
+ }
94
127
 
95
- export { map, share, tap };
128
+ export { distinctUntilChanged, distinctUntilDeepChanged, map, share, tap };
@@ -1 +1 @@
1
- {"version":3,"file":"resolveResponse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/resolveResponse.ts"],"names":[],"mappings":"AAMA,OAAO,EAA2B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,WAAW,CAAC;AAQnB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AA0BjB,UAAU,yBAAyB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,aAAa,EAAE,kCAAkC,CAAC,OAAO,CAAC,CAAC;IAC3D,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AAyID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,CAmcnB"}
1
+ {"version":3,"file":"resolveResponse.d.ts","sourceRoot":"","sources":["../../../src/unstable-core-do-not-import/http/resolveResponse.ts"],"names":[],"mappings":"AAMA,OAAO,EAA2B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAExE,OAAO,EACL,KAAK,SAAS,EAGf,MAAM,WAAW,CAAC;AAanB,OAAO,KAAK,EACV,sBAAsB,EACtB,kCAAkC,EAEnC,MAAM,SAAS,CAAC;AAqCjB,UAAU,yBAAyB,CAAC,OAAO,SAAS,SAAS,CAC3D,SAAQ,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC;IAChD,aAAa,EAAE,kCAAkC,CAAC,OAAO,CAAC,CAAC;IAC3D,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB;AA2ID,wBAAsB,eAAe,CAAC,OAAO,SAAS,SAAS,EAC7D,IAAI,EAAE,yBAAyB,CAAC,OAAO,CAAC,GACvC,OAAO,CAAC,QAAQ,CAAC,CAyfnB"}
@@ -10,6 +10,17 @@ var utils = require('../utils.js');
10
10
  var contentType = require('./contentType.js');
11
11
  var getHTTPStatusCode = require('./getHTTPStatusCode.js');
12
12
 
13
+ function errorToAsyncIterable(err) {
14
+ return {
15
+ [Symbol.asyncIterator]: ()=>{
16
+ return {
17
+ next () {
18
+ throw err;
19
+ }
20
+ };
21
+ }
22
+ };
23
+ }
13
24
  const TYPE_ACCEPTED_METHOD_MAP = {
14
25
  mutation: [
15
26
  'POST'
@@ -137,8 +148,62 @@ async function resolveResponse(opts) {
137
148
  }
138
149
  const allowBatching = opts.allowBatching ?? opts.batching?.enabled ?? true;
139
150
  const allowMethodOverride = (opts.allowMethodOverride ?? false) && req.method === 'POST';
140
- let ctx = undefined;
141
- let info = undefined;
151
+ const infoTuple = utils.run(()=>{
152
+ try {
153
+ return [
154
+ undefined,
155
+ contentType.getRequestInfo({
156
+ req,
157
+ path: decodeURIComponent(opts.path),
158
+ router,
159
+ searchParams: url.searchParams,
160
+ headers: opts.req.headers
161
+ })
162
+ ];
163
+ } catch (cause) {
164
+ return [
165
+ TRPCError.getTRPCErrorFromUnknown(cause),
166
+ undefined
167
+ ];
168
+ }
169
+ });
170
+ const ctxManager = utils.run(()=>{
171
+ let result = undefined;
172
+ return {
173
+ valueOrUndefined: ()=>{
174
+ if (!result) {
175
+ return undefined;
176
+ }
177
+ return result[1];
178
+ },
179
+ value: ()=>{
180
+ const [err, ctx] = result;
181
+ if (err) {
182
+ throw err;
183
+ }
184
+ return ctx;
185
+ },
186
+ create: async (info)=>{
187
+ if (result) {
188
+ throw new Error('This should only be called once - report a bug in tRPC');
189
+ }
190
+ try {
191
+ const ctx = await opts.createContext({
192
+ info
193
+ });
194
+ result = [
195
+ undefined,
196
+ ctx
197
+ ];
198
+ } catch (cause) {
199
+ result = [
200
+ TRPCError.getTRPCErrorFromUnknown(cause),
201
+ undefined
202
+ ];
203
+ }
204
+ }
205
+ };
206
+ });
142
207
  const methodMapper = allowMethodOverride ? TYPE_ACCEPTED_METHOD_MAP_WITH_METHOD_OVERRIDE : TYPE_ACCEPTED_METHOD_MAP;
143
208
  /**
144
209
  * @deprecated
@@ -146,19 +211,9 @@ async function resolveResponse(opts) {
146
211
  const experimentalIterablesAndDeferreds = router._def._config.experimental?.iterablesAndDeferreds ?? true;
147
212
  const experimentalSSE = router._def._config.experimental?.sseSubscriptions?.enabled ?? true;
148
213
  try {
149
- info = contentType.getRequestInfo({
150
- req,
151
- path: decodeURIComponent(opts.path),
152
- router,
153
- searchParams: url.searchParams,
154
- headers: opts.req.headers
155
- });
156
- // we create context early so that error handlers may access context information
157
- ctx = await opts.createContext({
158
- info
159
- });
160
- if (opts.error) {
161
- throw opts.error;
214
+ const [infoError, info] = infoTuple;
215
+ if (infoError) {
216
+ throw infoError;
162
217
  }
163
218
  if (info.isBatchCall && !allowBatching) {
164
219
  throw new TRPCError.TRPCError({
@@ -172,9 +227,13 @@ async function resolveResponse(opts) {
172
227
  code: 'BAD_REQUEST'
173
228
  });
174
229
  }
230
+ await ctxManager.create(info);
175
231
  const rpcCalls = info.calls.map(async (call)=>{
176
232
  const proc = call.procedure;
177
233
  try {
234
+ if (opts.error) {
235
+ throw opts.error;
236
+ }
178
237
  if (!proc) {
179
238
  throw new TRPCError.TRPCError({
180
239
  code: 'NOT_FOUND',
@@ -187,7 +246,6 @@ async function resolveResponse(opts) {
187
246
  message: `Unsupported ${req.method}-request to ${proc._def.type} procedure at path "${call.path}"`
188
247
  });
189
248
  }
190
- let abortCtrl;
191
249
  if (proc._def.type === 'subscription') {
192
250
  /* istanbul ignore if -- @preserve */ if (info.isBatchCall) {
193
251
  throw new TRPCError.TRPCError({
@@ -195,19 +253,20 @@ async function resolveResponse(opts) {
195
253
  message: `Cannot batch subscription calls`
196
254
  });
197
255
  }
198
- abortCtrl = new AbortController();
199
256
  }
257
+ const abortCtrl = new AbortController();
200
258
  const data = await proc({
201
259
  path: call.path,
202
260
  getRawInput: call.getRawInput,
203
- ctx,
261
+ ctx: ctxManager.value(),
204
262
  type: proc._def.type,
205
- signal: abortCtrl ? utils.abortSignalsAnyPonyfill([
263
+ signal: utils.abortSignalsAnyPonyfill([
206
264
  opts.req.signal,
207
265
  abortCtrl.signal
208
- ]) : opts.req.signal
266
+ ])
209
267
  });
210
268
  return [
269
+ undefined,
211
270
  {
212
271
  data,
213
272
  abortCtrl
@@ -220,20 +279,20 @@ async function resolveResponse(opts) {
220
279
  error,
221
280
  path: call.path,
222
281
  input,
223
- ctx,
282
+ ctx: ctxManager.valueOrUndefined(),
224
283
  type: call.procedure?._def.type ?? 'unknown',
225
284
  req: opts.req
226
285
  });
227
286
  return [
228
- null,
229
- error
287
+ error,
288
+ undefined
230
289
  ];
231
290
  }
232
291
  });
233
292
  // ----------- response handlers -----------
234
293
  if (!info.isBatchCall) {
235
294
  const [call] = info.calls;
236
- const [result, error] = await rpcCalls[0];
295
+ const [error, result] = await rpcCalls[0];
237
296
  switch(info.type){
238
297
  case 'unknown':
239
298
  case 'mutation':
@@ -250,7 +309,7 @@ async function resolveResponse(opts) {
250
309
  const res = error ? {
251
310
  error: getErrorShape.getErrorShape({
252
311
  config,
253
- ctx,
312
+ ctx: ctxManager.valueOrUndefined(),
254
313
  error,
255
314
  input: call.result(),
256
315
  path: call.path,
@@ -262,7 +321,7 @@ async function resolveResponse(opts) {
262
321
  }
263
322
  };
264
323
  const headResponse = initResponse({
265
- ctx,
324
+ ctx: ctxManager.valueOrUndefined(),
266
325
  info,
267
326
  responseMeta: opts.responseMeta,
268
327
  errors: error ? [
@@ -281,48 +340,49 @@ async function resolveResponse(opts) {
281
340
  case 'subscription':
282
341
  {
283
342
  // httpSubscriptionLink
284
- if (!experimentalSSE) {
285
- throw new TRPCError.TRPCError({
286
- code: 'METHOD_NOT_SUPPORTED',
287
- message: 'Missing experimental flag "sseSubscriptions"'
288
- });
289
- }
290
- if (error) {
291
- throw error;
292
- }
293
- const { data , abortCtrl } = result;
294
- utils.assert(abortCtrl !== undefined, 'subscription type must have an AbortController');
295
- if (!observable.isObservable(data) && !utils.isAsyncIterable(data)) {
296
- throw new TRPCError.TRPCError({
297
- message: `Subscription ${call.path} did not return an observable or a AsyncGenerator`,
298
- code: 'INTERNAL_SERVER_ERROR'
299
- });
300
- }
301
- const dataAsIterable = observable.isObservable(data) ? observable.observableToAsyncIterable(data) : data;
343
+ const iterable = utils.run(()=>{
344
+ if (error) {
345
+ return errorToAsyncIterable(error);
346
+ }
347
+ if (!experimentalSSE) {
348
+ return errorToAsyncIterable(new TRPCError.TRPCError({
349
+ code: 'METHOD_NOT_SUPPORTED',
350
+ message: 'Missing experimental flag "sseSubscriptions"'
351
+ }));
352
+ }
353
+ if (!observable.isObservable(result.data) && !utils.isAsyncIterable(result.data)) {
354
+ return errorToAsyncIterable(new TRPCError.TRPCError({
355
+ message: `Subscription ${call.path} did not return an observable or a AsyncGenerator`,
356
+ code: 'INTERNAL_SERVER_ERROR'
357
+ }));
358
+ }
359
+ const dataAsIterable = observable.isObservable(result.data) ? observable.observableToAsyncIterable(result.data) : result.data;
360
+ return dataAsIterable;
361
+ });
302
362
  const stream = sse.sseStreamProducer({
303
363
  ...config.experimental?.sseSubscriptions,
304
- data: dataAsIterable,
305
- abortCtrl,
364
+ data: iterable,
365
+ abortCtrl: result?.abortCtrl ?? new AbortController(),
306
366
  serialize: (v)=>config.transformer.output.serialize(v),
307
367
  formatError (errorOpts) {
308
368
  const error = TRPCError.getTRPCErrorFromUnknown(errorOpts.error);
309
369
  const input = call?.result();
310
370
  const path = call?.path;
311
371
  const type = call?.procedure?._def.type ?? 'unknown';
312
- const shape = getErrorShape.getErrorShape({
313
- config,
314
- ctx,
372
+ opts.onError?.({
315
373
  error,
316
- input,
317
374
  path,
375
+ input,
376
+ ctx: ctxManager.valueOrUndefined(),
377
+ req: opts.req,
318
378
  type
319
379
  });
320
- opts.onError?.({
380
+ const shape = getErrorShape.getErrorShape({
381
+ config,
382
+ ctx: ctxManager.valueOrUndefined(),
321
383
  error,
322
- path,
323
384
  input,
324
- ctx,
325
- req: opts.req,
385
+ path,
326
386
  type
327
387
  });
328
388
  return shape;
@@ -332,7 +392,7 @@ async function resolveResponse(opts) {
332
392
  headers.set(key, value);
333
393
  }
334
394
  const headResponse1 = initResponse({
335
- ctx,
395
+ ctx: ctxManager.valueOrUndefined(),
336
396
  info,
337
397
  responseMeta: opts.responseMeta,
338
398
  errors: [],
@@ -352,7 +412,7 @@ async function resolveResponse(opts) {
352
412
  headers.set('content-type', 'application/json');
353
413
  headers.set('transfer-encoding', 'chunked');
354
414
  const headResponse2 = initResponse({
355
- ctx,
415
+ ctx: ctxManager.valueOrUndefined(),
356
416
  info,
357
417
  responseMeta: opts.responseMeta,
358
418
  errors: [],
@@ -374,13 +434,13 @@ async function resolveResponse(opts) {
374
434
  * }
375
435
  */ maxDepth: experimentalIterablesAndDeferreds ? 4 : 3,
376
436
  data: rpcCalls.map(async (res)=>{
377
- const [result, error] = await res;
437
+ const [error, result] = await res;
378
438
  const call = info.calls[0];
379
439
  if (error) {
380
440
  return {
381
441
  error: getErrorShape.getErrorShape({
382
442
  config,
383
- ctx,
443
+ ctx: ctxManager.valueOrUndefined(),
384
444
  error,
385
445
  input: call.result(),
386
446
  path: call.path,
@@ -388,14 +448,13 @@ async function resolveResponse(opts) {
388
448
  })
389
449
  };
390
450
  }
391
- const { data } = result;
392
451
  /**
393
452
  * Not very pretty, but we need to wrap nested data in promises
394
453
  * Our stream producer will only resolve top-level async values or async values that are directly nested in another async value
395
- */ const dataAsPromiseOrIterable = observable.isObservable(data) ? observable.observableToAsyncIterable(data) : Promise.resolve(data);
454
+ */ const iterable = observable.isObservable(result.data) ? observable.observableToAsyncIterable(result.data) : Promise.resolve(result.data);
396
455
  return {
397
456
  result: Promise.resolve({
398
- data: dataAsPromiseOrIterable
457
+ data: iterable
399
458
  })
400
459
  };
401
460
  }),
@@ -405,20 +464,25 @@ async function resolveResponse(opts) {
405
464
  error: TRPCError.getTRPCErrorFromUnknown(cause),
406
465
  path: undefined,
407
466
  input: undefined,
408
- ctx,
467
+ ctx: ctxManager.valueOrUndefined(),
409
468
  req: opts.req,
410
469
  type: info?.type ?? 'unknown'
411
470
  });
412
471
  },
413
472
  formatError (errorOpts) {
414
473
  const call = info?.calls[errorOpts.path[0]];
474
+ const error = TRPCError.getTRPCErrorFromUnknown(errorOpts.error);
475
+ const input = call?.result();
476
+ const path = call?.path;
477
+ const type = call?.procedure?._def.type ?? 'unknown';
478
+ // no need to call `onError` here as it will be propagated through the stream itself
415
479
  const shape = getErrorShape.getErrorShape({
416
480
  config,
417
- ctx,
418
- error: TRPCError.getTRPCErrorFromUnknown(errorOpts.error),
419
- input: call?.result(),
420
- path: call?.path,
421
- type: call?.procedure?._def.type ?? 'unknown'
481
+ ctx: ctxManager.valueOrUndefined(),
482
+ error,
483
+ input,
484
+ path,
485
+ type
422
486
  });
423
487
  return shape;
424
488
  }
@@ -436,28 +500,28 @@ async function resolveResponse(opts) {
436
500
  * - return a complete HTTPResponse
437
501
  */ headers.set('content-type', 'application/json');
438
502
  const results = (await Promise.all(rpcCalls)).map((res)=>{
439
- const [result, error] = res;
503
+ const [error, result] = res;
440
504
  if (error) {
441
505
  return res;
442
506
  }
443
507
  if (isDataStream(result.data)) {
444
508
  return [
445
- null,
446
509
  new TRPCError.TRPCError({
447
510
  code: 'UNSUPPORTED_MEDIA_TYPE',
448
511
  message: 'Cannot use stream-like response in non-streaming request - use httpBatchStreamLink'
449
- })
512
+ }),
513
+ undefined
450
514
  ];
451
515
  }
452
516
  return res;
453
517
  });
454
- const resultAsRPCResponse = results.map(([result, error], index)=>{
518
+ const resultAsRPCResponse = results.map(([error, result], index)=>{
455
519
  const call = info.calls[index];
456
520
  if (error) {
457
521
  return {
458
522
  error: getErrorShape.getErrorShape({
459
523
  config,
460
- ctx,
524
+ ctx: ctxManager.valueOrUndefined(),
461
525
  error,
462
526
  input: call.result(),
463
527
  path: call.path,
@@ -471,9 +535,9 @@ async function resolveResponse(opts) {
471
535
  }
472
536
  };
473
537
  });
474
- const errors = results.map(([_, error])=>error).filter(Boolean);
538
+ const errors = results.map(([error])=>error).filter(Boolean);
475
539
  const headResponse3 = initResponse({
476
- ctx,
540
+ ctx: ctxManager.valueOrUndefined(),
477
541
  info,
478
542
  responseMeta: opts.responseMeta,
479
543
  untransformedJSON: resultAsRPCResponse,
@@ -485,6 +549,8 @@ async function resolveResponse(opts) {
485
549
  headers
486
550
  });
487
551
  } catch (cause) {
552
+ const [_infoError, info1] = infoTuple;
553
+ const ctx = ctxManager.valueOrUndefined();
488
554
  // we get here if
489
555
  // - batching is called when it's not enabled
490
556
  // - `createContext()` throws
@@ -494,12 +560,12 @@ async function resolveResponse(opts) {
494
560
  // - `errorFormatter` return value is malformed
495
561
  const { error: error1 , untransformedJSON , body } = caughtErrorToData(cause, {
496
562
  opts,
497
- ctx,
498
- type: info?.type ?? 'unknown'
563
+ ctx: ctxManager.valueOrUndefined(),
564
+ type: info1?.type ?? 'unknown'
499
565
  });
500
566
  const headResponse4 = initResponse({
501
567
  ctx,
502
- info,
568
+ info: info1,
503
569
  responseMeta: opts.responseMeta,
504
570
  untransformedJSON,
505
571
  errors: [