@povio/openapi-codegen-cli 4.0.0-rc.3 → 4.0.0-rc.5
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/README.md +38 -11
- package/dist/{config-CiLFKLAY.d.mts → config-D8ANLlqk.d.mts} +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/{generate.runner-Sh0Ps6AW.mjs → generate.runner-LDL6Lbgl.mjs} +8 -110
- package/dist/{generate.utils-BJxdEik8.cjs → generate.utils-BFeGvk98.cjs} +4 -269
- package/dist/{generateCodeFromOpenAPIDoc-B8FAsxWE.mjs → generateCodeFromOpenAPIDoc-B7VWwIbb.mjs} +198 -502
- package/dist/{generateCodeFromOpenAPIDoc-Bbi8fYi2.cjs → generateCodeFromOpenAPIDoc-CpAdx6I3.cjs} +241 -528
- package/dist/generator.d.mts +1 -1
- package/dist/generator.mjs +3 -3
- package/dist/{getDataFromOpenAPIDoc-CXYNMMMt.mjs → getDataFromOpenAPIDoc-C0iehdg8.mjs} +19 -2
- package/dist/index.d.mts +4 -4
- package/dist/metro.cjs +4 -3
- package/dist/metro.d.mts +3 -3
- package/dist/metro.mjs +1 -1
- package/dist/openapi-codegen-native-darwin-arm64.node +0 -0
- package/dist/openapi-codegen-native-linux-x64.node +0 -0
- package/dist/openapi-codegen-native-win32-x64.node +0 -0
- package/dist/{openapi-codegen.runner-bJTFHTdn.mjs → openapi-codegen.runner-CmW9oZdT.mjs} +1 -1
- package/dist/{openapi-source.runner-DIOvAX_R.d.mts → openapi-source.runner-DES1kzvS.d.mts} +1 -1
- package/dist/{options-X0zju7gw.d.mts → options-B7-eMFcv.d.mts} +4 -10
- package/dist/query.d.mts +3 -3
- package/dist/queryConfig.context-DwVQWbtL.d.mts +71 -0
- package/dist/sh.mjs +8 -8
- package/dist/tiny.d.mts +1 -1
- package/dist/{useMutationEffects-CJJuL9Ak.d.mts → useMutationEffects-I4y5WUkj.d.mts} +1 -1
- package/dist/vite.d.mts +3 -3
- package/dist/vite.mjs +1 -1
- package/package.json +4 -4
- package/dist/queryConfig.context-DjhzewdL.d.mts +0 -56
package/dist/generator.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as GenerateFileData, t as GenerateOptions } from "./options-
|
|
1
|
+
import { n as GenerateFileData, t as GenerateOptions } from "./options-B7-eMFcv.mjs";
|
|
2
2
|
import { OpenAPIV3 } from "openapi-types";
|
|
3
3
|
//#region src/generators/types/metadata.d.ts
|
|
4
4
|
interface GenerateParams {
|
package/dist/generator.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-
|
|
2
|
-
import { t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-
|
|
3
|
-
import {
|
|
1
|
+
import { r as getQueryName, t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-B7VWwIbb.mjs";
|
|
2
|
+
import { a as isQuery, i as isMutation, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-C0iehdg8.mjs";
|
|
3
|
+
import { Et as isParamMediaTypeAllowed, Tt as isMediaTypeAllowed, X as invalidVariableNameCharactersToCamel, Y as DEFAULT_GENERATE_OPTIONS, _ as getSchemaTsMetaType, _t as getNamespaceName, sn as formatTag, t as getOpenApiDoc, v as getTsTypeBase, w as getTagImportPath } from "./generate.runner-LDL6Lbgl.mjs";
|
|
4
4
|
//#region src/generators/core/getMetadataFromOpenAPIDoc.ts
|
|
5
5
|
async function getMetadataFromOpenAPIDoc(openApiDoc, options) {
|
|
6
6
|
const { resolver, data } = await getDataFromOpenAPIDoc(openApiDoc, options);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $ as getParamZodSchemaName, At as pathParamToVariableName, Bt as ALLOWED_PATH_IN, Ct as isErrorStatus, Dt as isPathExcluded, Et as isParamMediaTypeAllowed, Ft as inferRequiredSchema, Gt as ENUM_SCHEMA, Ht as BLOB_SCHEMA, It as isArraySchemaObject, J as getUniqueArray, Jt as STRING_SCHEMA, Kt as INT_SCHEMA, Lt as isReferenceObject, Mt as replaceHyphenatedPath, Nt as unwrapQuotesIfNeeded, Ot as isPrimitiveType, Pt as wrapWithQuotesIfNeeded, Q as getEnumZodSchemaName, Rt as isSchemaObject, St as getSchemaRef, Tt as isMediaTypeAllowed, Ut as DATETIME_SCHEMA, Vt as ANY_SCHEMA, Wt as EMAIL_SCHEMA, X as invalidVariableNameCharactersToCamel, Xt as UUID_SCHEMA, Yt as URL_SCHEMA, Z as getBodyZodSchemaName, Zt as VOID_SCHEMA, _n as Profiler, _t as getNamespaceName, bt as getParameterEnumNames, cn as getEndpointTag, et as getResponseZodSchemaName, fn as capitalize, gn as snakeToCamel, hn as removeWord, in as JSON_APPLICATION_FORMAT, it as isNamedZodSchema, jt as pathToVariableName, kt as isSortingParameterObject, ln as getOperationTag, m as mapEndpointParamsToFunctionParams, mn as getMostCommonAdjacentCombinationSplit, nt as getZodSchemaOperationName, pn as decapitalize, q as iterateSchema, qt as NUMBER_SCHEMA, rn as BODY_PARAMETER_NAME, s as pick, sn as formatTag, tt as getZodSchemaName, un as isTagIncluded, vt as autocorrectRef, wt as isMainResponseStatus, xt as getSchemaNameByRef, yt as escapeControlCharacters, zt as ALLOWED_METHODS } from "./generate.runner-LDL6Lbgl.mjs";
|
|
2
|
+
import { OpenAPIV3 } from "openapi-types";
|
|
2
3
|
//#region src/generators/const/validation.const.ts
|
|
3
4
|
const HTTP_STATUS_CODES = {
|
|
4
5
|
"100": "Continue",
|
|
@@ -707,6 +708,22 @@ function groupByType(validationErrors) {
|
|
|
707
708
|
}), {});
|
|
708
709
|
}
|
|
709
710
|
//#endregion
|
|
711
|
+
//#region src/generators/utils/endpoint.utils.ts
|
|
712
|
+
const isGetEndpoint = (endpoint) => endpoint.method === OpenAPIV3.HttpMethods.GET;
|
|
713
|
+
const isPaginatedGetEndpoint = (endpoint, options) => isGetEndpoint(endpoint) && Object.values(options.infiniteQueryParamNames).every((infiniteQueryParam) => endpoint.parameters.some((param) => param.name === infiniteQueryParam && param.type === "Query"));
|
|
714
|
+
//#endregion
|
|
715
|
+
//#region src/generators/utils/query.utils.ts
|
|
716
|
+
const isQuery = (endpoint) => isGetEndpoint(endpoint);
|
|
717
|
+
const isMutation = (endpoint) => !isGetEndpoint(endpoint) || !!endpoint.mediaDownload;
|
|
718
|
+
const isInfiniteQuery = (endpoint, options) => isPaginatedGetEndpoint(endpoint, options);
|
|
719
|
+
const getDestructuredVariables = (resolver, endpoint, updateQueryEndpoints) => {
|
|
720
|
+
const requiredUpdateQueryParams = updateQueryEndpoints.reduce((acc, updateEndpoint) => [...acc, ...mapEndpointParamsToFunctionParams(resolver, updateEndpoint, { includeOnlyRequiredParams: true }).map((param) => param.name)], []);
|
|
721
|
+
return mapEndpointParamsToFunctionParams(resolver, endpoint, {
|
|
722
|
+
includeOnlyRequiredParams: true,
|
|
723
|
+
excludeBodyParam: true
|
|
724
|
+
}).filter((param) => requiredUpdateQueryParams.includes(param.name)).map((param) => param.name);
|
|
725
|
+
};
|
|
726
|
+
//#endregion
|
|
710
727
|
//#region src/generators/core/endpoints/getEndpointAcl.ts
|
|
711
728
|
function getEndpointAcl({ resolver, endpoint, operation }) {
|
|
712
729
|
const acl = operation["x-acl"];
|
|
@@ -2013,4 +2030,4 @@ function getTagElement(tag, data) {
|
|
|
2013
2030
|
return data.get(tag);
|
|
2014
2031
|
}
|
|
2015
2032
|
//#endregion
|
|
2016
|
-
export { VALIDATION_ERROR_TYPE_TITLE as i,
|
|
2033
|
+
export { isQuery as a, VALIDATION_ERROR_TYPE_TITLE as c, isMutation as i, getDestructuredVariables as n, groupByType as o, isInfiniteQuery as r, getZodSchemaRefs as s, getDataFromOpenAPIDoc as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -3,10 +3,10 @@ import { a as ErrorHandler, c as GeneralErrorCodes, i as ErrorEntry, l as Shared
|
|
|
3
3
|
import { n as AuthGuardProps, r as AuthContext, t as AuthGuard } from "./AuthGuard-GbtTDXs0.mjs";
|
|
4
4
|
import { a as RestClient, i as Response, n as RequestConfig, o as RestInterceptor, r as RequestInfo, t as RestClient$1 } from "./rest-client-CbS77dei.mjs";
|
|
5
5
|
import { n as useWorkspaceContext, r as OpenApiRouter, t as OpenApiWorkspaceContext } from "./workspace.context-isVY9ves.mjs";
|
|
6
|
-
import { a as
|
|
6
|
+
import { a as MergedMutationVariables, c as OpenApiQueryConfig, i as MergedMutationValues, l as QueryModule, n as InvalidationMapFunc, o as MutationEffectsOf, r as MergedMutationData, s as MutationEffectsTypes, t as InvalidationMap, u as RegisteredQueryModule } from "./queryConfig.context-DwVQWbtL.mjs";
|
|
7
7
|
import { t as RestUtils } from "./rest.utils-DpiFIdhF.mjs";
|
|
8
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
8
|
+
import { t as OpenAPICodegenConfig } from "./config-D8ANLlqk.mjs";
|
|
9
9
|
import { d as TransportResponse, l as TransportRequest, n as HttpError, p as UploadProgress, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
|
|
10
10
|
import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-DZxdDcpz.mjs";
|
|
11
|
-
import { a as AppQueryOptions, i as AppMutationOptions, n as useMutationEffects, r as AppInfiniteQueryOptions, t as MutationEffectsOptions } from "./useMutationEffects-
|
|
12
|
-
export { type AppInfiniteQueryOptions, type AppMutationOptions, type AppQueryOptions, ApplicationException, AuthContext, AuthGuard, type AuthGuardProps, type DomainErrorEntry, DomainErrorRegistry, type ErrorEntry, ErrorHandler, type ErrorHandlerOptions, type ErrorRethrower, type GeneralErrorCodes, type RestClient as IRestClient, type InvalidationMap, type InvalidationMapFunc, type MergedMutationVariables, type MutationEffectsOf, type MutationEffectsOptions, type MutationEffectsTypes, HttpError as NativeHttpError, type NativeInterceptor, type TransportRequest as NativeRequest, type TransportRequestConfig as NativeRequestConfig, type TransportResponse as NativeResponse, NativeRestClient, NativeRestInterceptor, type UploadProgress as NativeUploadProgress, OpenAPICodegenConfig, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, type QueryModule, type RequestConfig, type RequestInfo, type Response, RestClient$1 as RestClient, RestInterceptor, RestUtils, SharedErrorHandler, type TranslateFunction, configureTranslations, ns, resources, useMutationEffects, useWorkspaceContext };
|
|
11
|
+
import { a as AppQueryOptions, i as AppMutationOptions, n as useMutationEffects, r as AppInfiniteQueryOptions, t as MutationEffectsOptions } from "./useMutationEffects-I4y5WUkj.mjs";
|
|
12
|
+
export { type AppInfiniteQueryOptions, type AppMutationOptions, type AppQueryOptions, ApplicationException, AuthContext, AuthGuard, type AuthGuardProps, type DomainErrorEntry, DomainErrorRegistry, type ErrorEntry, ErrorHandler, type ErrorHandlerOptions, type ErrorRethrower, type GeneralErrorCodes, type RestClient as IRestClient, type InvalidationMap, type InvalidationMapFunc, type MergedMutationData, type MergedMutationValues, type MergedMutationVariables, type MutationEffectsOf, type MutationEffectsOptions, type MutationEffectsTypes, HttpError as NativeHttpError, type NativeInterceptor, type TransportRequest as NativeRequest, type TransportRequestConfig as NativeRequestConfig, type TransportResponse as NativeResponse, NativeRestClient, NativeRestInterceptor, type UploadProgress as NativeUploadProgress, OpenAPICodegenConfig, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, type QueryModule, type RegisteredQueryModule, type RequestConfig, type RequestInfo, type Response, RestClient$1 as RestClient, RestInterceptor, RestUtils, SharedErrorHandler, type TranslateFunction, configureTranslations, ns, resources, useMutationEffects, useWorkspaceContext };
|
package/dist/metro.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_generate_utils = require("./generate.utils-
|
|
2
|
+
const require_generate_utils = require("./generate.utils-BFeGvk98.cjs");
|
|
3
3
|
let fs = require("fs");
|
|
4
4
|
fs = require_generate_utils.__toESM(fs, 1);
|
|
5
5
|
let path = require("path");
|
|
@@ -15,6 +15,7 @@ function resolveConfig({ fileConfig = {}, params: { includeTags, excludeTags, in
|
|
|
15
15
|
workspaceContext: workspaceContext?.split(",")
|
|
16
16
|
});
|
|
17
17
|
if (resolvedConfig.modelsInCommon && resolvedConfig.modelsInModules) throw new Error("modelsInCommon and modelsInModules cannot both be enabled");
|
|
18
|
+
if (resolvedConfig.lazySchemas && !resolvedConfig.tsNamespaces) throw new Error("lazySchemas requires tsNamespaces");
|
|
18
19
|
resolvedConfig.checkAcl = resolvedConfig.acl && resolvedConfig.checkAcl;
|
|
19
20
|
resolvedConfig.workspaceContext = Array.from(new Set((resolvedConfig.workspaceContext ?? []).map((value) => value.trim()).filter(Boolean)));
|
|
20
21
|
return resolvedConfig;
|
|
@@ -58,7 +59,7 @@ function generateFilesFromNativeOpenAPI(source, yaml, options) {
|
|
|
58
59
|
return files;
|
|
59
60
|
}
|
|
60
61
|
function supportsCompleteNativeRender(options) {
|
|
61
|
-
return options.splitByTags && !options.inlineEndpoints &&
|
|
62
|
+
return options.splitByTags && !options.inlineEndpoints && (options.workspaceContext?.length ?? 0) === 0;
|
|
62
63
|
}
|
|
63
64
|
function taggedFile(options, tag, type, content) {
|
|
64
65
|
return outputFile(options, require_generate_utils.getTagFileName({
|
|
@@ -102,7 +103,7 @@ async function runGenerate({ fileConfig, params, formatGeneratedFile, profiler =
|
|
|
102
103
|
const nativeFiles = generateFilesFromNativeOpenAPI(nativeInput.source, nativeInput.yaml, config);
|
|
103
104
|
if (nativeFiles) return nativeFiles;
|
|
104
105
|
}
|
|
105
|
-
const { generateCodeFromOpenAPIDoc } = await Promise.resolve().then(() => require("./generateCodeFromOpenAPIDoc-
|
|
106
|
+
const { generateCodeFromOpenAPIDoc } = await Promise.resolve().then(() => require("./generateCodeFromOpenAPIDoc-CpAdx6I3.cjs"));
|
|
106
107
|
return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
|
|
107
108
|
source: nativeInput.source,
|
|
108
109
|
yaml: nativeInput.yaml
|
package/dist/metro.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as GenerateFileFormatter } from "./options-
|
|
2
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
3
|
-
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-
|
|
1
|
+
import { r as GenerateFileFormatter } from "./options-B7-eMFcv.mjs";
|
|
2
|
+
import { t as OpenAPICodegenConfig } from "./config-D8ANLlqk.mjs";
|
|
3
|
+
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-DES1kzvS.mjs";
|
|
4
4
|
import { IncomingMessage, ServerResponse } from "http";
|
|
5
5
|
//#region src/metro/openapi-codegen.plugin.d.ts
|
|
6
6
|
type OpenApiCodegenMetroConfig = OpenAPICodegenConfig & {
|
package/dist/metro.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-
|
|
1
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-CmW9oZdT.mjs";
|
|
2
2
|
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-DPUNTduQ.mjs";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "path";
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _n as Profiler, n as runGenerate } from "./generate.runner-LDL6Lbgl.mjs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
//#region src/plugins/openapi-codegen.runner.ts
|
|
4
4
|
function createOpenApiCodegenRunner(config, options = {}) {
|
|
@@ -4,8 +4,7 @@ declare enum GenerateType {
|
|
|
4
4
|
Models = "models",
|
|
5
5
|
Endpoints = "endpoints",
|
|
6
6
|
Queries = "queries",
|
|
7
|
-
Acl = "acl"
|
|
8
|
-
Configs = "configs"
|
|
7
|
+
Acl = "acl"
|
|
9
8
|
}
|
|
10
9
|
interface GenerateFileData {
|
|
11
10
|
fileName: string;
|
|
@@ -17,6 +16,8 @@ type GenerateFileFormatter = (file: GenerateFileData) => string | Promise<string
|
|
|
17
16
|
interface ZodGenerateOptions {
|
|
18
17
|
/** Eagerly compile non-recursive schemas. Defaults to false to avoid startup work. */
|
|
19
18
|
compileSchemas?: boolean;
|
|
19
|
+
/** Build namespace model schemas on first access instead of at import. Requires tsNamespaces. */
|
|
20
|
+
lazySchemas?: boolean;
|
|
20
21
|
schemaSuffix: string;
|
|
21
22
|
enumSuffix: string;
|
|
22
23
|
modelsInCommon?: boolean;
|
|
@@ -71,13 +72,6 @@ interface ACLGenerateOptions {
|
|
|
71
72
|
abilityContextImportPath?: string;
|
|
72
73
|
aclCheckImportPath: string;
|
|
73
74
|
}
|
|
74
|
-
interface BuilderConfigsGenerateOptions {
|
|
75
|
-
builderConfigs?: boolean;
|
|
76
|
-
filterParamName: string;
|
|
77
|
-
dataResponseParamNames: string[];
|
|
78
|
-
dynamicInputsImportPath: string;
|
|
79
|
-
dynamicColumnsImportPath: string;
|
|
80
|
-
}
|
|
81
75
|
interface GenerateConfig {
|
|
82
76
|
outputFileNameSuffix: string;
|
|
83
77
|
namespaceSuffix: string;
|
|
@@ -102,6 +96,6 @@ interface BaseGenerateOptions {
|
|
|
102
96
|
modelsOnly?: boolean;
|
|
103
97
|
standalone?: boolean;
|
|
104
98
|
}
|
|
105
|
-
interface GenerateOptions extends BaseGenerateOptions, ZodGenerateOptions, EndpointsGenerateOptions, QueriesGenerateOptions, InfiniteQueriesGenerateOptions, ACLGenerateOptions
|
|
99
|
+
interface GenerateOptions extends BaseGenerateOptions, ZodGenerateOptions, EndpointsGenerateOptions, QueriesGenerateOptions, InfiniteQueriesGenerateOptions, ACLGenerateOptions {}
|
|
106
100
|
//#endregion
|
|
107
101
|
export { GenerateFileData as n, GenerateFileFormatter as r, GenerateOptions as t };
|
package/dist/query.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { a as AppQueryOptions, i as AppMutationOptions, n as useMutationEffects, r as AppInfiniteQueryOptions, t as MutationEffectsOptions } from "./useMutationEffects-
|
|
3
|
-
export { type AppInfiniteQueryOptions, type AppMutationOptions, type AppQueryOptions, type InvalidationMap, type InvalidationMapFunc, type MergedMutationVariables, type MutationEffectsOf, type MutationEffectsOptions, type MutationEffectsTypes, OpenApiQueryConfig, type QueryModule, useMutationEffects };
|
|
1
|
+
import { a as MergedMutationVariables, c as OpenApiQueryConfig, i as MergedMutationValues, l as QueryModule, n as InvalidationMapFunc, o as MutationEffectsOf, r as MergedMutationData, s as MutationEffectsTypes, t as InvalidationMap, u as RegisteredQueryModule } from "./queryConfig.context-DwVQWbtL.mjs";
|
|
2
|
+
import { a as AppQueryOptions, i as AppMutationOptions, n as useMutationEffects, r as AppInfiniteQueryOptions, t as MutationEffectsOptions } from "./useMutationEffects-I4y5WUkj.mjs";
|
|
3
|
+
export { type AppInfiniteQueryOptions, type AppMutationOptions, type AppQueryOptions, type InvalidationMap, type InvalidationMapFunc, type MergedMutationData, type MergedMutationValues, type MergedMutationVariables, type MutationEffectsOf, type MutationEffectsOptions, type MutationEffectsTypes, OpenApiQueryConfig, type QueryModule, type RegisteredQueryModule, useMutationEffects };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import { QueryKey, UseMutationResult } from "@tanstack/react-query";
|
|
3
|
+
//#region src/lib/config/queryConfig.context.d.ts
|
|
4
|
+
type QueryModule = string | number | symbol;
|
|
5
|
+
type InvalidationMapFunc<TData = unknown, TVariables = unknown> = {
|
|
6
|
+
invalidate(data: TData, variables: TVariables): QueryKey[];
|
|
7
|
+
}["invalidate"];
|
|
8
|
+
/** The `data` and `variables` one mutation passes to its module's invalidation callback. */
|
|
9
|
+
interface MutationEffectsTypes {
|
|
10
|
+
data: unknown;
|
|
11
|
+
variables: unknown;
|
|
12
|
+
}
|
|
13
|
+
/** `data` and `variables` of mutation hooks, e.g. `MutationEffectsOf<typeof useCreate | typeof useUpdate>`. */
|
|
14
|
+
type MutationEffectsOf<THook> = THook extends ((...args: never) => UseMutationResult<infer TData, infer _TError, infer TVariables, infer _TOnMutateResult>) ? {
|
|
15
|
+
data: TData;
|
|
16
|
+
variables: TVariables;
|
|
17
|
+
} : never;
|
|
18
|
+
type ObjectMembers<T> = T extends object ? T : never;
|
|
19
|
+
type KeysOfUnion<T> = T extends unknown ? keyof T : never;
|
|
20
|
+
type ValueOfUnion<T, K extends PropertyKey> = T extends unknown ? (K extends keyof T ? T[K] : undefined) : never;
|
|
21
|
+
type IsUnion<T, TAll = T> = T extends unknown ? ([TAll] extends [T] ? false : true) : never;
|
|
22
|
+
type MergeableMembers<T> = T extends readonly unknown[] | ((...args: never) => unknown) | Date ? never : ObjectMembers<T>;
|
|
23
|
+
type MergedValue<T> = true extends IsUnion<MergeableMembers<T>> ? MergedObjects<MergeableMembers<T>> | Exclude<T, MergeableMembers<T>> : T;
|
|
24
|
+
type MergedObjects<T> = { [K in Extract<keyof T, PropertyKey>]: MergedValue<ValueOfUnion<T, K>>; } & { [K in Exclude<KeysOfUnion<T>, keyof T>]?: MergedValue<ValueOfUnion<T, K>>; };
|
|
25
|
+
type VoidAsUndefined<T> = [void] extends [T] ? Exclude<T, void> | undefined : T;
|
|
26
|
+
/**
|
|
27
|
+
* A union of a module's mutation values as one object: keys some mutations lack become optional, at any
|
|
28
|
+
* depth (e.g. fields of request bodies only some mutations send). `void` becomes `undefined`, which is
|
|
29
|
+
* what callbacks receive for mutations without one.
|
|
30
|
+
*/
|
|
31
|
+
type MergedMutationValues<T> = [ObjectMembers<T>] extends [never] ? VoidAsUndefined<T> : MergedObjects<ObjectMembers<T>> | VoidAsUndefined<Exclude<T, object>>;
|
|
32
|
+
/** The variables of a module's mutations as one object; see `MergedMutationValues`. */
|
|
33
|
+
type MergedMutationVariables<T> = MergedMutationValues<T>;
|
|
34
|
+
/** The responses of a module's mutations as one object; see `MergedMutationValues`. */
|
|
35
|
+
type MergedMutationData<T> = MergedMutationValues<T>;
|
|
36
|
+
type InvalidationMapFuncFor<T> = InvalidationMapFunc<MergedMutationData<T extends MutationEffectsTypes ? T["data"] : never>, MergedMutationVariables<T extends MutationEffectsTypes ? T["variables"] : never>>;
|
|
37
|
+
declare global {
|
|
38
|
+
/**
|
|
39
|
+
* Mutation types per module. The generated `queryModules.ts` extends it with `QueryModuleMutations`, so
|
|
40
|
+
* `InvalidationMap<QueryModule>` types its callbacks from the spec. Global, because interfaces re-exported
|
|
41
|
+
* from bundled declaration chunks can't be augmented through the package's entry points.
|
|
42
|
+
*/
|
|
43
|
+
interface OpenApiCodegenQueryModuleMutations {}
|
|
44
|
+
/** The generated `QueryModule` enum, registered by `queryModules.ts` as `{ queryModule: QueryModule }`. */
|
|
45
|
+
interface OpenApiCodegenQueryModules {}
|
|
46
|
+
}
|
|
47
|
+
/** The generated `QueryModule` enum once `queryModules.ts` registers it, else any module key. */
|
|
48
|
+
type RegisteredQueryModule = OpenApiCodegenQueryModules extends {
|
|
49
|
+
queryModule: infer TModule extends QueryModule;
|
|
50
|
+
} ? TModule : QueryModule;
|
|
51
|
+
/**
|
|
52
|
+
* Query keys to invalidate after a module's mutations. Without type arguments it is keyed by the generated
|
|
53
|
+
* `QueryModule` and typed by its `QueryModuleMutations`, so a bare `InvalidationMap` is typed from the spec.
|
|
54
|
+
*/
|
|
55
|
+
type InvalidationMap<TQueryModule extends QueryModule = RegisteredQueryModule, TMutations extends { [K in TQueryModule]?: MutationEffectsTypes; } = OpenApiCodegenQueryModuleMutations> = { [K in TQueryModule]?: K extends keyof TMutations ? InvalidationMapFuncFor<TMutations[K]> : InvalidationMapFunc; };
|
|
56
|
+
declare namespace OpenApiQueryConfig {
|
|
57
|
+
export interface Type<TQueryModule extends QueryModule = QueryModule> {
|
|
58
|
+
preferUpdate?: boolean;
|
|
59
|
+
invalidateCurrentModule?: boolean;
|
|
60
|
+
invalidationMap?: InvalidationMap<TQueryModule>;
|
|
61
|
+
crossTabInvalidation?: boolean;
|
|
62
|
+
allowInvalidResponseData?: boolean;
|
|
63
|
+
onError?: (error: unknown) => void;
|
|
64
|
+
}
|
|
65
|
+
type ProviderProps<TQueryModule extends QueryModule = QueryModule> = Type<TQueryModule>;
|
|
66
|
+
export function Provider<TQueryModule extends QueryModule = QueryModule>({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, allowInvalidResponseData, onError, children }: PropsWithChildren<ProviderProps<TQueryModule>>): import("react").JSX.Element;
|
|
67
|
+
export const useConfig: <TQueryModule extends QueryModule = QueryModule>() => Type<TQueryModule>;
|
|
68
|
+
export {};
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { MergedMutationVariables as a, OpenApiQueryConfig as c, MergedMutationValues as i, QueryModule as l, InvalidationMapFunc as n, MutationEffectsOf as o, MergedMutationData as r, MutationEffectsTypes as s, InvalidationMap as t, RegisteredQueryModule as u };
|
package/dist/sh.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { c as VALIDATION_ERROR_TYPE_TITLE, o as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-C0iehdg8.mjs";
|
|
3
|
+
import { C as getTagFileName, _n as Profiler, a as resolveConfig, n as runGenerate, o as getOutputFileName, t as getOpenApiDoc } from "./generate.runner-LDL6Lbgl.mjs";
|
|
4
4
|
import yargs from "yargs";
|
|
5
5
|
import { hideBin } from "yargs/helpers";
|
|
6
6
|
import { styleText } from "node:util";
|
|
@@ -31,7 +31,7 @@ function logBanner(message) {
|
|
|
31
31
|
* Fetch the version from package.json
|
|
32
32
|
*/
|
|
33
33
|
function getVersion() {
|
|
34
|
-
return "4.0.0-rc.
|
|
34
|
+
return "4.0.0-rc.5";
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/helpers/yargs.helper.ts
|
|
@@ -268,6 +268,7 @@ var GenerateOptions = class {
|
|
|
268
268
|
excludeRedundantZodSchemas;
|
|
269
269
|
importPath;
|
|
270
270
|
compileSchemas;
|
|
271
|
+
lazySchemas;
|
|
271
272
|
extractEnums;
|
|
272
273
|
modelsInCommon;
|
|
273
274
|
modelsInModules;
|
|
@@ -290,7 +291,6 @@ var GenerateOptions = class {
|
|
|
290
291
|
inlineEndpointsExcludeModules;
|
|
291
292
|
modelsOnly;
|
|
292
293
|
axiosRequestConfig;
|
|
293
|
-
builderConfigs;
|
|
294
294
|
format;
|
|
295
295
|
verbose;
|
|
296
296
|
};
|
|
@@ -331,6 +331,10 @@ __decorate([YargOption({
|
|
|
331
331
|
envAlias: "compileSchemas",
|
|
332
332
|
type: "boolean"
|
|
333
333
|
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "compileSchemas", void 0);
|
|
334
|
+
__decorate([YargOption({
|
|
335
|
+
envAlias: "lazySchemas",
|
|
336
|
+
type: "boolean"
|
|
337
|
+
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "lazySchemas", void 0);
|
|
334
338
|
__decorate([YargOption({
|
|
335
339
|
envAlias: "extractEnums",
|
|
336
340
|
type: "boolean"
|
|
@@ -398,10 +402,6 @@ __decorate([YargOption({
|
|
|
398
402
|
envAlias: "axiosRequestConfig",
|
|
399
403
|
type: "boolean"
|
|
400
404
|
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "axiosRequestConfig", void 0);
|
|
401
|
-
__decorate([YargOption({
|
|
402
|
-
envAlias: "builderConfigs",
|
|
403
|
-
type: "boolean"
|
|
404
|
-
}), __decorateMetadata("design:type", Boolean)], GenerateOptions.prototype, "builderConfigs", void 0);
|
|
405
405
|
__decorate([YargOption({
|
|
406
406
|
envAlias: "format",
|
|
407
407
|
default: true,
|
package/dist/tiny.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as getModuleOpenApiTag, A as collectApiModelSchemaExports, At as toOpenAPI30Document, B as collectReachableModelSchemas, C as applyEnumExtensions, Ct as procedureSchemaName, D as applyRobodevModuleExtensions, Dt as schemaExportName, E as applyParameterExtensions, Et as schemaComponentRef, F as collectExtraSchemas, G as findComponentEnumNames, H as compactTagName, I as collectModelSchemaExports, J as generateOpenApiFile, K as findEnumNames, L as collectModuleModelSchemaExports, M as collectContractSchemas, Mt as toOpenAPIAclRule, N as collectDbTableModelSchemaExport, Nt as toPascalCase, O as applyRobodevUserRolesExtension, Ot as sharedSchemaExportName, P as collectDbTableModelSchemaExports, Pt as visitZodSchema, Q as getModuleOpenApiController, R as collectOperationMeta, S as addContractSchema, St as operationKey, T as applyPaginatedItemSchemas, Tt as routeHasPathParameters, U as createModelSchemaNameGetter, V as collectSchemaRegistryRoots, W as defineOpenApiSchemas, X as getContractProcedureData, Y as getComponentSchemas, Z as getDerivedOperationId, _ as OpenApiSchemaRegistry, _t as namedControllerActionSchema, a as isTinyOpenApiFakeMode, at as getProcedureInputSchemaRole, b as TinyOpenApiUserRole, bt as namedOpenApiResponseSchema, c as AnyContractRouter, ct as isContractProcedure, d as GenerateOpenApiFile, dt as isObject, et as getObjectPropertySchema, f as GenerateOpenApiFileOptions, ft as isProcedureMeta, g as JsonObject, gt as namedControllerActionInputDtoSchema, h as GenerateTinyOpenApiFileOptions, ht as modelSchemaNameEntries, i as getLocalInputPath, it as getPaginatedItemSchema, j as collectContractSchemaRoots, jt as toOpenAPI30Schema, k as asStringArray, kt as stripNoContentResponseBodies, l as AnySchema, lt as isNullSchema, m as GenerateOpenApiSpec, mt as modelSchemaExportName, nt as getOperationAction, o as normalizeWatchFolders, ot as getRobodevModuleRoles, p as GenerateOpenApiFileResult, pt as isZodSchema, q as generateORPCOpenAPISpec, r as createTinyOpenApiSourceRunner, rt as getOperationController, s as AclRule, st as getStringEnumValues, t as TinyOpenApiSourceRunnerConfig, tt as getOpenApiSchemaName, u as GenerateORPCOpenAPISpecOptions, ut as isNullableOnlySchema, v as ProcedureMeta, vt as namedOpenApiOutputSchema, w as applyOperationMeta, wt as resolveOpenApiOutputPath, x as ZodSchema, xt as namedOpenApiSchema, y as TinyOpenApiModule, yt as namedOpenApiRequestSchema, z as collectOperationTags } from "./openapi-source.runner-
|
|
1
|
+
import { $ as getModuleOpenApiTag, A as collectApiModelSchemaExports, At as toOpenAPI30Document, B as collectReachableModelSchemas, C as applyEnumExtensions, Ct as procedureSchemaName, D as applyRobodevModuleExtensions, Dt as schemaExportName, E as applyParameterExtensions, Et as schemaComponentRef, F as collectExtraSchemas, G as findComponentEnumNames, H as compactTagName, I as collectModelSchemaExports, J as generateOpenApiFile, K as findEnumNames, L as collectModuleModelSchemaExports, M as collectContractSchemas, Mt as toOpenAPIAclRule, N as collectDbTableModelSchemaExport, Nt as toPascalCase, O as applyRobodevUserRolesExtension, Ot as sharedSchemaExportName, P as collectDbTableModelSchemaExports, Pt as visitZodSchema, Q as getModuleOpenApiController, R as collectOperationMeta, S as addContractSchema, St as operationKey, T as applyPaginatedItemSchemas, Tt as routeHasPathParameters, U as createModelSchemaNameGetter, V as collectSchemaRegistryRoots, W as defineOpenApiSchemas, X as getContractProcedureData, Y as getComponentSchemas, Z as getDerivedOperationId, _ as OpenApiSchemaRegistry, _t as namedControllerActionSchema, a as isTinyOpenApiFakeMode, at as getProcedureInputSchemaRole, b as TinyOpenApiUserRole, bt as namedOpenApiResponseSchema, c as AnyContractRouter, ct as isContractProcedure, d as GenerateOpenApiFile, dt as isObject, et as getObjectPropertySchema, f as GenerateOpenApiFileOptions, ft as isProcedureMeta, g as JsonObject, gt as namedControllerActionInputDtoSchema, h as GenerateTinyOpenApiFileOptions, ht as modelSchemaNameEntries, i as getLocalInputPath, it as getPaginatedItemSchema, j as collectContractSchemaRoots, jt as toOpenAPI30Schema, k as asStringArray, kt as stripNoContentResponseBodies, l as AnySchema, lt as isNullSchema, m as GenerateOpenApiSpec, mt as modelSchemaExportName, nt as getOperationAction, o as normalizeWatchFolders, ot as getRobodevModuleRoles, p as GenerateOpenApiFileResult, pt as isZodSchema, q as generateORPCOpenAPISpec, r as createTinyOpenApiSourceRunner, rt as getOperationController, s as AclRule, st as getStringEnumValues, t as TinyOpenApiSourceRunnerConfig, tt as getOpenApiSchemaName, u as GenerateORPCOpenAPISpecOptions, ut as isNullableOnlySchema, v as ProcedureMeta, vt as namedOpenApiOutputSchema, w as applyOperationMeta, wt as resolveOpenApiOutputPath, x as ZodSchema, xt as namedOpenApiSchema, y as TinyOpenApiModule, yt as namedOpenApiRequestSchema, z as collectOperationTags } from "./openapi-source.runner-DES1kzvS.mjs";
|
|
2
2
|
export { AclRule, AnyContractRouter, AnySchema, GenerateORPCOpenAPISpecOptions, GenerateOpenApiFile, GenerateOpenApiFileOptions, GenerateOpenApiFileResult, GenerateOpenApiSpec, GenerateTinyOpenApiFileOptions, JsonObject, OpenApiSchemaRegistry, ProcedureMeta, TinyOpenApiModule, type TinyOpenApiSourceRunnerConfig, TinyOpenApiUserRole, ZodSchema, addContractSchema, applyEnumExtensions, applyOperationMeta, applyPaginatedItemSchemas, applyParameterExtensions, applyRobodevModuleExtensions, applyRobodevUserRolesExtension, asStringArray, collectApiModelSchemaExports, collectContractSchemaRoots, collectContractSchemas, collectDbTableModelSchemaExport, collectDbTableModelSchemaExports, collectExtraSchemas, collectModelSchemaExports, collectModuleModelSchemaExports, collectOperationMeta, collectOperationTags, collectReachableModelSchemas, collectSchemaRegistryRoots, compactTagName, createModelSchemaNameGetter, createTinyOpenApiSourceRunner, defineOpenApiSchemas, findComponentEnumNames, findEnumNames, generateORPCOpenAPISpec, generateOpenApiFile, getComponentSchemas, getContractProcedureData, getDerivedOperationId, getModuleOpenApiController, getModuleOpenApiTag, getObjectPropertySchema, getOpenApiSchemaName, getOperationAction, getOperationController, getPaginatedItemSchema, getProcedureInputSchemaRole, getRobodevModuleRoles, getStringEnumValues, getLocalInputPath as getTinyOpenApiLocalInputPath, isContractProcedure, isNullSchema, isNullableOnlySchema, isObject, isProcedureMeta, isTinyOpenApiFakeMode, isZodSchema, modelSchemaExportName, modelSchemaNameEntries, namedControllerActionInputDtoSchema, namedControllerActionSchema, namedOpenApiOutputSchema, namedOpenApiRequestSchema, namedOpenApiResponseSchema, namedOpenApiSchema, normalizeWatchFolders as normalizeTinyOpenApiWatchFolders, operationKey, procedureSchemaName, resolveOpenApiOutputPath, routeHasPathParameters, schemaComponentRef, schemaExportName, sharedSchemaExportName, stripNoContentResponseBodies, toOpenAPI30Document, toOpenAPI30Schema, toOpenAPIAclRule, toPascalCase, visitZodSchema };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as GeneralErrorCodes, t as ApplicationException } from "./error-handling-BpAQHWrU.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { l as QueryModule, t as InvalidationMap } from "./queryConfig.context-DwVQWbtL.mjs";
|
|
3
3
|
import { InfiniteData, QueryKey, UseInfiniteQueryOptions, UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
|
|
4
4
|
//#region src/lib/react-query.types.d.ts
|
|
5
5
|
type Function = (...args: never) => unknown;
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as GenerateFileFormatter } from "./options-
|
|
2
|
-
import { t as OpenAPICodegenConfig } from "./config-
|
|
3
|
-
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-
|
|
1
|
+
import { r as GenerateFileFormatter } from "./options-B7-eMFcv.mjs";
|
|
2
|
+
import { t as OpenAPICodegenConfig } from "./config-D8ANLlqk.mjs";
|
|
3
|
+
import { d as GenerateOpenApiFile, m as GenerateOpenApiSpec, n as TinyOpenApiSpecModuleConfig } from "./openapi-source.runner-DES1kzvS.mjs";
|
|
4
4
|
import { Plugin, PluginOption } from "vite";
|
|
5
5
|
//#region src/plugins/openapi-codegen.runner.d.ts
|
|
6
6
|
type OpenApiCodegenPluginConfig = OpenAPICodegenConfig & {
|
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-
|
|
1
|
+
import { t as createOpenApiCodegenRunner } from "./openapi-codegen.runner-CmW9oZdT.mjs";
|
|
2
2
|
import { i as normalizeWatchFolders, r as isTinyOpenApiFakeMode, t as createTinyOpenApiSourceRunner } from "./openapi-source.runner-DPUNTduQ.mjs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
//#region src/vite/openapi-codegen.plugin.ts
|
package/package.json
CHANGED
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"@casl/ability": "6.8.0",
|
|
129
129
|
"@casl/react": "5.0.1",
|
|
130
130
|
"@tanstack/react-query": "~5.90.21",
|
|
131
|
-
"@types/bun": "1.4.
|
|
131
|
+
"@types/bun": "1.4.4",
|
|
132
132
|
"@types/node": "^25.3.0",
|
|
133
133
|
"@types/prompt-sync": "^4.2.3",
|
|
134
134
|
"@types/react": "^19.2.14",
|
|
@@ -183,9 +183,9 @@
|
|
|
183
183
|
}
|
|
184
184
|
},
|
|
185
185
|
"engines": {
|
|
186
|
-
"bun": ">= 1.4.
|
|
186
|
+
"bun": ">= 1.4.4",
|
|
187
187
|
"node": ">= 18"
|
|
188
188
|
},
|
|
189
|
-
"packageManager": "bun@1.4.
|
|
190
|
-
"version": "4.0.0-rc.
|
|
189
|
+
"packageManager": "bun@1.4.4",
|
|
190
|
+
"version": "4.0.0-rc.5"
|
|
191
191
|
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
import { QueryKey, UseMutationResult } from "@tanstack/react-query";
|
|
3
|
-
//#region src/lib/config/queryConfig.context.d.ts
|
|
4
|
-
type QueryModule = string | number | symbol;
|
|
5
|
-
type InvalidationMapFunc<TData = unknown, TVariables = unknown> = {
|
|
6
|
-
invalidate(data: TData, variables: TVariables): QueryKey[];
|
|
7
|
-
}["invalidate"];
|
|
8
|
-
/** The `data` and `variables` one mutation passes to its module's invalidation callback. */
|
|
9
|
-
interface MutationEffectsTypes {
|
|
10
|
-
data: unknown;
|
|
11
|
-
variables: unknown;
|
|
12
|
-
}
|
|
13
|
-
/** `data` and `variables` of mutation hooks, e.g. `MutationEffectsOf<typeof useCreate | typeof useUpdate>`. */
|
|
14
|
-
type MutationEffectsOf<THook> = THook extends ((...args: never) => UseMutationResult<infer TData, infer _TError, infer TVariables, infer _TOnMutateResult>) ? {
|
|
15
|
-
data: TData;
|
|
16
|
-
variables: TVariables;
|
|
17
|
-
} : never;
|
|
18
|
-
type ObjectMembers<T> = T extends object ? T : never;
|
|
19
|
-
type KeysOfUnion<T> = T extends unknown ? keyof T : never;
|
|
20
|
-
type ValueOfUnion<T, K extends PropertyKey> = T extends unknown ? (K extends keyof T ? T[K] : undefined) : never;
|
|
21
|
-
type MergedObjects<T> = { [K in keyof T]: ValueOfUnion<T, K>; } & { [K in Exclude<KeysOfUnion<T>, keyof T>]?: ValueOfUnion<T, K>; };
|
|
22
|
-
/**
|
|
23
|
-
* The variables of a module's mutations as one object: keys some mutations lack become optional.
|
|
24
|
-
* Mutations without variables (`void`) stay in the union, as their callbacks receive `undefined`.
|
|
25
|
-
*/
|
|
26
|
-
type MergedMutationVariables<T> = [ObjectMembers<T>] extends [never] ? T : MergedObjects<ObjectMembers<T>> | Exclude<T, object>;
|
|
27
|
-
type InvalidationMapFuncFor<T> = InvalidationMapFunc<T extends MutationEffectsTypes ? T["data"] : never, MergedMutationVariables<T extends MutationEffectsTypes ? T["variables"] : never>>;
|
|
28
|
-
/**
|
|
29
|
-
* Query keys to invalidate after a module's mutations. Pass the generated `QueryModuleMutations` as
|
|
30
|
-
* `TMutations` to type each module's callback with its mutations' `data` and `variables`.
|
|
31
|
-
*/
|
|
32
|
-
declare global {
|
|
33
|
-
/**
|
|
34
|
-
* Mutation types per module. The generated `queryModules.ts` extends it with `QueryModuleMutations`, so
|
|
35
|
-
* `InvalidationMap<QueryModule>` types its callbacks from the spec. Global, because interfaces re-exported
|
|
36
|
-
* from bundled declaration chunks can't be augmented through the package's entry points.
|
|
37
|
-
*/
|
|
38
|
-
interface OpenApiCodegenQueryModuleMutations {}
|
|
39
|
-
}
|
|
40
|
-
type InvalidationMap<TQueryModule extends QueryModule = QueryModule, TMutations extends { [K in TQueryModule]?: MutationEffectsTypes; } = OpenApiCodegenQueryModuleMutations> = { [K in TQueryModule]?: K extends keyof TMutations ? InvalidationMapFuncFor<TMutations[K]> : InvalidationMapFunc; };
|
|
41
|
-
declare namespace OpenApiQueryConfig {
|
|
42
|
-
export interface Type<TQueryModule extends QueryModule = QueryModule> {
|
|
43
|
-
preferUpdate?: boolean;
|
|
44
|
-
invalidateCurrentModule?: boolean;
|
|
45
|
-
invalidationMap?: InvalidationMap<TQueryModule>;
|
|
46
|
-
crossTabInvalidation?: boolean;
|
|
47
|
-
allowInvalidResponseData?: boolean;
|
|
48
|
-
onError?: (error: unknown) => void;
|
|
49
|
-
}
|
|
50
|
-
type ProviderProps<TQueryModule extends QueryModule = QueryModule> = Type<TQueryModule>;
|
|
51
|
-
export function Provider<TQueryModule extends QueryModule = QueryModule>({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, allowInvalidResponseData, onError, children }: PropsWithChildren<ProviderProps<TQueryModule>>): import("react").JSX.Element;
|
|
52
|
-
export const useConfig: <TQueryModule extends QueryModule = QueryModule>() => Type<TQueryModule>;
|
|
53
|
-
export {};
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
56
|
-
export { MutationEffectsTypes as a, MutationEffectsOf as i, InvalidationMapFunc as n, OpenApiQueryConfig as o, MergedMutationVariables as r, QueryModule as s, InvalidationMap as t };
|