@openapi-qraft/react 2.0.0-next.0 → 2.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +3 -6
- package/dist/types/Unstable_QraftSecureRequestFn.d.ts +1 -1
- package/dist/types/Unstable_QraftSecureRequestFn.d.ts.map +1 -1
- package/dist/types/callbacks/getInfiniteQueryKey.d.ts +1 -1
- package/dist/types/callbacks/getInfiniteQueryKey.d.ts.map +1 -1
- package/dist/types/callbacks/getMutationKey.d.ts +1 -1
- package/dist/types/callbacks/getMutationKey.d.ts.map +1 -1
- package/dist/types/callbacks/getQueryKey.d.ts +1 -1
- package/dist/types/callbacks/getQueryKey.d.ts.map +1 -1
- package/dist/types/migrate-to-v2-codemod.d.ts +3 -0
- package/dist/types/migrate-to-v2-codemod.d.ts.map +1 -0
- package/dist/types/qraftPredefinedParametersRequestFn.d.ts +19 -0
- package/dist/types/qraftPredefinedParametersRequestFn.d.ts.map +1 -0
- package/dist/types/service-operation/ServiceOperationGetQueryState.d.ts +4 -3
- package/dist/types/service-operation/ServiceOperationGetQueryState.d.ts.map +1 -1
- package/package.json +11 -4
- package/src/migrate-to-v2-codemod.ts +118 -0
- package/src/qraftPredefinedParametersRequestFn.ts +149 -0
- package/src/service-operation/ServiceOperationGetQueryState.ts +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @openapi-qraft/react
|
|
2
2
|
|
|
3
|
+
## 2.0.0-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 56191e1: Updated the `getQueryState(...)` function to support being invoked without parameters if they are not required. This enhancement simplifies the usage in scenarios where the parameters are optional, providing a more flexible API.
|
|
8
|
+
- bbcac65: Refined all types related to value in the `qraftPredefinedParametersRequestFn(...)` function.
|
|
9
|
+
|
|
10
|
+
## 2.0.0-next.1
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 76634bf: ### Changeset: `createPredefinedParametersRequestFn`
|
|
15
|
+
|
|
16
|
+
Introduced `createPredefinedParametersRequestFn`, generated by the `@openapi-qraft/cli` using
|
|
17
|
+
the `--operation-predefined-parameters` option.
|
|
18
|
+
This function allows for the automatic application of predefined
|
|
19
|
+
parameters to selected API operations by wrapping the base `requestFn`. It simplifies managing parameters, reducing
|
|
20
|
+
boilerplate code, and supports both static and dynamic values, enhancing flexibility in API request handling.
|
|
21
|
+
|
|
3
22
|
## 2.0.0-next.0
|
|
4
23
|
|
|
5
24
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Read the full documentation at [openapi-qraft.github.io/openapi-qraft](https://o
|
|
|
23
23
|
First, install the core package for your project:
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npm install @openapi-qraft/react
|
|
26
|
+
npm install @openapi-qraft/react@next
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
If your project doesn't already include `@tanstack/react-query`, you'll also need to install it. This package is
|
|
@@ -47,7 +47,7 @@ and schemas from your OpenAPI Document.
|
|
|
47
47
|
To generate both TypeScript definitions and services using `openapi-qraft`, run the following command in the root directory of your project:
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
npx @openapi-qraft/cli --plugin tanstack-query-react --plugin openapi-typescript https://api.dev.monite.com/openapi.json?version=2023-09-01 --output-dir src/api
|
|
50
|
+
npx @openapi-qraft/cli@next --plugin tanstack-query-react --plugin openapi-typescript https://api.dev.monite.com/openapi.json?version=2023-09-01 --output-dir src/api
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
By completing this step, you will generate `src/api/schema.d.ts`, which serves as a TypeScript representation of the specified OpenAPI,
|
|
@@ -75,11 +75,9 @@ Finally, provide the request client to the `QraftContext` to enable the generate
|
|
|
75
75
|
Every request will be handled by `request` function, which can be customized to fit your project's needs.
|
|
76
76
|
|
|
77
77
|
```tsx
|
|
78
|
-
import { useMemo } from 'react';
|
|
79
|
-
|
|
80
78
|
import { QraftContext, requestFn } from '@openapi-qraft/react';
|
|
81
79
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
82
|
-
|
|
80
|
+
import { useMemo } from 'react';
|
|
83
81
|
// where `./api` is the '--output-dir' path to the services you generated with `@openapi-qraft/cli`
|
|
84
82
|
import { createAPIClient } from './api';
|
|
85
83
|
|
|
@@ -599,7 +597,6 @@ using a custom `fetchToken` async function.
|
|
|
599
597
|
|
|
600
598
|
```tsx
|
|
601
599
|
import { QraftContext, requestFn } from '@openapi-qraft/react';
|
|
602
|
-
|
|
603
600
|
import { fetchToken } from './auth';
|
|
604
601
|
|
|
605
602
|
function QraftProvider({ children }: { children: React.ReactNode }) {
|
|
@@ -11,7 +11,7 @@ export interface QraftSecureRequestFnProps extends QraftSecureRequestFnBaseProps
|
|
|
11
11
|
queryClient?: QueryClient;
|
|
12
12
|
}
|
|
13
13
|
export declare function QraftSecureRequestFn({ children, requestFn, securitySchemes, queryClient: inQueryClient, }: QraftSecureRequestFnProps): import("react").FunctionComponentElement<{
|
|
14
|
-
children?: ReactNode;
|
|
14
|
+
children?: ReactNode | undefined;
|
|
15
15
|
}>;
|
|
16
16
|
export declare const useSecuritySchemeAuth: ({ securitySchemes, requestFn, queryClient, }: QraftSecureRequestFnBaseProps & {
|
|
17
17
|
queryClient: QueryClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Unstable_QraftSecureRequestFn.d.ts","sourceRoot":"","sources":["../../src/Unstable_QraftSecureRequestFn.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAc,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAA2B,SAAS,EAAsB,MAAM,OAAO,CAAC;AAG/E,UAAU,6BAA6B;IACrC,SAAS,CAAC,KAAK,EAAE,MAAM,EACrB,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,aAAa,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,eAAe,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;CACjD;AAED,KAAK,SAAS,GAAG,6BAA6B,CAAC,WAAW,CAAC,CAAC;AAE5D,MAAM,WAAW,yBACf,SAAQ,6BAA6B;IACrC,QAAQ,CACN,eAAe,EAAE,6BAA6B,CAAC,WAAW,CAAC,GAC1D,SAAS,CAAC;IACb,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,SAAS,EACT,eAAe,EACf,WAAW,EAAE,aAAa,GAC3B,EAAE,yBAAyB;;GAkC3B;AAED,eAAO,MAAM,qBAAqB;
|
|
1
|
+
{"version":3,"file":"Unstable_QraftSecureRequestFn.d.ts","sourceRoot":"","sources":["../../src/Unstable_QraftSecureRequestFn.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAc,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAA2B,SAAS,EAAsB,MAAM,OAAO,CAAC;AAG/E,UAAU,6BAA6B;IACrC,SAAS,CAAC,KAAK,EAAE,MAAM,EACrB,MAAM,EAAE,eAAe,EACvB,WAAW,EAAE,aAAa,EAC1B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,eAAe,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAC;CACjD;AAED,KAAK,SAAS,GAAG,6BAA6B,CAAC,WAAW,CAAC,CAAC;AAE5D,MAAM,WAAW,yBACf,SAAQ,6BAA6B;IACrC,QAAQ,CACN,eAAe,EAAE,6BAA6B,CAAC,WAAW,CAAC,GAC1D,SAAS,CAAC;IACb,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,SAAS,EACT,eAAe,EACf,WAAW,EAAE,aAAa,GAC3B,EAAE,yBAAyB;;GAkC3B;AAED,eAAO,MAAM,qBAAqB,iDAI/B,6BAA6B,GAAG;IACjC,WAAW,EAAE,WAAW,CAAC;CAC1B,KAAG,SAwBH,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,eAAe,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAC/C,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,GACvB,SAAS,CA+BX;AA6HD;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,GAAG,SAAS,WAmBlD;AAED,KAAK,cAAc,GACf,oBAAoB,GACpB,mBAAmB,GACnB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,oBAAoB,GAC5B,MAAM,CAAC,yBAAyB,GAChC;IACE,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEN,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IAEpB,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,yCAAyC;IACzC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC;IACvB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,yCAAyC;IACzC,EAAE,EAAE,QAAQ,CAAC;IACb,wCAAwC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,KAAK,qBAAqB,GAAG,CAAC,KAAK,EAAE;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,WAAW,CAAC;CACrB,KAAK,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE/C,MAAM,MAAM,sBAAsB,CAAC,kBAAkB,SAAS,MAAM,IAAI;KACrE,GAAG,IAAI,kBAAkB,GAAG,qBAAqB;CACnD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
2
2
|
import { CreateAPIBasicClientOptions } from '../qraftAPIClient.js';
|
|
3
3
|
import { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
4
|
-
export declare const getInfiniteQueryKey: (_qraftOptions: CreateAPIBasicClientOptions, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>[
|
|
4
|
+
export declare const getInfiniteQueryKey: (_qraftOptions: CreateAPIBasicClientOptions, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>["getInfiniteQueryKey"]>) => import("../service-operation/ServiceOperationKey.js").ServiceOperationInfiniteQueryKey<OperationSchema, unknown>;
|
|
5
5
|
//# sourceMappingURL=getInfiniteQueryKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getInfiniteQueryKey.d.ts","sourceRoot":"","sources":["../../../src/callbacks/getInfiniteQueryKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,eAAO,MAAM,mBAAmB,kBACf,2BAA2B,UAClC,eAAe,QACjB,
|
|
1
|
+
{"version":3,"file":"getInfiniteQueryKey.d.ts","sourceRoot":"","sources":["../../../src/callbacks/getInfiniteQueryKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAEjF,eAAO,MAAM,mBAAmB,kBACf,2BAA2B,UAClC,eAAe,QACjB,UAAU,CACd,qBAAqB,CACnB,eAAe,EACf,OAAO,EACP,OAAO,CACR,CAAC,qBAAqB,CAAC,CACzB,qHAGF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
2
2
|
import type { CreateAPIBasicClientOptions } from '../qraftAPIClient.js';
|
|
3
3
|
import type { ServiceOperationMutation } from '../service-operation/ServiceOperation.js';
|
|
4
|
-
export declare const getMutationKey: (_qraftOptions: CreateAPIBasicClientOptions, schema: OperationSchema, args: Parameters<ServiceOperationMutation<OperationSchema, unknown, unknown, unknown>[
|
|
4
|
+
export declare const getMutationKey: (_qraftOptions: CreateAPIBasicClientOptions, schema: OperationSchema, args: Parameters<ServiceOperationMutation<OperationSchema, unknown, unknown, unknown>["getMutationKey"]>) => [OperationSchema, unknown];
|
|
5
5
|
//# sourceMappingURL=getMutationKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMutationKey.d.ts","sourceRoot":"","sources":["../../../src/callbacks/getMutationKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAGzF,eAAO,MAAM,cAAc,kBACV,2BAA2B,UAClC,eAAe,QACjB,
|
|
1
|
+
{"version":3,"file":"getMutationKey.d.ts","sourceRoot":"","sources":["../../../src/callbacks/getMutationKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AAGzF,eAAO,MAAM,cAAc,kBACV,2BAA2B,UAClC,eAAe,QACjB,UAAU,CACd,wBAAwB,CACtB,eAAe,EACf,OAAO,EACP,OAAO,EACP,OAAO,CACR,CAAC,gBAAgB,CAAC,CACpB,+BAGF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OperationSchema } from '../lib/requestFn.js';
|
|
2
2
|
import type { CreateAPIBasicClientOptions } from '../qraftAPIClient.js';
|
|
3
3
|
import type { ServiceOperationQuery } from '../service-operation/ServiceOperation.js';
|
|
4
|
-
export declare const getQueryKey: (_qraftOptions: CreateAPIBasicClientOptions, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>[
|
|
4
|
+
export declare const getQueryKey: (_qraftOptions: CreateAPIBasicClientOptions, schema: OperationSchema, args: Parameters<ServiceOperationQuery<OperationSchema, unknown, unknown>["getQueryKey"]>) => import("../service-operation/ServiceOperationKey.js").ServiceOperationQueryKey<OperationSchema, unknown>;
|
|
5
5
|
//# sourceMappingURL=getQueryKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryKey.d.ts","sourceRoot":"","sources":["../../../src/callbacks/getQueryKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAGtF,eAAO,MAAM,WAAW,kBACP,2BAA2B,UAClC,eAAe,QACjB,
|
|
1
|
+
{"version":3,"file":"getQueryKey.d.ts","sourceRoot":"","sources":["../../../src/callbacks/getQueryKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AAGtF,eAAO,MAAM,WAAW,kBACP,2BAA2B,UAClC,eAAe,QACjB,UAAU,CACd,qBAAqB,CAAC,eAAe,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,aAAa,CAAC,CACxE,6GAGF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-to-v2-codemod.d.ts","sourceRoot":"","sources":["../../src/migrate-to-v2-codemod.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EAGH,QAAQ,EAER,OAAO,EACR,MAAM,aAAa,CAAC;AAErB,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,IAAI,EAAE,QAAQ,EACd,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,UA2EjB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RequestFn } from './lib/requestFn.js';
|
|
2
|
+
export type QraftPredefinedParameterValue<TValue> = TValue | (() => Promise<TValue | undefined>) | undefined;
|
|
3
|
+
export type InputPredefinedParametersItem<TValue> = {
|
|
4
|
+
requestPattern: string;
|
|
5
|
+
parameters: Array<{
|
|
6
|
+
in: 'header' | 'query' | 'cookie';
|
|
7
|
+
name: string;
|
|
8
|
+
value: QraftPredefinedParameterValue<TValue>;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
type TargetPredefinedParametersMethods = 'get' | 'post' | 'put' | 'patch' | 'delete' | 'options' | 'head' | 'trace';
|
|
12
|
+
export type TargetPredefinedParametersItem = {
|
|
13
|
+
requestPattern: string;
|
|
14
|
+
methods: Array<TargetPredefinedParametersMethods> | ReadonlyArray<Readonly<TargetPredefinedParametersMethods>>;
|
|
15
|
+
paths: Array<string> | ReadonlyArray<Readonly<string>>;
|
|
16
|
+
};
|
|
17
|
+
export declare function qraftPredefinedParametersRequestFn<TInputPredefinedParametersItem extends InputPredefinedParametersItem<any>, TData, TError>(inputPredefinedParameters: Array<TInputPredefinedParametersItem> | ReadonlyArray<Readonly<TInputPredefinedParametersItem>>, targetPredefinedParameters: Array<TargetPredefinedParametersItem> | ReadonlyArray<Readonly<TargetPredefinedParametersItem>>, requestFn: RequestFn<TData, TError>): RequestFn<TData, TError>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=qraftPredefinedParametersRequestFn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qraftPredefinedParametersRequestFn.d.ts","sourceRoot":"","sources":["../../src/qraftPredefinedParametersRequestFn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAG5B,MAAM,MAAM,6BAA6B,CAAC,MAAM,IAC5C,MAAM,GACN,CAAC,MAAM,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,GACnC,SAAS,CAAC;AAEd,MAAM,MAAM,6BAA6B,CAAC,MAAM,IAAI;IAClD,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,KAAK,CAAC;QAChB,EAAE,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;QAClC,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,6BAA6B,CAAC,MAAM,CAAC,CAAC;KAC9C,CAAC,CAAC;CACJ,CAAC;AAEF,KAAK,iCAAiC,GAClC,KAAK,GACL,MAAM,GACN,KAAK,GACL,OAAO,GACP,QAAQ,GACR,SAAS,GACT,MAAM,GACN,OAAO,CAAC;AAEZ,MAAM,MAAM,8BAA8B,GAAG;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EACH,KAAK,CAAC,iCAAiC,CAAC,GACxC,aAAa,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC,CAAC;IAC/D,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;CACxD,CAAC;AAEF,wBAAgB,kCAAkC,CAChD,8BAA8B,SAAS,6BAA6B,CAAC,GAAG,CAAC,EACzE,KAAK,EACL,MAAM,EAEN,yBAAyB,EACrB,KAAK,CAAC,8BAA8B,CAAC,GACrC,aAAa,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,EAC3D,0BAA0B,EACtB,KAAK,CAAC,8BAA8B,CAAC,GACrC,aAAa,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,EAC3D,SAAS,EAAE,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,GAClC,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,CA6C1B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { DefaultError, QueryState } from '@tanstack/query-core';
|
|
2
2
|
import type { OperationInfiniteData } from './OperationInfiniteData.js';
|
|
3
3
|
import type { ServiceOperationInfiniteQueryKey, ServiceOperationQueryKey } from './ServiceOperationKey.js';
|
|
4
|
+
import { AreAllOptional } from '../lib/AreAllOptional.js';
|
|
4
5
|
export interface ServiceOperationGetQueryState<TSchema extends {
|
|
5
6
|
url: string;
|
|
6
7
|
method: string;
|
|
7
|
-
}, TData, TParams
|
|
8
|
-
getQueryState(parameters: TParams | ServiceOperationQueryKey<TSchema, TParams>): QueryState<TData, TError> | undefined;
|
|
9
|
-
getInfiniteQueryState(parameters: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>): QueryState<OperationInfiniteData<TData, TParams>, TError> | undefined;
|
|
8
|
+
}, TData, TParams, TError = DefaultError> {
|
|
9
|
+
getQueryState(parameters: AreAllOptional<TParams> extends true ? TParams | ServiceOperationQueryKey<TSchema, TParams> | void : TParams | ServiceOperationQueryKey<TSchema, TParams>): QueryState<TData, TError> | undefined;
|
|
10
|
+
getInfiniteQueryState(parameters: AreAllOptional<TParams> extends true ? TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams> | void : TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>): QueryState<OperationInfiniteData<TData, TParams>, TError> | undefined;
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=ServiceOperationGetQueryState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceOperationGetQueryState.d.ts","sourceRoot":"","sources":["../../../src/service-operation/ServiceOperationGetQueryState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EACV,gCAAgC,EAChC,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"ServiceOperationGetQueryState.d.ts","sourceRoot":"","sources":["../../../src/service-operation/ServiceOperationGetQueryState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EACV,gCAAgC,EAChC,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,WAAW,6BAA6B,CAC5C,OAAO,SAAS;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC/C,KAAK,EACL,OAAO,EACP,MAAM,GAAG,YAAY;IAErB,aAAa,CACX,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,SAAS,IAAI,GAC5C,OAAO,GAAG,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,IAAI,GAC3D,OAAO,GAAG,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,GACvD,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;IAEzC,qBAAqB,CACnB,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,SAAS,IAAI,GAC5C,OAAO,GAAG,gCAAgC,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,IAAI,GACnE,OAAO,GAAG,gCAAgC,CAAC,OAAO,EAAE,OAAO,CAAC,GAC/D,UAAU,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC;CAC1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openapi-qraft/react",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.2",
|
|
4
4
|
"description": "API client for React, providing type-safe requests and dynamic Tanstack Query React Hooks via a modular, Proxy-based architecture.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "NODE_ENV=production rollup --config rollup.config.mjs && tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
@@ -15,20 +15,22 @@
|
|
|
15
15
|
},
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@openapi-qraft/cli": "2.0.0-next.
|
|
18
|
+
"@openapi-qraft/cli": "2.0.0-next.2",
|
|
19
19
|
"@openapi-qraft/eslint-config": "1.0.0",
|
|
20
|
-
"@openapi-qraft/openapi-typescript-plugin": "^1.
|
|
21
|
-
"@openapi-qraft/rollup-config": "1.0.0",
|
|
20
|
+
"@openapi-qraft/openapi-typescript-plugin": "^1.2.0-next.2",
|
|
21
|
+
"@openapi-qraft/rollup-config": "1.1.0-next.0",
|
|
22
22
|
"@openapi-qraft/test-fixtures": "1.0.0",
|
|
23
23
|
"@tanstack/react-query": "^5.17.3",
|
|
24
24
|
"@testing-library/jest-dom": "^5.17.0",
|
|
25
25
|
"@testing-library/react": "^13.4.0",
|
|
26
26
|
"@testing-library/user-event": "^14.5.2",
|
|
27
|
+
"@types/jscodeshift": "^0.11.11",
|
|
27
28
|
"@types/react": "^18.2.47",
|
|
28
29
|
"@vitejs/plugin-react": "latest",
|
|
29
30
|
"@vitest/coverage-v8": "^1.1.3",
|
|
30
31
|
"eslint": "^9.0.0",
|
|
31
32
|
"globals": "^15.0.0",
|
|
33
|
+
"jscodeshift": "^17.0.0",
|
|
32
34
|
"jsdom": "latest",
|
|
33
35
|
"msw": "^2.0.12",
|
|
34
36
|
"prettier": "^3.3.3",
|
|
@@ -66,6 +68,11 @@
|
|
|
66
68
|
"require": "./dist/cjs/Unstable_QraftSecureRequestFn.cjs",
|
|
67
69
|
"types": "./dist/types/Unstable_QraftSecureRequestFn.d.ts"
|
|
68
70
|
},
|
|
71
|
+
"./qraftPredefinedParametersRequestFn": {
|
|
72
|
+
"import": "./dist/esm/qraftPredefinedParametersRequestFn.js",
|
|
73
|
+
"require": "./dist/cjs/qraftPredefinedParametersRequestFn.cjs",
|
|
74
|
+
"types": "./dist/types/qraftPredefinedParametersRequestFn.d.ts"
|
|
75
|
+
},
|
|
69
76
|
"./package.json": "./package.json"
|
|
70
77
|
},
|
|
71
78
|
"typesVersions": {
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
API,
|
|
3
|
+
ASTPath,
|
|
4
|
+
CallExpression,
|
|
5
|
+
FileInfo,
|
|
6
|
+
MemberExpression,
|
|
7
|
+
Options,
|
|
8
|
+
} from 'jscodeshift';
|
|
9
|
+
|
|
10
|
+
export default function transformer(
|
|
11
|
+
file: FileInfo,
|
|
12
|
+
api: API,
|
|
13
|
+
options: Options
|
|
14
|
+
) {
|
|
15
|
+
const j = api.jscodeshift;
|
|
16
|
+
const root = j(file.source);
|
|
17
|
+
|
|
18
|
+
const methodNames = [
|
|
19
|
+
'fetchQuery',
|
|
20
|
+
'fetchInfiniteQuery',
|
|
21
|
+
'prefetchQuery',
|
|
22
|
+
'prefetchInfiniteQuery',
|
|
23
|
+
'getQueryData',
|
|
24
|
+
'getQueriesData',
|
|
25
|
+
'setQueryData',
|
|
26
|
+
'getQueryState',
|
|
27
|
+
'setQueriesData',
|
|
28
|
+
'invalidateQueries',
|
|
29
|
+
'refetchQueries',
|
|
30
|
+
'cancelQueries',
|
|
31
|
+
'removeQueries',
|
|
32
|
+
'resetQueries',
|
|
33
|
+
'isFetching',
|
|
34
|
+
'isMutating',
|
|
35
|
+
'setInfiniteQueryData',
|
|
36
|
+
'getInfiniteQueryData',
|
|
37
|
+
'getInfiniteQueryState',
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const hooksWithTwoArgs = [
|
|
41
|
+
'useSuspenseQueries',
|
|
42
|
+
'useIsFetching',
|
|
43
|
+
'useMutationState',
|
|
44
|
+
'useIsMutating',
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const hooksWithThreeArgs = [
|
|
48
|
+
'useQuery',
|
|
49
|
+
'useMutation',
|
|
50
|
+
'useInfiniteQuery',
|
|
51
|
+
'useQueries',
|
|
52
|
+
'useSuspenseQuery',
|
|
53
|
+
'useSuspenseInfiniteQuery',
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
const apiClientVariableNames = getAPIClientVariableNames(options);
|
|
57
|
+
|
|
58
|
+
return root
|
|
59
|
+
.find(j.CallExpression)
|
|
60
|
+
.forEach((path: ASTPath<CallExpression>) => {
|
|
61
|
+
const callee = path.node.callee;
|
|
62
|
+
if (callee.type === 'MemberExpression') {
|
|
63
|
+
const apiClientCallMethodName = getAPIClientCallMethodName(
|
|
64
|
+
callee,
|
|
65
|
+
apiClientVariableNames
|
|
66
|
+
);
|
|
67
|
+
if (apiClientCallMethodName) {
|
|
68
|
+
if (methodNames.includes(apiClientCallMethodName)) {
|
|
69
|
+
// Remove the last argument `queryClient`
|
|
70
|
+
path.node.arguments = path.node.arguments.slice(0, -1);
|
|
71
|
+
} else if (
|
|
72
|
+
hooksWithTwoArgs.includes(apiClientCallMethodName) &&
|
|
73
|
+
path.node.arguments.length === 2
|
|
74
|
+
) {
|
|
75
|
+
// Remove the second argument for specific hooks if there are exactly two arguments
|
|
76
|
+
path.node.arguments = path.node.arguments.slice(0, 1);
|
|
77
|
+
} else if (
|
|
78
|
+
hooksWithThreeArgs.includes(apiClientCallMethodName) &&
|
|
79
|
+
path.node.arguments.length === 3
|
|
80
|
+
) {
|
|
81
|
+
// Remove the third argument for specific hooks if there are exactly three arguments
|
|
82
|
+
path.node.arguments = path.node.arguments.slice(0, 2);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
.toSource();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function getAPIClientCallMethodName(
|
|
91
|
+
node: MemberExpression,
|
|
92
|
+
apiClientNames: string[]
|
|
93
|
+
): string | undefined {
|
|
94
|
+
if (
|
|
95
|
+
node.object.type === 'MemberExpression' &&
|
|
96
|
+
node.object.object.type === 'MemberExpression' &&
|
|
97
|
+
node.object.object.object.type === 'Identifier' &&
|
|
98
|
+
node.object.object.property.type === 'Identifier' &&
|
|
99
|
+
node.object.property.type === 'Identifier' &&
|
|
100
|
+
node.property.type === 'Identifier'
|
|
101
|
+
) {
|
|
102
|
+
const apiClientVariableName = node.object.object.object.name;
|
|
103
|
+
|
|
104
|
+
if (apiClientNames.includes(apiClientVariableName))
|
|
105
|
+
return node.property.name;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function getAPIClientVariableNames(options: Options) {
|
|
110
|
+
const apiClientVariableNameOption = options['api-client-variable-name'];
|
|
111
|
+
|
|
112
|
+
if (!apiClientVariableNameOption) return ['api', 'qraft'];
|
|
113
|
+
|
|
114
|
+
return String(apiClientVariableNameOption)
|
|
115
|
+
.split(',')
|
|
116
|
+
.map((name) => name.trim())
|
|
117
|
+
.filter(Boolean);
|
|
118
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
OperationSchema,
|
|
3
|
+
RequestFn,
|
|
4
|
+
RequestFnInfo,
|
|
5
|
+
RequestFnOptions,
|
|
6
|
+
RequestFnResponse,
|
|
7
|
+
} from './lib/requestFn.js';
|
|
8
|
+
import { shelfMerge } from './lib/shelfMerge.js';
|
|
9
|
+
|
|
10
|
+
export type QraftPredefinedParameterValue<TValue> =
|
|
11
|
+
| TValue
|
|
12
|
+
| (() => Promise<TValue | undefined>)
|
|
13
|
+
| undefined;
|
|
14
|
+
|
|
15
|
+
export type InputPredefinedParametersItem<TValue> = {
|
|
16
|
+
requestPattern: string;
|
|
17
|
+
parameters: Array<{
|
|
18
|
+
in: 'header' | 'query' | 'cookie';
|
|
19
|
+
name: string;
|
|
20
|
+
value: QraftPredefinedParameterValue<TValue>;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type TargetPredefinedParametersMethods =
|
|
25
|
+
| 'get'
|
|
26
|
+
| 'post'
|
|
27
|
+
| 'put'
|
|
28
|
+
| 'patch'
|
|
29
|
+
| 'delete'
|
|
30
|
+
| 'options'
|
|
31
|
+
| 'head'
|
|
32
|
+
| 'trace';
|
|
33
|
+
|
|
34
|
+
export type TargetPredefinedParametersItem = {
|
|
35
|
+
requestPattern: string;
|
|
36
|
+
methods:
|
|
37
|
+
| Array<TargetPredefinedParametersMethods>
|
|
38
|
+
| ReadonlyArray<Readonly<TargetPredefinedParametersMethods>>;
|
|
39
|
+
paths: Array<string> | ReadonlyArray<Readonly<string>>;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export function qraftPredefinedParametersRequestFn<
|
|
43
|
+
TInputPredefinedParametersItem extends InputPredefinedParametersItem<any>,
|
|
44
|
+
TData,
|
|
45
|
+
TError,
|
|
46
|
+
>(
|
|
47
|
+
inputPredefinedParameters:
|
|
48
|
+
| Array<TInputPredefinedParametersItem>
|
|
49
|
+
| ReadonlyArray<Readonly<TInputPredefinedParametersItem>>,
|
|
50
|
+
targetPredefinedParameters:
|
|
51
|
+
| Array<TargetPredefinedParametersItem>
|
|
52
|
+
| ReadonlyArray<Readonly<TargetPredefinedParametersItem>>,
|
|
53
|
+
requestFn: RequestFn<TData, TError>
|
|
54
|
+
): RequestFn<TData, TError> {
|
|
55
|
+
return function predefinedParametersRequestFn(
|
|
56
|
+
schema: OperationSchema,
|
|
57
|
+
requestInfo: RequestFnInfo,
|
|
58
|
+
options?: RequestFnOptions
|
|
59
|
+
): Promise<RequestFnResponse<TData, TError>> {
|
|
60
|
+
const matchingInputPredefinedParameters =
|
|
61
|
+
targetPredefinedParameters.flatMap((targetParameter) =>
|
|
62
|
+
targetParameter.paths.includes(schema.url) &&
|
|
63
|
+
(!targetParameter.methods.length ||
|
|
64
|
+
targetParameter.methods.includes(schema.method))
|
|
65
|
+
? inputPredefinedParameters.filter(
|
|
66
|
+
(predefinedParameter) =>
|
|
67
|
+
predefinedParameter.requestPattern ===
|
|
68
|
+
targetParameter.requestPattern
|
|
69
|
+
)
|
|
70
|
+
: []
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
if (!matchingInputPredefinedParameters?.length)
|
|
74
|
+
return requestFn(schema, requestInfo, options);
|
|
75
|
+
|
|
76
|
+
return Promise.all(
|
|
77
|
+
matchingInputPredefinedParameters.map((item) =>
|
|
78
|
+
resolveQraftPredefinedParameters(item.parameters)
|
|
79
|
+
)
|
|
80
|
+
).then((resolvedPredefinedParameters) => {
|
|
81
|
+
const mergedParameters = resolvedPredefinedParameters.reduce(
|
|
82
|
+
(acc, item) => {
|
|
83
|
+
acc = shelfMerge(2, acc, item);
|
|
84
|
+
return acc;
|
|
85
|
+
},
|
|
86
|
+
{}
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return requestFn(
|
|
90
|
+
schema,
|
|
91
|
+
{
|
|
92
|
+
...requestInfo,
|
|
93
|
+
parameters: shelfMerge(2, mergedParameters, requestInfo.parameters),
|
|
94
|
+
},
|
|
95
|
+
options
|
|
96
|
+
);
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async function resolveQraftPredefinedParameters<T>(
|
|
102
|
+
predefinedParameters: InputPredefinedParametersItem<T>['parameters']
|
|
103
|
+
) {
|
|
104
|
+
return Promise.all(
|
|
105
|
+
predefinedParameters.map(async (predefinedParameter) => {
|
|
106
|
+
return {
|
|
107
|
+
...predefinedParameter,
|
|
108
|
+
value: await resolveQraftPredefinedParameterValue(
|
|
109
|
+
predefinedParameter.value
|
|
110
|
+
),
|
|
111
|
+
};
|
|
112
|
+
})
|
|
113
|
+
).then((resolvedPredefinedParameters) =>
|
|
114
|
+
resolvedPredefinedParameters
|
|
115
|
+
.filter(
|
|
116
|
+
(resolvedPredefinedParameter) =>
|
|
117
|
+
resolvedPredefinedParameter.value !== undefined
|
|
118
|
+
)
|
|
119
|
+
.reduce(
|
|
120
|
+
(acc, resolvedPredefinedParameter) => {
|
|
121
|
+
acc[resolvedPredefinedParameter.in] =
|
|
122
|
+
acc[resolvedPredefinedParameter.in] ?? {};
|
|
123
|
+
|
|
124
|
+
acc[resolvedPredefinedParameter.in][
|
|
125
|
+
resolvedPredefinedParameter.name
|
|
126
|
+
] = resolvedPredefinedParameter.value;
|
|
127
|
+
|
|
128
|
+
return acc;
|
|
129
|
+
},
|
|
130
|
+
{} as Record<string, Record<string, unknown>>
|
|
131
|
+
)
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type QraftPredefinedParameterResolvedValue<TData> = TData extends () => Promise<
|
|
136
|
+
infer TAsyncData
|
|
137
|
+
>
|
|
138
|
+
? TAsyncData
|
|
139
|
+
: TData;
|
|
140
|
+
|
|
141
|
+
async function resolveQraftPredefinedParameterValue<TData>(
|
|
142
|
+
value: QraftPredefinedParameterValue<TData>
|
|
143
|
+
): Promise<QraftPredefinedParameterResolvedValue<TData>> {
|
|
144
|
+
if (value && typeof value === 'function')
|
|
145
|
+
return (await (
|
|
146
|
+
value as () => Promise<TData | undefined>
|
|
147
|
+
)()) as QraftPredefinedParameterResolvedValue<TData>;
|
|
148
|
+
return value as QraftPredefinedParameterResolvedValue<TData>;
|
|
149
|
+
}
|
|
@@ -4,18 +4,23 @@ import type {
|
|
|
4
4
|
ServiceOperationInfiniteQueryKey,
|
|
5
5
|
ServiceOperationQueryKey,
|
|
6
6
|
} from './ServiceOperationKey.js';
|
|
7
|
+
import { AreAllOptional } from '../lib/AreAllOptional.js';
|
|
7
8
|
|
|
8
9
|
export interface ServiceOperationGetQueryState<
|
|
9
10
|
TSchema extends { url: string; method: string },
|
|
10
11
|
TData,
|
|
11
|
-
TParams
|
|
12
|
+
TParams,
|
|
12
13
|
TError = DefaultError,
|
|
13
14
|
> {
|
|
14
15
|
getQueryState(
|
|
15
|
-
parameters: TParams
|
|
16
|
+
parameters: AreAllOptional<TParams> extends true
|
|
17
|
+
? TParams | ServiceOperationQueryKey<TSchema, TParams> | void
|
|
18
|
+
: TParams | ServiceOperationQueryKey<TSchema, TParams>
|
|
16
19
|
): QueryState<TData, TError> | undefined;
|
|
17
20
|
|
|
18
21
|
getInfiniteQueryState(
|
|
19
|
-
parameters: TParams
|
|
22
|
+
parameters: AreAllOptional<TParams> extends true
|
|
23
|
+
? TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams> | void
|
|
24
|
+
: TParams | ServiceOperationInfiniteQueryKey<TSchema, TParams>
|
|
20
25
|
): QueryState<OperationInfiniteData<TData, TParams>, TError> | undefined;
|
|
21
26
|
}
|