@temporary-name/server 1.9.3-alpha.e09726e1bf5340c7b7052eeabcb4935b3c85ce93 → 1.9.3-alpha.e098b3d1c5bffbad2fadfda89ba01f6452db46b5

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 (34) hide show
  1. package/dist/adapters/aws-lambda/index.d.mts +3 -4
  2. package/dist/adapters/aws-lambda/index.d.ts +3 -4
  3. package/dist/adapters/aws-lambda/index.mjs +4 -6
  4. package/dist/adapters/fetch/index.d.mts +3 -4
  5. package/dist/adapters/fetch/index.d.ts +3 -4
  6. package/dist/adapters/fetch/index.mjs +4 -6
  7. package/dist/adapters/node/index.d.mts +3 -4
  8. package/dist/adapters/node/index.d.ts +3 -4
  9. package/dist/adapters/node/index.mjs +4 -6
  10. package/dist/adapters/standard/index.d.mts +20 -32
  11. package/dist/adapters/standard/index.d.ts +20 -32
  12. package/dist/adapters/standard/index.mjs +4 -6
  13. package/dist/index.d.mts +69 -339
  14. package/dist/index.d.ts +69 -339
  15. package/dist/index.mjs +132 -357
  16. package/dist/openapi/index.d.mts +1 -1
  17. package/dist/openapi/index.d.ts +1 -1
  18. package/dist/openapi/index.mjs +60 -77
  19. package/dist/plugins/index.d.mts +4 -54
  20. package/dist/plugins/index.d.ts +4 -54
  21. package/dist/plugins/index.mjs +2 -115
  22. package/dist/shared/{server.BeuTpcmO.d.mts → server.7aL9gcoU.d.mts} +2 -2
  23. package/dist/shared/server.BL2R5jcp.d.mts +228 -0
  24. package/dist/shared/server.BL2R5jcp.d.ts +228 -0
  25. package/dist/shared/{server.DLsti1Pv.mjs → server.CVBLzkro.mjs} +57 -95
  26. package/dist/shared/server.ClhVCxfg.mjs +413 -0
  27. package/dist/shared/{server.CQyYNJ1H.d.ts → server.D6Qs_UcF.d.mts} +2 -4
  28. package/dist/shared/{server.SLLuK6_v.d.ts → server.DFptr1Nz.d.ts} +2 -2
  29. package/dist/shared/{server.C1fnTLq0.d.mts → server.DpoO_ER_.d.ts} +2 -4
  30. package/dist/shared/{server.BEHw7Eyx.mjs → server.JtIZ8YG7.mjs} +1 -11
  31. package/package.json +10 -9
  32. package/dist/shared/server.BKSOrA6h.d.mts +0 -192
  33. package/dist/shared/server.BKSOrA6h.d.ts +0 -192
  34. package/dist/shared/server.BKh8I1Ny.mjs +0 -239
@@ -1,7 +1,7 @@
1
1
  import { isProcedure, resolveContractProcedures, ORPCError, createRouterClient } from '@temporary-name/server';
2
- import { fallbackContractConfig, getEventIteratorSchemaDetails } from '@temporary-name/contract';
2
+ import { standardizeHTTPPath, fallbackContractConfig, getDynamicParams, getEventIteratorSchemaDetails } from '@temporary-name/contract';
3
3
  import { isObject, stringifyJSON, findDeepMatches, toArray, clone, value, toHttpPath, isORPCErrorStatus, fallbackORPCErrorStatus, fallbackORPCErrorMessage, resolveMaybeOptionalOptions, createORPCErrorFromJson } from '@temporary-name/shared';
4
- import { a as standardizeHTTPPath, j as jsonSerialize, g as getDynamicParams, d as deserialize, s as serialize } from '../shared/server.BEHw7Eyx.mjs';
4
+ import { j as jsonSerialize, d as deserialize, s as serialize } from '../shared/server.JtIZ8YG7.mjs';
5
5
  import '@temporary-name/standard-server';
