@povio/openapi-codegen-cli 4.0.0-rc.1 → 4.0.0-rc.3
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 +18 -0
- package/dist/acl.d.mts +1 -1
- package/dist/axios.d.mts +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/{error-handling-LPEPQV1V.d.mts → error-handling-BpAQHWrU.d.mts} +3 -1
- package/dist/errors.d.mts +2 -2
- package/dist/{generate.runner-BtPpBVj9.mjs → generate.runner-Sh0Ps6AW.mjs} +1 -1
- package/dist/{generateCodeFromOpenAPIDoc-D1H6MZiS.mjs → generateCodeFromOpenAPIDoc-B8FAsxWE.mjs} +28 -3
- package/dist/{generateCodeFromOpenAPIDoc-CGoR73wh.cjs → generateCodeFromOpenAPIDoc-Bbi8fYi2.cjs} +26 -1
- package/dist/generator.mjs +3 -3
- package/dist/{getDataFromOpenAPIDoc-fJCwtr-2.mjs → getDataFromOpenAPIDoc-CXYNMMMt.mjs} +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/metro.cjs +1 -1
- package/dist/metro.mjs +1 -1
- package/dist/{native-rest-interceptor-BX45GDWd.d.mts → native-rest-interceptor-DZxdDcpz.d.mts} +2 -2
- package/dist/native.d.mts +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-BpykceyD.mjs → openapi-codegen.runner-bJTFHTdn.mjs} +1 -1
- package/dist/query.d.mts +3 -3
- package/dist/query.mjs +1 -1
- package/dist/queryConfig.context-DjhzewdL.d.mts +56 -0
- package/dist/{rest-client-BSXsrOff.d.mts → rest-client-CbS77dei.d.mts} +2 -2
- package/dist/sh.mjs +3 -3
- package/dist/{useMutationEffects-D_wEEF6-.d.mts → useMutationEffects-CJJuL9Ak.d.mts} +2 -2
- package/dist/{useMutationEffects-PB1fvKWM.mjs → useMutationEffects-CNVMVAbn.mjs} +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/zod.d.mts +1 -1
- package/package.json +1 -1
- package/dist/queryConfig.context-aO4QOLru.d.mts +0 -24
package/README.md
CHANGED
|
@@ -283,6 +283,24 @@ import { OpenApiQueryConfig } from "@povio/openapi-codegen-cli/query";
|
|
|
283
283
|
</OpenApiQueryConfig.Provider>;
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
+
### Typed invalidation maps
|
|
287
|
+
|
|
288
|
+
With `mutationEffects` (the default), `queryModules.ts` exports `QueryModuleMutations` (for each module, the `data` and `variables` of its mutation hooks) and registers it globally, so `InvalidationMap<QueryModule>` types each module's callback from the spec:
|
|
289
|
+
|
|
290
|
+
```ts
|
|
291
|
+
import type { InvalidationMap } from "@povio/openapi-codegen-cli/query";
|
|
292
|
+
import { QueryModule } from "@/data/queryModules";
|
|
293
|
+
|
|
294
|
+
export const invalidationMap: InvalidationMap<QueryModule> = {
|
|
295
|
+
// `data` is any of the module's mutation responses; variables that only some
|
|
296
|
+
// of its mutations take (here `id`) are optional.
|
|
297
|
+
[QueryModule.Items]: (data, { officeId, id }) => [["items", officeId, id]],
|
|
298
|
+
};
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
The registration is global, so a program with several generated clients should pass the mutations explicitly
|
|
302
|
+
instead: `InvalidationMap<QueryModule, QueryModuleMutations>`.
|
|
303
|
+
|
|
286
304
|
### Runtime response validation
|
|
287
305
|
|
|
288
306
|
Use `OpenApiQueryConfig.Provider` to allow generated GET query hooks to return invalid response data while still logging the response Zod error to the console. Non-GET requests still throw on invalid response data.
|
package/dist/acl.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ErrorHandler } from "./error-handling-
|
|
1
|
+
import { a as ErrorHandler } from "./error-handling-BpAQHWrU.mjs";
|
|
2
2
|
import { PropsWithChildren } from "react";
|
|
3
3
|
import { AbilityTuple, PureAbility, RawRuleOf, Subject } from "@casl/ability";
|
|
4
4
|
import { PackRule } from "@casl/ability/extra";
|
package/dist/axios.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RestClient, i as Response, n as RequestConfig, o as RestInterceptor, r as RequestInfo, t as RestClient$1 } from "./rest-client-
|
|
1
|
+
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";
|
|
2
2
|
export { type RestClient as IRestClient, type RequestConfig, type RequestInfo, type Response, RestClient$1 as RestClient, RestInterceptor };
|
package/dist/config.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { i as resources, n as configureTranslations, r as ns, t as TranslateFunction } from "./i18n-B_brQh4X.mjs";
|
|
2
2
|
import { n as useWorkspaceContext, r as OpenApiRouter, t as OpenApiWorkspaceContext } from "./workspace.context-isVY9ves.mjs";
|
|
3
|
-
import { i as
|
|
4
|
-
export { type InvalidationMap, type InvalidationMapFunc, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, type QueryModule, type TranslateFunction, configureTranslations, ns, resources, useWorkspaceContext };
|
|
3
|
+
import { a as MutationEffectsTypes, i as MutationEffectsOf, n as InvalidationMapFunc, o as OpenApiQueryConfig, r as MergedMutationVariables, s as QueryModule, t as InvalidationMap } from "./queryConfig.context-DjhzewdL.mjs";
|
|
4
|
+
export { type InvalidationMap, type InvalidationMapFunc, type MergedMutationVariables, type MutationEffectsOf, type MutationEffectsTypes, OpenApiQueryConfig, OpenApiRouter, OpenApiWorkspaceContext, type QueryModule, type TranslateFunction, configureTranslations, ns, resources, useWorkspaceContext };
|
|
@@ -43,5 +43,7 @@ declare class ErrorHandler<CodeT extends string | number> {
|
|
|
43
43
|
static getErrorMessage(error: unknown, fallbackToUnknown?: boolean): string | null;
|
|
44
44
|
}
|
|
45
45
|
declare const SharedErrorHandler: ErrorHandler<never>;
|
|
46
|
+
/** What a REST client needs from an error handler; every `ErrorHandler<Codes>` satisfies it. */
|
|
47
|
+
type ErrorRethrower = Pick<ErrorHandler<string | number>, "rethrowError">;
|
|
46
48
|
//#endregion
|
|
47
|
-
export { ErrorHandler as a,
|
|
49
|
+
export { ErrorHandler as a, GeneralErrorCodes as c, ErrorEntry as i, SharedErrorHandler as l, DomainErrorEntry as n, ErrorHandlerOptions as o, DomainErrorRegistry as r, ErrorRethrower as s, ApplicationException as t };
|
package/dist/errors.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as ErrorHandler, c as
|
|
1
|
+
import { a as ErrorHandler, c as GeneralErrorCodes, i as ErrorEntry, l as SharedErrorHandler, n as DomainErrorEntry, o as ErrorHandlerOptions, r as DomainErrorRegistry, s as ErrorRethrower, t as ApplicationException } from "./error-handling-BpAQHWrU.mjs";
|
|
2
2
|
import { t as RestUtils } from "./rest.utils-DpiFIdhF.mjs";
|
|
3
|
-
export { ApplicationException, type DomainErrorEntry, DomainErrorRegistry, type ErrorEntry, ErrorHandler, type ErrorHandlerOptions, type GeneralErrorCodes, RestUtils, SharedErrorHandler };
|
|
3
|
+
export { ApplicationException, type DomainErrorEntry, DomainErrorRegistry, type ErrorEntry, ErrorHandler, type ErrorHandlerOptions, type ErrorRethrower, type GeneralErrorCodes, RestUtils, SharedErrorHandler };
|
|
@@ -1576,7 +1576,7 @@ async function runGenerate({ fileConfig, params, formatGeneratedFile, profiler =
|
|
|
1576
1576
|
const nativeFiles = generateFilesFromNativeOpenAPI(nativeInput.source, nativeInput.yaml, config);
|
|
1577
1577
|
if (nativeFiles) return nativeFiles;
|
|
1578
1578
|
}
|
|
1579
|
-
const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-
|
|
1579
|
+
const { generateCodeFromOpenAPIDoc } = await import("./generateCodeFromOpenAPIDoc-B8FAsxWE.mjs").then((n) => n.n);
|
|
1580
1580
|
return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
|
|
1581
1581
|
source: nativeInput.source,
|
|
1582
1582
|
yaml: nativeInput.yaml
|
package/dist/{generateCodeFromOpenAPIDoc-D1H6MZiS.mjs → generateCodeFromOpenAPIDoc-B8FAsxWE.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as getZodSchemaRefs, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-
|
|
2
|
-
import { $ as getImportedAbilityFunctionName, A as getEndpointsImports, An as NATIVE_RESPONSE_TYPE, At as APP_REST_CLIENT_NAME, B as getPrefetchInfiniteQueryName, Bt as NATIVE_PACKAGE_IMPORT_PATH, C as getAppRestClientImportPath, Cn as ZOD_IMPORT, D as getTagFileName, Dn as AXIOS_REQUEST_CONFIG_TYPE, Dt as isEnumZodSchema, E as getQueryTypesImportPath, En as AXIOS_REQUEST_CONFIG_NAME, F as mergeImports, Ft as QUERY_MODULE_ENUM, G as getAbilityConditionType, H as getQueryName, Ht as getNamespaceName, I as getImportedInfiniteQueryName, In as shouldInlineEndpointsForTag, It as QUERY_OPTIONS_TYPES, J as getAbilityFunctionName, K as getAbilityConditionsTypes, L as getImportedQueryName, Ln as camelToSpaceSeparated, Lt as ZOD_EXTENDED, M as getInfiniteQueriesImports, Mt as DOMAIN_ERRORS_FILE, N as getModelsImports, Nn as getEndpointTag, Nt as MUTATION_EFFECTS, O as getTagImportPath, Ot as isNamedZodSchema, P as getQueriesImports, Pt as QUERY_MODULES_FILE, Q as getAppAbilitiesType, R as getInfiniteQueryName, Rn as capitalize, Rt as AXIOS_PACKAGE_IMPORT_PATH, T as getQueryModulesImportPath, Tn as AXIOS_IMPORT, U as getQueryOptionsName, V as getPrefetchQueryName, Vn as kebabToCamel, Vt as REST_PACKAGE_IMPORT_PATH, W as getAbilityAction, Wn as Profiler, X as getAbilitySubjectTypes, Y as getAbilitySubject, Z as getAclData, Zt as isParamMediaTypeAllowed, _ as hasEndpointConfig, _t as isReadAllEndpoint, an as wrapWithQuotesIfNeeded, at as getZodSchemaInferedTypeName, b as requiresBody, bt as invalidVariableNameCharactersToCamel, c as getDestructuredVariables, cn as isReferenceObject, ct as getSchemaDescriptions, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, et as hasAbilityConditions, f as getEndpointBody, fn as ANY_SCHEMA, ft as getPathSegments, g as getImportedEndpointName, gt as isPathSegmentParam, h as getEndpointPath, ht as isDeleteEndpoint, i as shouldUseNativeCodegen, it as getZodSchemaDescription, j as getImportPath, jn as getRequestConfigTypeName, jt as BUILDERS_UTILS, k as getAclImports, kn as JSON_APPLICATION_FORMAT, kt as APP_REST_CLIENT_FILE, l as isInfiniteQuery, ln as isSchemaObject, m as getEndpointName, mt as isCreateEndpoint, nt as getImportedZodSchemaInferedTypeName, o as getOutputFileName, ot as getZodSchemaPropertyDescriptions, p as getEndpointConfig, pt as isBulkDeleteEndpoint, q as getAbilityDescription, r as compileNativeData, rt as getImportedZodSchemaName, st as getZodSchemaType, tt as renderAclCheckCall, u as isMutation, ut as getUniqueArray, v as mapEndpointParamsToFunctionParams, vt as isReadEndpoint, w as getFileNameWithExtension, wn as AXIOS_DEFAULT_IMPORT_NAME, y as renderMediaUploadMutationBody, yt as isUpdateEndpoint, z as getInfiniteQueryOptionsName, zt as CONFIG_PACKAGE_IMPORT_PATH } from "./generate.runner-
|
|
1
|
+
import { r as getZodSchemaRefs, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-CXYNMMMt.mjs";
|
|
2
|
+
import { $ as getImportedAbilityFunctionName, A as getEndpointsImports, An as NATIVE_RESPONSE_TYPE, At as APP_REST_CLIENT_NAME, B as getPrefetchInfiniteQueryName, Bt as NATIVE_PACKAGE_IMPORT_PATH, C as getAppRestClientImportPath, Cn as ZOD_IMPORT, D as getTagFileName, Dn as AXIOS_REQUEST_CONFIG_TYPE, Dt as isEnumZodSchema, E as getQueryTypesImportPath, En as AXIOS_REQUEST_CONFIG_NAME, F as mergeImports, Ft as QUERY_MODULE_ENUM, G as getAbilityConditionType, H as getQueryName, Ht as getNamespaceName, I as getImportedInfiniteQueryName, In as shouldInlineEndpointsForTag, It as QUERY_OPTIONS_TYPES, J as getAbilityFunctionName, K as getAbilityConditionsTypes, L as getImportedQueryName, Ln as camelToSpaceSeparated, Lt as ZOD_EXTENDED, M as getInfiniteQueriesImports, Mt as DOMAIN_ERRORS_FILE, N as getModelsImports, Nn as getEndpointTag, Nt as MUTATION_EFFECTS, O as getTagImportPath, Ot as isNamedZodSchema, P as getQueriesImports, Pt as QUERY_MODULES_FILE, Q as getAppAbilitiesType, R as getInfiniteQueryName, Rn as capitalize, Rt as AXIOS_PACKAGE_IMPORT_PATH, T as getQueryModulesImportPath, Tn as AXIOS_IMPORT, U as getQueryOptionsName, V as getPrefetchQueryName, Vn as kebabToCamel, Vt as REST_PACKAGE_IMPORT_PATH, W as getAbilityAction, Wn as Profiler, X as getAbilitySubjectTypes, Y as getAbilitySubject, Z as getAclData, Zt as isParamMediaTypeAllowed, _ as hasEndpointConfig, _t as isReadAllEndpoint, an as wrapWithQuotesIfNeeded, at as getZodSchemaInferedTypeName, b as requiresBody, bt as invalidVariableNameCharactersToCamel, c as getDestructuredVariables, cn as isReferenceObject, ct as getSchemaDescriptions, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, et as hasAbilityConditions, f as getEndpointBody, fn as ANY_SCHEMA, ft as getPathSegments, g as getImportedEndpointName, gt as isPathSegmentParam, h as getEndpointPath, ht as isDeleteEndpoint, i as shouldUseNativeCodegen, it as getZodSchemaDescription, j as getImportPath, jn as getRequestConfigTypeName, jt as BUILDERS_UTILS, k as getAclImports, kn as JSON_APPLICATION_FORMAT, kt as APP_REST_CLIENT_FILE, l as isInfiniteQuery, ln as isSchemaObject, m as getEndpointName, mt as isCreateEndpoint, nt as getImportedZodSchemaInferedTypeName, o as getOutputFileName, ot as getZodSchemaPropertyDescriptions, p as getEndpointConfig, pt as isBulkDeleteEndpoint, q as getAbilityDescription, r as compileNativeData, rt as getImportedZodSchemaName, st as getZodSchemaType, tt as renderAclCheckCall, u as isMutation, ut as getUniqueArray, v as mapEndpointParamsToFunctionParams, vt as isReadEndpoint, w as getFileNameWithExtension, wn as AXIOS_DEFAULT_IMPORT_NAME, y as renderMediaUploadMutationBody, yt as isUpdateEndpoint, z as getInfiniteQueryOptionsName, zt as CONFIG_PACKAGE_IMPORT_PATH } from "./generate.runner-Sh0Ps6AW.mjs";
|
|
3
3
|
import "node:module";
|
|
4
4
|
//#region \0rolldown/runtime.js
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -1787,13 +1787,38 @@ function generateQueryModules({ resolver, data }) {
|
|
|
1787
1787
|
type: "queries",
|
|
1788
1788
|
tag,
|
|
1789
1789
|
options: resolver.options
|
|
1790
|
-
})
|
|
1790
|
+
}),
|
|
1791
|
+
mutationHooks: endpoints.filter(isMutation).map((endpoint) => getQueryName(endpoint, true))
|
|
1791
1792
|
});
|
|
1792
1793
|
});
|
|
1794
|
+
const mutationModules = modules.filter((module) => module.mutationHooks.length > 0);
|
|
1793
1795
|
const lines = [];
|
|
1796
|
+
if (mutationModules.length > 0) {
|
|
1797
|
+
lines.push(`import type { MutationEffectsOf } from "${getQueryTypesImportPath(resolver.options)}";`);
|
|
1798
|
+
for (const module of mutationModules) {
|
|
1799
|
+
const from = `${getImportPath(resolver.options, true)}${getTagImportPath({
|
|
1800
|
+
type: "queries",
|
|
1801
|
+
tag: module.tag,
|
|
1802
|
+
options: resolver.options
|
|
1803
|
+
})}`;
|
|
1804
|
+
lines.push(resolver.options.tsNamespaces ? `import type { ${module.namespace} } from "${from}";` : `import type * as ${module.namespace} from "${from}";`);
|
|
1805
|
+
}
|
|
1806
|
+
lines.push("");
|
|
1807
|
+
}
|
|
1794
1808
|
lines.push("export const enum QueryModule {");
|
|
1795
1809
|
for (const module of modules) lines.push(` ${module.tag} = "${module.namespace}",`);
|
|
1796
1810
|
lines.push("}");
|
|
1811
|
+
lines.push("");
|
|
1812
|
+
lines.push("export interface QueryModuleMutations {");
|
|
1813
|
+
for (const module of mutationModules) {
|
|
1814
|
+
const hooks = module.mutationHooks.map((hook) => `typeof ${module.namespace}.${hook}`).join(" | ");
|
|
1815
|
+
lines.push(` [QueryModule.${module.tag}]: MutationEffectsOf<${hooks}>;`);
|
|
1816
|
+
}
|
|
1817
|
+
lines.push("}");
|
|
1818
|
+
lines.push("");
|
|
1819
|
+
lines.push("declare global {");
|
|
1820
|
+
lines.push(" interface OpenApiCodegenQueryModuleMutations extends QueryModuleMutations {}");
|
|
1821
|
+
lines.push("}");
|
|
1797
1822
|
return lines.join("\n");
|
|
1798
1823
|
}
|
|
1799
1824
|
//#endregion
|
package/dist/{generateCodeFromOpenAPIDoc-CGoR73wh.cjs → generateCodeFromOpenAPIDoc-Bbi8fYi2.cjs}
RENAMED
|
@@ -3770,13 +3770,38 @@ function generateQueryModules({ resolver, data }) {
|
|
|
3770
3770
|
type: "queries",
|
|
3771
3771
|
tag,
|
|
3772
3772
|
options: resolver.options
|
|
3773
|
-
})
|
|
3773
|
+
}),
|
|
3774
|
+
mutationHooks: endpoints.filter(require_generate_utils.isMutation).map((endpoint) => require_generate_utils.getQueryName(endpoint, true))
|
|
3774
3775
|
});
|
|
3775
3776
|
});
|
|
3777
|
+
const mutationModules = modules.filter((module) => module.mutationHooks.length > 0);
|
|
3776
3778
|
const lines = [];
|
|
3779
|
+
if (mutationModules.length > 0) {
|
|
3780
|
+
lines.push(`import type { MutationEffectsOf } from "${require_generate_utils.getQueryTypesImportPath(resolver.options)}";`);
|
|
3781
|
+
for (const module of mutationModules) {
|
|
3782
|
+
const from = `${require_generate_utils.getImportPath(resolver.options, true)}${require_generate_utils.getTagImportPath({
|
|
3783
|
+
type: "queries",
|
|
3784
|
+
tag: module.tag,
|
|
3785
|
+
options: resolver.options
|
|
3786
|
+
})}`;
|
|
3787
|
+
lines.push(resolver.options.tsNamespaces ? `import type { ${module.namespace} } from "${from}";` : `import type * as ${module.namespace} from "${from}";`);
|
|
3788
|
+
}
|
|
3789
|
+
lines.push("");
|
|
3790
|
+
}
|
|
3777
3791
|
lines.push("export const enum QueryModule {");
|
|
3778
3792
|
for (const module of modules) lines.push(` ${module.tag} = "${module.namespace}",`);
|
|
3779
3793
|
lines.push("}");
|
|
3794
|
+
lines.push("");
|
|
3795
|
+
lines.push("export interface QueryModuleMutations {");
|
|
3796
|
+
for (const module of mutationModules) {
|
|
3797
|
+
const hooks = module.mutationHooks.map((hook) => `typeof ${module.namespace}.${hook}`).join(" | ");
|
|
3798
|
+
lines.push(` [QueryModule.${module.tag}]: MutationEffectsOf<${hooks}>;`);
|
|
3799
|
+
}
|
|
3800
|
+
lines.push("}");
|
|
3801
|
+
lines.push("");
|
|
3802
|
+
lines.push("declare global {");
|
|
3803
|
+
lines.push(" interface OpenApiCodegenQueryModuleMutations extends QueryModuleMutations {}");
|
|
3804
|
+
lines.push("}");
|
|
3780
3805
|
return lines.join("\n");
|
|
3781
3806
|
}
|
|
3782
3807
|
//#endregion
|
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 { H as getQueryName, Ht as getNamespaceName, Mn as formatTag, O as getTagImportPath, S as getTsTypeBase, Xt as isMediaTypeAllowed, Zt as isParamMediaTypeAllowed, bt as invalidVariableNameCharactersToCamel, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, t as getOpenApiDoc, u as isMutation, x as getSchemaTsMetaType } from "./generate.runner-
|
|
1
|
+
import { t as generateCodeFromOpenAPIDoc } from "./generateCodeFromOpenAPIDoc-B8FAsxWE.mjs";
|
|
2
|
+
import { t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-CXYNMMMt.mjs";
|
|
3
|
+
import { H as getQueryName, Ht as getNamespaceName, Mn as formatTag, O as getTagImportPath, S as getTsTypeBase, Xt as isMediaTypeAllowed, Zt as isParamMediaTypeAllowed, bt as invalidVariableNameCharactersToCamel, d as isQuery, dt as DEFAULT_GENERATE_OPTIONS, t as getOpenApiDoc, u as isMutation, x as getSchemaTsMetaType } from "./generate.runner-Sh0Ps6AW.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,4 @@
|
|
|
1
|
-
import { $t as isPrimitiveType, Bn as getMostCommonAdjacentCombinationSplit, Ct as getParamZodSchemaName, Et as getZodSchemaOperationName, Fn as isTagIncluded, Gt as getParameterEnumNames, Hn as removeWord, Ht as getNamespaceName, Jt as isErrorStatus, Kt as getSchemaNameByRef, Mn as formatTag, Nn as getEndpointTag, On as BODY_PARAMETER_NAME, Ot as isNamedZodSchema, Pn as getOperationTag, Qt as isPathExcluded, Rn as capitalize, Sn as VOID_SCHEMA, St as getEnumZodSchemaName, Tt as getZodSchemaName, Un as snakeToCamel, Ut as autocorrectRef, Wn as Profiler, Wt as escapeControlCharacters, Xt as isMediaTypeAllowed, Yt as isMainResponseStatus, Zt as isParamMediaTypeAllowed, _n as INT_SCHEMA, an as wrapWithQuotesIfNeeded, bn as URL_SCHEMA, bt as invalidVariableNameCharactersToCamel, cn as isReferenceObject, d as isQuery, dn as ALLOWED_PATH_IN, en as isSortingParameterObject, fn as ANY_SCHEMA, gn as ENUM_SCHEMA, hn as EMAIL_SCHEMA, in as unwrapQuotesIfNeeded, kn as JSON_APPLICATION_FORMAT, ln as isSchemaObject, lt as iterateSchema, mn as DATETIME_SCHEMA, nn as pathToVariableName, on as inferRequiredSchema, pn as BLOB_SCHEMA, qt as getSchemaRef, rn as replaceHyphenatedPath, s as pick, sn as isArraySchemaObject, tn as pathParamToVariableName, un as ALLOWED_METHODS, ut as getUniqueArray, vn as NUMBER_SCHEMA, wt as getResponseZodSchemaName, xn as UUID_SCHEMA, xt as getBodyZodSchemaName, yn as STRING_SCHEMA, zn as decapitalize } from "./generate.runner-
|
|
1
|
+
import { $t as isPrimitiveType, Bn as getMostCommonAdjacentCombinationSplit, Ct as getParamZodSchemaName, Et as getZodSchemaOperationName, Fn as isTagIncluded, Gt as getParameterEnumNames, Hn as removeWord, Ht as getNamespaceName, Jt as isErrorStatus, Kt as getSchemaNameByRef, Mn as formatTag, Nn as getEndpointTag, On as BODY_PARAMETER_NAME, Ot as isNamedZodSchema, Pn as getOperationTag, Qt as isPathExcluded, Rn as capitalize, Sn as VOID_SCHEMA, St as getEnumZodSchemaName, Tt as getZodSchemaName, Un as snakeToCamel, Ut as autocorrectRef, Wn as Profiler, Wt as escapeControlCharacters, Xt as isMediaTypeAllowed, Yt as isMainResponseStatus, Zt as isParamMediaTypeAllowed, _n as INT_SCHEMA, an as wrapWithQuotesIfNeeded, bn as URL_SCHEMA, bt as invalidVariableNameCharactersToCamel, cn as isReferenceObject, d as isQuery, dn as ALLOWED_PATH_IN, en as isSortingParameterObject, fn as ANY_SCHEMA, gn as ENUM_SCHEMA, hn as EMAIL_SCHEMA, in as unwrapQuotesIfNeeded, kn as JSON_APPLICATION_FORMAT, ln as isSchemaObject, lt as iterateSchema, mn as DATETIME_SCHEMA, nn as pathToVariableName, on as inferRequiredSchema, pn as BLOB_SCHEMA, qt as getSchemaRef, rn as replaceHyphenatedPath, s as pick, sn as isArraySchemaObject, tn as pathParamToVariableName, un as ALLOWED_METHODS, ut as getUniqueArray, vn as NUMBER_SCHEMA, wt as getResponseZodSchemaName, xn as UUID_SCHEMA, xt as getBodyZodSchemaName, yn as STRING_SCHEMA, zn as decapitalize } from "./generate.runner-Sh0Ps6AW.mjs";
|
|
2
2
|
//#region src/generators/const/validation.const.ts
|
|
3
3
|
const HTTP_STATUS_CODES = {
|
|
4
4
|
"100": "Continue",
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { i as resources, n as configureTranslations, r as ns, t as TranslateFunction } from "./i18n-B_brQh4X.mjs";
|
|
2
|
-
import { a as ErrorHandler, c as
|
|
2
|
+
import { a as ErrorHandler, c as GeneralErrorCodes, i as ErrorEntry, l as SharedErrorHandler, n as DomainErrorEntry, o as ErrorHandlerOptions, r as DomainErrorRegistry, s as ErrorRethrower, t as ApplicationException } from "./error-handling-BpAQHWrU.mjs";
|
|
3
3
|
import { n as AuthGuardProps, r as AuthContext, t as AuthGuard } from "./AuthGuard-GbtTDXs0.mjs";
|
|
4
|
-
import { a as RestClient, i as Response, n as RequestConfig, o as RestInterceptor, r as RequestInfo, t as RestClient$1 } from "./rest-client-
|
|
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 { i as
|
|
6
|
+
import { a as MutationEffectsTypes, i as MutationEffectsOf, n as InvalidationMapFunc, o as OpenApiQueryConfig, r as MergedMutationVariables, s as QueryModule, t as InvalidationMap } from "./queryConfig.context-DjhzewdL.mjs";
|
|
7
7
|
import { t as RestUtils } from "./rest.utils-DpiFIdhF.mjs";
|
|
8
8
|
import { t as OpenAPICodegenConfig } from "./config-CiLFKLAY.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
|
-
import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-
|
|
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 GeneralErrorCodes, type RestClient as IRestClient, type InvalidationMap, type InvalidationMapFunc, type MutationEffectsOptions, 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 };
|
|
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-CJJuL9Ak.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 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { t as HttpError } from "./rest-transport.types-DxitRtsB.mjs";
|
|
|
4
4
|
import { n as RestClient, t as RestInterceptor } from "./rest-interceptor-Dm9DFErh.mjs";
|
|
5
5
|
import { n as NativeRestClient, t as NativeRestInterceptor } from "./native-rest-interceptor-Np4Ov54n.mjs";
|
|
6
6
|
import { t as OpenApiQueryConfig } from "./queryConfig.context-CldQ5YL9.mjs";
|
|
7
|
-
import { t as useMutationEffects } from "./useMutationEffects-
|
|
7
|
+
import { t as useMutationEffects } from "./useMutationEffects-CNVMVAbn.mjs";
|
|
8
8
|
import { t as OpenApiRouter } from "./router.context-EPlMBk3G.mjs";
|
|
9
9
|
import { n as useWorkspaceContext, t as OpenApiWorkspaceContext } from "./workspace.context-XWvQ_7Hg.mjs";
|
|
10
10
|
import { t as AuthContext } from "./auth.context-COWO6ssl.mjs";
|
package/dist/metro.cjs
CHANGED
|
@@ -102,7 +102,7 @@ async function runGenerate({ fileConfig, params, formatGeneratedFile, profiler =
|
|
|
102
102
|
const nativeFiles = generateFilesFromNativeOpenAPI(nativeInput.source, nativeInput.yaml, config);
|
|
103
103
|
if (nativeFiles) return nativeFiles;
|
|
104
104
|
}
|
|
105
|
-
const { generateCodeFromOpenAPIDoc } = await Promise.resolve().then(() => require("./generateCodeFromOpenAPIDoc-
|
|
105
|
+
const { generateCodeFromOpenAPIDoc } = await Promise.resolve().then(() => require("./generateCodeFromOpenAPIDoc-Bbi8fYi2.cjs"));
|
|
106
106
|
return generateCodeFromOpenAPIDoc(openApiDoc, config, profiler, {
|
|
107
107
|
source: nativeInput.source,
|
|
108
108
|
yaml: nativeInput.yaml
|
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-bJTFHTdn.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";
|
package/dist/{native-rest-interceptor-BX45GDWd.d.mts → native-rest-interceptor-DZxdDcpz.d.mts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as ErrorRethrower } from "./error-handling-BpAQHWrU.mjs";
|
|
2
2
|
import { a as RestTransport, c as TransportFetch, d as TransportResponse, l as TransportRequest, o as RestTransportInterceptor, r as RestRequestInfo, s as TransportErrorContext, t as GeneralTransportErrorCode, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
|
|
3
3
|
//#region src/lib/rest/native-rest-client.d.ts
|
|
4
4
|
type NativeResult<T, IsRawRes extends boolean> = IsRawRes extends true ? TransportResponse<T> : T;
|
|
@@ -13,7 +13,7 @@ declare class NativeRestClient implements RestTransport {
|
|
|
13
13
|
fetch?: TransportFetch;
|
|
14
14
|
};
|
|
15
15
|
interceptors?: RestTransportInterceptor[];
|
|
16
|
-
errorHandler?:
|
|
16
|
+
errorHandler?: ErrorRethrower;
|
|
17
17
|
});
|
|
18
18
|
private readonly baseURL;
|
|
19
19
|
private readonly headers?;
|
package/dist/native.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as RestTransport, d as TransportResponse, f as TransportResult, i as RestResponseType, l as TransportRequest, n as HttpError, o as RestTransportInterceptor, p as UploadProgress, r as RestRequestInfo, t as GeneralTransportErrorCode, u as TransportRequestConfig } from "./rest-transport.types-DM5-qyOJ.mjs";
|
|
2
|
-
import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-
|
|
2
|
+
import { n as NativeRestInterceptor, r as NativeRestClient, t as NativeInterceptor } from "./native-rest-interceptor-DZxdDcpz.mjs";
|
|
3
3
|
export { type GeneralTransportErrorCode, HttpError, HttpError as NativeHttpError, type NativeInterceptor, type TransportRequest as NativeRequest, type TransportRequest, type TransportRequestConfig as NativeRequestConfig, type TransportRequestConfig, type TransportResponse as NativeResponse, type TransportResponse, NativeRestClient, NativeRestInterceptor, type UploadProgress as NativeUploadProgress, type UploadProgress, type RestRequestInfo, type RestResponseType, type RestTransport, type RestTransportInterceptor, type TransportResult };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Wn as Profiler, n as runGenerate } from "./generate.runner-
|
|
1
|
+
import { Wn as Profiler, n as runGenerate } from "./generate.runner-Sh0Ps6AW.mjs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
//#region src/plugins/openapi-codegen.runner.ts
|
|
4
4
|
function createOpenApiCodegenRunner(config, options = {}) {
|
package/dist/query.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i 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 MutationEffectsOptions, OpenApiQueryConfig, type QueryModule, useMutationEffects };
|
|
1
|
+
import { a as MutationEffectsTypes, i as MutationEffectsOf, n as InvalidationMapFunc, o as OpenApiQueryConfig, r as MergedMutationVariables, s as QueryModule, t as InvalidationMap } from "./queryConfig.context-DjhzewdL.mjs";
|
|
2
|
+
import { a as AppQueryOptions, i as AppMutationOptions, n as useMutationEffects, r as AppInfiniteQueryOptions, t as MutationEffectsOptions } from "./useMutationEffects-CJJuL9Ak.mjs";
|
|
3
|
+
export { type AppInfiniteQueryOptions, type AppMutationOptions, type AppQueryOptions, type InvalidationMap, type InvalidationMapFunc, type MergedMutationVariables, type MutationEffectsOf, type MutationEffectsOptions, type MutationEffectsTypes, OpenApiQueryConfig, type QueryModule, useMutationEffects };
|
package/dist/query.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as OpenApiQueryConfig } from "./queryConfig.context-CldQ5YL9.mjs";
|
|
2
|
-
import { t as useMutationEffects } from "./useMutationEffects-
|
|
2
|
+
import { t as useMutationEffects } from "./useMutationEffects-CNVMVAbn.mjs";
|
|
3
3
|
export { OpenApiQueryConfig, useMutationEffects };
|
|
@@ -0,0 +1,56 @@
|
|
|
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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ErrorHandler,
|
|
1
|
+
import { a as ErrorHandler, c as GeneralErrorCodes$1, s as ErrorRethrower } from "./error-handling-BpAQHWrU.mjs";
|
|
2
2
|
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, CreateAxiosDefaults } from "axios";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/lib/rest/rest-interceptor.d.ts
|
|
@@ -39,7 +39,7 @@ declare class RestClient implements RestClient$1 {
|
|
|
39
39
|
constructor({ config, interceptors, errorHandler }?: {
|
|
40
40
|
config?: CreateAxiosDefaults;
|
|
41
41
|
interceptors?: RestInterceptor<[]>[];
|
|
42
|
-
errorHandler?:
|
|
42
|
+
errorHandler?: ErrorRethrower;
|
|
43
43
|
});
|
|
44
44
|
attachInterceptors<T extends unknown[]>(interceptors?: RestInterceptor<T>[], ...args: T): void;
|
|
45
45
|
attachInterceptor<T extends unknown[]>(interceptor: RestInterceptor<T>, ...args: T): void;
|
package/dist/sh.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { i as VALIDATION_ERROR_TYPE_TITLE, n as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-
|
|
3
|
-
import { D as getTagFileName, Wn as Profiler, a as resolveConfig, n as runGenerate, o as getOutputFileName, t as getOpenApiDoc } from "./generate.runner-
|
|
2
|
+
import { i as VALIDATION_ERROR_TYPE_TITLE, n as groupByType, t as getDataFromOpenAPIDoc } from "./getDataFromOpenAPIDoc-CXYNMMMt.mjs";
|
|
3
|
+
import { D as getTagFileName, Wn as Profiler, a as resolveConfig, n as runGenerate, o as getOutputFileName, t as getOpenApiDoc } from "./generate.runner-Sh0Ps6AW.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.3";
|
|
35
35
|
}
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/helpers/yargs.helper.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { c as GeneralErrorCodes, t as ApplicationException } from "./error-handling-BpAQHWrU.mjs";
|
|
2
|
+
import { s as QueryModule, t as InvalidationMap } from "./queryConfig.context-DjhzewdL.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;
|
|
@@ -36,7 +36,7 @@ function useMutationEffects({ currentModule }) {
|
|
|
36
36
|
const shouldInvalidateCurrentModule = invalidateCurrentModule ?? config.invalidateCurrentModule ?? true;
|
|
37
37
|
const isQueryKeyEqual = (keyA, keyB) => keyA.length === keyB.length && keyA.every((item, index) => item === keyB[index]);
|
|
38
38
|
const isQueryKeyPrefix = (queryKey, prefixKey) => prefixKey.length <= queryKey.length && prefixKey.every((item, index) => item === queryKey[index]);
|
|
39
|
-
const mappedInvalidationKeys = invalidationMap?.[currentModule]
|
|
39
|
+
const mappedInvalidationKeys = (invalidationMap?.[currentModule] ?? config.invalidationMap?.[currentModule])?.(data, variables);
|
|
40
40
|
const shouldInvalidateQuery = (queryKey) => {
|
|
41
41
|
const isUpdateKey = updateKeys?.some((key) => isQueryKeyEqual(queryKey, key));
|
|
42
42
|
if (shouldUpdate && isUpdateKey) return false;
|
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-bJTFHTdn.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/dist/zod.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
import { QueryKey } 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
|
-
type InvalidationMap<TQueryModule extends QueryModule = QueryModule, TData = unknown, TVariables = unknown> = Partial<Record<TQueryModule, InvalidationMapFunc<TData, TVariables>>>;
|
|
9
|
-
declare namespace OpenApiQueryConfig {
|
|
10
|
-
export interface Type<TQueryModule extends QueryModule = QueryModule> {
|
|
11
|
-
preferUpdate?: boolean;
|
|
12
|
-
invalidateCurrentModule?: boolean;
|
|
13
|
-
invalidationMap?: InvalidationMap<TQueryModule>;
|
|
14
|
-
crossTabInvalidation?: boolean;
|
|
15
|
-
allowInvalidResponseData?: boolean;
|
|
16
|
-
onError?: (error: unknown) => void;
|
|
17
|
-
}
|
|
18
|
-
type ProviderProps<TQueryModule extends QueryModule = QueryModule> = Type<TQueryModule>;
|
|
19
|
-
export function Provider<TQueryModule extends QueryModule = QueryModule>({ preferUpdate, invalidateCurrentModule, invalidationMap, crossTabInvalidation, allowInvalidResponseData, onError, children }: PropsWithChildren<ProviderProps<TQueryModule>>): import("react").JSX.Element;
|
|
20
|
-
export const useConfig: <TQueryModule extends QueryModule = QueryModule>() => Type<TQueryModule>;
|
|
21
|
-
export {};
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { QueryModule as i, InvalidationMapFunc as n, OpenApiQueryConfig as r, InvalidationMap as t };
|