6
6
  import { TypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
7
7
  export { ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
@@ -530,94 +530,77 @@ ${errors.join("\n\n")}`
530
530
  }
531
531
  async #request(doc, ref, def, baseSchemaConvertOptions) {
532
532
  const method = fallbackContractConfig("defaultMethod", def.route.method);
533
- const details = getEventIteratorSchemaDetails(def.inputSchema);
534
- if (details) {
535
- ref.requestBody = {
536
- required: true,
537
- content: toOpenAPIEventIteratorContent(
538
- await this.converter.convert(details.yields, { ...baseSchemaConvertOptions, strategy: "input" }),
539
- await this.converter.convert(details.returns, { ...baseSchemaConvertOptions, strategy: "input" })
540
- )
541
- };
542
- return;
543
- }
544
533
  const dynamicParams = getDynamicParams(def.route.path)?.map((v) => v.name);
545
- const inputStructure = fallbackContractConfig("defaultInputStructure", def.route.inputStructure);
546
- let [required, schema] = await this.converter.convert(def.inputSchema, {
534
+ const [_pathRequired, pathSchema] = await this.converter.convert(def.schemas.pathSchema, {
547
535
  ...baseSchemaConvertOptions,
548
536
  strategy: "input",
549
- minStructureDepthForRef: dynamicParams?.length || inputStructure === "detailed" ? 1 : 0
537
+ minStructureDepthForRef: 1
550
538
  });
551
- if (isAnySchema(schema) && !dynamicParams?.length) {
552
- return;
553
- }
554
- if (inputStructure === "compact") {
555
- if (dynamicParams?.length) {
556
- const error2 = new OpenAPIGeneratorError(
557
- 'When input structure is "compact", and path has dynamic params, input schema must be an object with all dynamic params as required.'
558
- );
559
- if (!isObjectSchema(schema)) {
560
- throw error2;
561
- }
562
- const [paramsSchema, rest] = separateObjectSchema(schema, dynamicParams);
563
- schema = rest;
564
- required = rest.required ? rest.required.length !== 0 : false;
565
- if (!checkParamsSchema(paramsSchema, dynamicParams)) {
566
- throw error2;
567
- }
568
- ref.parameters ??= [];
569
- ref.parameters.push(...toOpenAPIParameters(paramsSchema, "path"));
539
+ if (dynamicParams?.length) {
540
+ const error = new OpenAPIGeneratorError(
541
+ // TODO: fix this error
542
+ 'When input structure is "compact", and path has dynamic params, input schema must be an object with all dynamic params as required.'
543
+ );
544
+ if (!isObjectSchema(pathSchema)) {
545
+ throw error;
570
546
  }
571
- if (method === "GET") {
572
- const resolvedSchema = resolveOpenAPIJsonSchemaRef(doc, schema);
573
- if (!isObjectSchema(resolvedSchema)) {
574
- throw new OpenAPIGeneratorError(
575
- 'When method is "GET", input schema must satisfy: object | any | unknown'
576
- );
577
- }
578
- ref.parameters ??= [];
579
- ref.parameters.push(...toOpenAPIParameters(resolvedSchema, "query"));
580
- } else {
581
- ref.requestBody = {
582
- required,
583
- content: toOpenAPIContent(schema)
584
- };
547
+ if (!checkParamsSchema(pathSchema, dynamicParams)) {
548
+ throw error;
549
+ }
550
+ ref.parameters ??= [];
551
+ ref.parameters.push(...toOpenAPIParameters(pathSchema, "path"));
552
+ } else {
553
+ const error = new OpenAPIGeneratorError("Params set via path do not match those on the route");
554
+ if (!isObjectSchema(pathSchema)) {
555
+ console.log("FOO", pathSchema);
556
+ throw error;
557
+ }
558
+ if (!checkParamsSchema(pathSchema, [])) {
559
+ console.log("BAR", pathSchema);
560
+ throw error;
585
561
  }
586
- return;
587
- }
588
- const error = new OpenAPIGeneratorError(
589
- 'When input structure is "detailed", input schema must satisfy: { params?: Record<string, unknown>, query?: Record<string, unknown>, headers?: Record<string, unknown>, body?: unknown }'
590
- );
591
- if (!isObjectSchema(schema)) {
592
- throw error;
593
562
  }
594
- const resolvedParamSchema = schema.properties?.params !== void 0 ? resolveOpenAPIJsonSchemaRef(doc, schema.properties.params) : void 0;
595
- if (dynamicParams?.length && (resolvedParamSchema === void 0 || !isObjectSchema(resolvedParamSchema) || !checkParamsSchema(resolvedParamSchema, dynamicParams))) {
596
- throw new OpenAPIGeneratorError(
597
- 'When input structure is "detailed" and path has dynamic params, the "params" schema must be an object with all dynamic params as required.'
598
- );
563
+ const [_queryRequired, querySchema] = await this.converter.convert(def.schemas.querySchema, {
564
+ ...baseSchemaConvertOptions,
565
+ strategy: "input",
566
+ minStructureDepthForRef: 0
567
+ });
568
+ if (!isAnySchema(querySchema)) {
569
+ const resolvedSchema = resolveOpenAPIJsonSchemaRef(doc, querySchema);
570
+ if (!isObjectSchema(resolvedSchema)) {
571
+ throw new OpenAPIGeneratorError("Query param schema must satisfy: object | any | unknown");
572
+ }
573
+ ref.parameters ??= [];
574
+ ref.parameters.push(...toOpenAPIParameters(resolvedSchema, "query"));
599
575
  }
600
- for (const from of ["params", "query", "headers"]) {
601
- const fromSchema = schema.properties?.[from];
602
- if (fromSchema !== void 0) {
603
- const resolvedSchema = resolveOpenAPIJsonSchemaRef(doc, fromSchema);
604
- if (!isObjectSchema(resolvedSchema)) {
605
- throw error;
576
+ if (method !== "GET") {
577
+ const details = getEventIteratorSchemaDetails(def.schemas.bodySchema);
578
+ if (details) {
579
+ ref.requestBody = {
580
+ required: true,
581
+ content: toOpenAPIEventIteratorContent(
582
+ await this.converter.convert(details.yields, { ...baseSchemaConvertOptions, strategy: "input" }),
583
+ await this.converter.convert(details.returns, { ...baseSchemaConvertOptions, strategy: "input" })
584
+ )
585
+ };
586
+ } else {
587
+ const [bodyRequired, bodySchema] = await this.converter.convert(def.schemas.bodySchema, {
588
+ ...baseSchemaConvertOptions,
589
+ strategy: "input",
590
+ minStructureDepthForRef: 0
591
+ });
592
+ if (isAnySchema(bodySchema)) {
593
+ return;
606
594
  }
607
- const parameterIn = from === "params" ? "path" : from === "headers" ? "header" : "query";
608
- ref.parameters ??= [];
609
- ref.parameters.push(...toOpenAPIParameters(resolvedSchema, parameterIn));
595
+ ref.requestBody = {
596
+ required: bodyRequired,
597
+ content: toOpenAPIContent(bodySchema)
598
+ };
610
599
  }
611
600
  }
612
- if (schema.properties?.body !== void 0) {
613
- ref.requestBody = {
614
- required: schema.required?.includes("body"),
615
- content: toOpenAPIContent(schema.properties.body)
616
- };
617
- }
618
601
  }
619
602
  async #successResponse(doc, ref, def, baseSchemaConvertOptions) {
620
- const outputSchema = def.outputSchema;
603
+ const outputSchema = def.schemas.outputSchema;
621
604
  const status = fallbackContractConfig("defaultSuccessStatus", def.route.successStatus);
622
605
  const description = fallbackContractConfig("defaultSuccessDescription", def.route?.successDescription);
623
606
  const eventIteratorSchemaDetails = getEventIteratorSchemaDetails(outputSchema);
@@ -1,58 +1,8 @@
1
1
  import { Value, Promisable, ORPCError } from '@temporary-name/shared';
2
- import { StandardRequest, StandardHeaders } from '@temporary-name/standard-server';
3
- import { BatchResponseBodyItem } from '@temporary-name/standard-server/batch';
4
- import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.C1fnTLq0.mjs';
5
- import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.BKSOrA6h.mjs';
2
+ import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.D6Qs_UcF.mjs';
3
+ import { C as Context, G as ProcedureClientInterceptorOptions } from '../shared/server.BL2R5jcp.mjs';
6
4
  import { Meta } from '@temporary-name/contract';
7
5
 
8
- interface BatchHandlerOptions<T extends Context> {
9
- /**
10
- * The max size of the batch allowed.
11
- *
12
- * @default 10
13
- */
14
- maxSize?: Value<Promisable<number>, [StandardHandlerInterceptorOptions<T>]>;
15
- /**
16
- * Map the request before processing it.
17
- *
18
- * @default merged back batch request headers into the request
19
- */
20
- mapRequestItem?(request: StandardRequest, batchOptions: StandardHandlerInterceptorOptions<T>): StandardRequest;
21
- /**
22
- * Success batch response status code.
23
- *
24
- * @default 207
25
- */
26
- successStatus?: Value<Promisable<number>, [
27
- responses: Promise<BatchResponseBodyItem>[],
28
- batchOptions: StandardHandlerInterceptorOptions<T>
29
- ]>;
30
- /**
31
- * success batch response headers.
32
- *
33
- * @default {}
34
- */
35
- headers?: Value<Promisable<StandardHeaders>, [
36
- responses: Promise<BatchResponseBodyItem>[],
37
- batchOptions: StandardHandlerInterceptorOptions<T>
38
- ]>;
39
- }
40
- /**
41
- * The Batch Requests Plugin allows you to combine multiple requests and responses into a single batch,
42
- * reducing the overhead of sending each one separately.
43
- *
44
- * @see {@link https://orpc.unnoq.com/docs/plugins/batch-requests Batch Requests Plugin Docs}
45
- */
46
- declare class BatchHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
47
- private readonly maxSize;
48
- private readonly mapRequestItem;
49
- private readonly successStatus;
50
- private readonly headers;
51
- order: number;
52
- constructor(options?: BatchHandlerOptions<T>);
53
- init(options: StandardHandlerOptions<T>): void;
54
- }
55
-
56
6
  interface CORSOptions<T extends Context> {
57
7
  origin?: Value<Promisable<string | readonly string[] | null | undefined>, [
58
8
  origin: string,
@@ -156,5 +106,5 @@ declare class SimpleCsrfProtectionHandlerPlugin<T extends Context> implements St
156
106
  init(options: StandardHandlerOptions<T>): void;
157
107
  }
158
108
 
159
- export { BatchHandlerPlugin, CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin };
160
- export type { BatchHandlerOptions, CORSOptions, RequestHeadersPluginContext, ResponseHeadersPluginContext, SimpleCsrfProtectionHandlerPluginOptions };
109
+ export { CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin };
110
+ export type { CORSOptions, RequestHeadersPluginContext, ResponseHeadersPluginContext, SimpleCsrfProtectionHandlerPluginOptions };
@@ -1,58 +1,8 @@
1
1
  import { Value, Promisable, ORPCError } from '@temporary-name/shared';
2
- import { StandardRequest, StandardHeaders } from '@temporary-name/standard-server';
3
- import { BatchResponseBodyItem } from '@temporary-name/standard-server/batch';
4
- import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.CQyYNJ1H.js';
5
- import { C as Context, E as ProcedureClientInterceptorOptions } from '../shared/server.BKSOrA6h.js';
2
+ import { S as StandardHandlerInterceptorOptions, a as StandardHandlerPlugin, b as StandardHandlerOptions } from '../shared/server.DpoO_ER_.js';
3
+ import { C as Context, G as ProcedureClientInterceptorOptions } from '../shared/server.BL2R5jcp.js';
6
4
  import { Meta } from '@temporary-name/contract';
7
5
 
8
- interface BatchHandlerOptions<T extends Context> {
9
- /**
10
- * The max size of the batch allowed.
11
- *
12
- * @default 10
13
- */
14
- maxSize?: Value<Promisable<number>, [StandardHandlerInterceptorOptions<T>]>;
15
- /**
16
- * Map the request before processing it.
17
- *
18
- * @default merged back batch request headers into the request
19
- */
20
- mapRequestItem?(request: StandardRequest, batchOptions: StandardHandlerInterceptorOptions<T>): StandardRequest;
21
- /**
22
- * Success batch response status code.
23
- *
24
- * @default 207
25
- */
26
- successStatus?: Value<Promisable<number>, [
27
- responses: Promise<BatchResponseBodyItem>[],
28
- batchOptions: StandardHandlerInterceptorOptions<T>
29
- ]>;
30
- /**
31
- * success batch response headers.
32
- *
33
- * @default {}
34
- */
35
- headers?: Value<Promisable<StandardHeaders>, [
36
- responses: Promise<BatchResponseBodyItem>[],
37
- batchOptions: StandardHandlerInterceptorOptions<T>
38
- ]>;
39
- }
40
- /**
41
- * The Batch Requests Plugin allows you to combine multiple requests and responses into a single batch,
42
- * reducing the overhead of sending each one separately.
43
- *
44
- * @see {@link https://orpc.unnoq.com/docs/plugins/batch-requests Batch Requests Plugin Docs}
45
- */
46
- declare class BatchHandlerPlugin<T extends Context> implements StandardHandlerPlugin<T> {
47
- private readonly maxSize;
48
- private readonly mapRequestItem;
49
- private readonly successStatus;
50
- private readonly headers;
51
- order: number;
52
- constructor(options?: BatchHandlerOptions<T>);
53
- init(options: StandardHandlerOptions<T>): void;
54
- }
55
-
56
6
  interface CORSOptions<T extends Context> {
57
7
  origin?: Value<Promisable<string | readonly string[] | null | undefined>, [
58
8
  origin: string,
@@ -156,5 +106,5 @@ declare class SimpleCsrfProtectionHandlerPlugin<T extends Context> implements St
156
106
  init(options: StandardHandlerOptions<T>): void;
157
107
  }
158
108
 
159
- export { BatchHandlerPlugin, CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin };
160
- export type { BatchHandlerOptions, CORSOptions, RequestHeadersPluginContext, ResponseHeadersPluginContext, SimpleCsrfProtectionHandlerPluginOptions };
109
+ export { CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin };
110
+ export type { CORSOptions, RequestHeadersPluginContext, ResponseHeadersPluginContext, SimpleCsrfProtectionHandlerPluginOptions };
@@ -1,120 +1,7 @@
1
- import { runWithSpan, value, setSpanError, isAsyncIteratorObject, AsyncIteratorClass, clone, ORPCError } from '@temporary-name/shared';
1
+ import { value, clone, ORPCError } from '@temporary-name/shared';
2
2
  import { flattenHeader } from '@temporary-name/standard-server';
3
- import { parseBatchRequest, toBatchResponse } from '@temporary-name/standard-server/batch';
4
3
  import { toFetchHeaders } from '@temporary-name/standard-server-fetch';
5
4
 
6
- class BatchHandlerPlugin {
7
- maxSize;
8
- mapRequestItem;
9
- successStatus;
10
- headers;
11
- order = 5e6;
12
- constructor(options = {}) {
13
- this.maxSize = options.maxSize ?? 10;
14
- this.mapRequestItem = options.mapRequestItem ?? ((request, { request: batchRequest }) => ({
15
- ...request,
16
- headers: {
17
- ...batchRequest.headers,
18
- ...request.headers
19
- }
20
- }));
21
- this.successStatus = options.successStatus ?? 207;
22
- this.headers = options.headers ?? {};
23
- }
24
- init(options) {
25
- options.rootInterceptors ??= [];
26
- options.rootInterceptors.unshift(async (options2) => {
27
- const xHeader = flattenHeader(options2.request.headers["x-orpc-batch"]);
28
- if (xHeader === void 0) {
29
- return options2.next();
30
- }
31
- let isParsing = false;
32
- try {
33
- return await runWithSpan({ name: "handle_batch_request" }, async (span) => {
34
- const mode = xHeader === "buffered" ? "buffered" : "streaming";
35
- isParsing = true;
36
- const parsed = parseBatchRequest({ ...options2.request, body: await options2.request.body() });
37
- isParsing = false;
38
- span?.setAttribute("batch.mode", mode);
39
- span?.setAttribute("batch.size", parsed.length);
40
- const maxSize = await value(this.maxSize, options2);
41
- if (parsed.length > maxSize) {
42
- const message = "Batch request size exceeds the maximum allowed size";
43
- setSpanError(span, message);
44
- return {
45
- matched: true,
46
- response: {
47
- status: 413,
48
- headers: {},
49
- body: message
50
- }
51
- };
52
- }
53
- const responses = parsed.map((request, index) => {
54
- const mapped = this.mapRequestItem(request, options2);
55
- return options2.next({ ...options2, request: { ...mapped, body: () => Promise.resolve(mapped.body) } }).then(({ response: response2, matched }) => {
56
- span?.addEvent(`response.${index}.${matched ? "success" : "not_matched"}`);
57
- if (matched) {
58
- if (response2.body instanceof Blob || response2.body instanceof FormData || isAsyncIteratorObject(response2.body)) {
59
- return {
60
- index,
61
- status: 500,
62
- headers: {},
63
- body: "Batch responses do not support file/blob, or event-iterator. Please call this procedure separately outside of the batch request."
64
- };
65
- }
66
- return { ...response2, index };
67
- }
68
- return { index, status: 404, headers: {}, body: "No procedure matched" };
69
- }).catch((err) => {
70
- Promise.reject(err);
71
- return { index, status: 500, headers: {}, body: "Internal server error" };
72
- });
73
- });
74
- await Promise.race(responses);
75
- const status = await value(this.successStatus, responses, options2);
76
- const headers = await value(this.headers, responses, options2);
77
- const promises = [...responses];
78
- const response = await toBatchResponse({
79
- status,
80
- headers,
81
- mode,
82
- body: new AsyncIteratorClass(
83
- async () => {
84
- const handling = promises.filter((p) => p !== void 0);
85
- if (handling.length <= 0) {
86
- return { done: true, value: void 0 };
87
- }
88
- const value2 = await Promise.race(handling);
89
- promises[value2.index] = void 0;
90
- return { done: false, value: value2 };
91
- },
92
- async () => {
93
- }
94
- )
95
- });
96
- return {
97
- matched: true,
98
- response
99
- };
100
- });
101
- } catch (cause) {
102
- if (isParsing) {
103
- return {
104
- matched: true,
105
- response: {
106
- status: 400,
107
- headers: {},
108
- body: "Invalid batch request, this could be caused by a malformed request body or a missing header"
109
- }
110
- };
111
- }
112
- throw cause;
113
- }
114
- });
115
- }
116
- }
117
-
118
5
  class CORSPlugin {
119
6
  options;
120
7
  order = 9e6;
@@ -285,4 +172,4 @@ class SimpleCsrfProtectionHandlerPlugin {
285
172
  }
286
173
  }
287
174
 
288
- export { BatchHandlerPlugin, CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin };
175
+ export { CORSPlugin, RequestHeadersPlugin, ResponseHeadersPlugin, SimpleCsrfProtectionHandlerPlugin };
@@ -1,6 +1,6 @@
1
1
  import { HTTPPath } from '@temporary-name/shared';
2
- import { C as Context } from './server.BKSOrA6h.mjs';
3
- import { c as StandardHandleOptions } from './server.C1fnTLq0.mjs';
2
+ import { C as Context } from './server.BL2R5jcp.mjs';
3
+ import { c as StandardHandleOptions } from './server.D6Qs_UcF.mjs';
4
4
 
5
5
  type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
6
6
  context?: T;