@hey-api/openapi-ts 0.93.0 → 0.93.1
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/dist/clients/angular/types.ts +1 -1
- package/dist/clients/axios/types.ts +1 -1
- package/dist/clients/core/params.ts +1 -1
- package/dist/clients/fetch/types.ts +1 -1
- package/dist/clients/ky/types.ts +1 -1
- package/dist/clients/next/types.ts +1 -1
- package/dist/clients/nuxt/types.ts +1 -1
- package/dist/clients/nuxt/utils.ts +4 -0
- package/dist/clients/ofetch/types.ts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{init-BVQKw3ZX.mjs → init-CuDouDN2.mjs} +22 -16
- package/dist/init-CuDouDN2.mjs.map +1 -0
- package/dist/internal.mjs +1 -1
- package/dist/run.mjs +5 -5
- package/dist/run.mjs.map +1 -1
- package/dist/{src-BD5OAshH.mjs → src-DRRrhVf_.mjs} +2 -2
- package/dist/{src-BD5OAshH.mjs.map → src-DRRrhVf_.mjs.map} +1 -1
- package/package.json +3 -3
- package/dist/init-BVQKw3ZX.mjs.map +0 -1
|
@@ -209,7 +209,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
|
|
|
209
209
|
*/
|
|
210
210
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
|
211
211
|
override?: Config<ClientOptions & T>,
|
|
212
|
-
) => Config<Required<ClientOptions> & T
|
|
212
|
+
) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
|
|
213
213
|
|
|
214
214
|
export interface TDataShape {
|
|
215
215
|
body?: unknown;
|
|
@@ -139,7 +139,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
|
|
|
139
139
|
*/
|
|
140
140
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
|
141
141
|
override?: Config<ClientOptions & T>,
|
|
142
|
-
) => Config<Required<ClientOptions> & T
|
|
142
|
+
) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
|
|
143
143
|
|
|
144
144
|
export interface TDataShape {
|
|
145
145
|
body?: unknown;
|
|
@@ -94,7 +94,7 @@ interface Params {
|
|
|
94
94
|
|
|
95
95
|
const stripEmptySlots = (params: Params) => {
|
|
96
96
|
for (const [slot, value] of Object.entries(params)) {
|
|
97
|
-
if (value && typeof value === 'object' && !Object.keys(value).length) {
|
|
97
|
+
if (value && typeof value === 'object' && !Array.isArray(value) && !Object.keys(value).length) {
|
|
98
98
|
delete params[slot as Slot];
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -188,7 +188,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
|
|
|
188
188
|
*/
|
|
189
189
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
|
190
190
|
override?: Config<ClientOptions & T>,
|
|
191
|
-
) => Config<Required<ClientOptions> & T
|
|
191
|
+
) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
|
|
192
192
|
|
|
193
193
|
export interface TDataShape {
|
|
194
194
|
body?: unknown;
|
package/dist/clients/ky/types.ts
CHANGED
|
@@ -220,7 +220,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
|
|
|
220
220
|
*/
|
|
221
221
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
|
222
222
|
override?: Config<ClientOptions & T>,
|
|
223
|
-
) => Config<Required<ClientOptions> & T
|
|
223
|
+
) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
|
|
224
224
|
|
|
225
225
|
export interface TDataShape {
|
|
226
226
|
body?: unknown;
|
|
@@ -143,7 +143,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
|
|
|
143
143
|
*/
|
|
144
144
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
|
145
145
|
override?: Config<ClientOptions & T>,
|
|
146
|
-
) => Config<Required<ClientOptions> & T
|
|
146
|
+
) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
|
|
147
147
|
|
|
148
148
|
export interface TDataShape {
|
|
149
149
|
body?: unknown;
|
|
@@ -147,7 +147,7 @@ type RequestFn = <
|
|
|
147
147
|
*/
|
|
148
148
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
|
149
149
|
override?: Config<ClientOptions & T>,
|
|
150
|
-
) => Config<Required<ClientOptions> & T
|
|
150
|
+
) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
|
|
151
151
|
|
|
152
152
|
export interface TDataShape {
|
|
153
153
|
body?: unknown;
|
|
@@ -344,6 +344,10 @@ export const unwrapRefs = <T>(value: T): UnwrapRefs<T> => {
|
|
|
344
344
|
return (isRef(value) ? unref(value) : value) as UnwrapRefs<T>;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
+
if (value instanceof Blob) {
|
|
348
|
+
return value as UnwrapRefs<T>;
|
|
349
|
+
}
|
|
350
|
+
|
|
347
351
|
if (Array.isArray(value)) {
|
|
348
352
|
return value.map((item) => unwrapRefs(item)) as UnwrapRefs<T>;
|
|
349
353
|
}
|
|
@@ -251,7 +251,7 @@ export type Client = CoreClient<RequestFn, Config, MethodFn, BuildUrlFn, SseFn>
|
|
|
251
251
|
*/
|
|
252
252
|
export type CreateClientConfig<T extends ClientOptions = ClientOptions> = (
|
|
253
253
|
override?: Config<ClientOptions & T>,
|
|
254
|
-
) => Config<Required<ClientOptions> & T
|
|
254
|
+
) => Config<Required<ClientOptions> & T> | Promise<Config<Required<ClientOptions> & T>>;
|
|
255
255
|
|
|
256
256
|
export interface TDataShape {
|
|
257
257
|
body?: unknown;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as clientDefaultConfig, c as TypeScriptRenderer, d as reserved, f as keywords, l as TsDslContext, m as TsDsl, n as defaultPlugins, o as clientDefaultMeta, p as regexp, r as clientPluginHandler, s as $, u as ctx } from "./init-
|
|
2
|
-
import { a as defineConfig, c as createClient, i as defaultPaginationKeywords, n as OperationPath, o as definePluginConfig, r as OperationStrategy, s as utils, t as Logger } from "./src-
|
|
1
|
+
import { a as clientDefaultConfig, c as TypeScriptRenderer, d as reserved, f as keywords, l as TsDslContext, m as TsDsl, n as defaultPlugins, o as clientDefaultMeta, p as regexp, r as clientPluginHandler, s as $, u as ctx } from "./init-CuDouDN2.mjs";
|
|
2
|
+
import { a as defineConfig, c as createClient, i as defaultPaginationKeywords, n as OperationPath, o as definePluginConfig, r as OperationStrategy, s as utils, t as Logger } from "./src-DRRrhVf_.mjs";
|
|
3
3
|
|
|
4
4
|
export { $, Logger, OperationPath, OperationStrategy, TsDsl, TsDslContext, TypeScriptRenderer, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, createClient, ctx, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, keywords, regexp, reserved, utils };
|
|
@@ -4401,7 +4401,7 @@ function getSignatureParameters({ operation }) {
|
|
|
4401
4401
|
const property = properties[originalName];
|
|
4402
4402
|
const name = conflicts.has(originalName) ? `${location}_${originalName}` : originalName;
|
|
4403
4403
|
const signatureParameter = {
|
|
4404
|
-
isRequired:
|
|
4404
|
+
isRequired: operation.body.schema.required?.includes(originalName) ?? false,
|
|
4405
4405
|
name,
|
|
4406
4406
|
schema: property
|
|
4407
4407
|
};
|
|
@@ -5499,7 +5499,7 @@ const createClient = ({ plugin }) => {
|
|
|
5499
5499
|
if ("throwOnError" in plugin.config && plugin.config.throwOnError) defaultVals.prop("throwOnError", $.literal(true));
|
|
5500
5500
|
const createConfigParameters = [$(symbolCreateConfig).call(defaultVals.hasProps() ? defaultVals : void 0).generic(symbolClientOptions)];
|
|
5501
5501
|
const symbolClient = plugin.symbol("client", { meta: { category: "client" } });
|
|
5502
|
-
const statement = $.const(symbolClient).export().assign($(symbolCreateClient).$if(symbolCreateClientConfig, (c, s) => c.call($(s).call(...createConfigParameters)), (c) => c.call(...createConfigParameters)));
|
|
5502
|
+
const statement = $.const(symbolClient).export().assign($(symbolCreateClient).$if(symbolCreateClientConfig, (c, s) => c.call($.await($(s).call(...createConfigParameters))), (c) => c.call(...createConfigParameters)));
|
|
5503
5503
|
plugin.node(statement);
|
|
5504
5504
|
};
|
|
5505
5505
|
|
|
@@ -5528,7 +5528,7 @@ const createClientConfigType = ({ plugin }) => {
|
|
|
5528
5528
|
"You may want to initialize your client this way instead of calling",
|
|
5529
5529
|
"`setConfig()`. This is useful for example if you're using Next.js",
|
|
5530
5530
|
"to ensure your client always has the correct values."
|
|
5531
|
-
]).generic("T", (g) => g.extends(symbolDefaultClientOptions).default(symbolClientOptions)).type($.type.func().param("override", (p) => p.optional().type($.type(symbolConfig).generic($.type.and(symbolDefaultClientOptions, "T")))).returns($.type(symbolConfig).generic($.type.and($.type("Required").generic(symbolDefaultClientOptions), "T"))));
|
|
5531
|
+
]).generic("T", (g) => g.extends(symbolDefaultClientOptions).default(symbolClientOptions)).type($.type.func().param("override", (p) => p.optional().type($.type(symbolConfig).generic($.type.and(symbolDefaultClientOptions, "T")))).returns($.type.or($.type(symbolConfig).generic($.type.and($.type("Required").generic(symbolDefaultClientOptions), "T")), $.type("Promise").generic($.type(symbolConfig).generic($.type.and($.type("Required").generic(symbolDefaultClientOptions), "T"))))));
|
|
5532
5532
|
plugin.node(typeCreateClientConfig);
|
|
5533
5533
|
};
|
|
5534
5534
|
|
|
@@ -6905,9 +6905,10 @@ function objectToAst$4({ plugin, schema, state }) {
|
|
|
6905
6905
|
const addPropsObj = addPropsRaw !== false && addPropsRaw ? addPropsRaw : void 0;
|
|
6906
6906
|
if (hasPatterns || !!addPropsObj && (addPropsObj.type !== "never" || !indexSchemas.length)) {
|
|
6907
6907
|
const addProps = addPropsObj;
|
|
6908
|
-
if (addProps && addProps.type !== "never") indexSchemas.
|
|
6908
|
+
if (addProps && addProps.type !== "never") if (addProps.type === "unknown") indexSchemas = [addProps, ...schema.patternProperties ? Object.values(schema.patternProperties) : []];
|
|
6909
|
+
else indexSchemas.unshift(addProps);
|
|
6909
6910
|
else if (!hasPatterns && !indexSchemas.length && addProps && addProps.type === "never") indexSchemas = [addProps];
|
|
6910
|
-
if (hasOptionalProperties) indexSchemas.push({ type: "undefined" });
|
|
6911
|
+
if (hasOptionalProperties && addProps?.type !== "unknown") indexSchemas.push({ type: "undefined" });
|
|
6911
6912
|
const type = indexSchemas.length === 1 ? irSchemaToAst$1({
|
|
6912
6913
|
plugin,
|
|
6913
6914
|
schema: indexSchemas[0],
|
|
@@ -7846,6 +7847,7 @@ const createInfiniteQueryOptions = ({ operation, plugin }) => {
|
|
|
7846
7847
|
//#endregion
|
|
7847
7848
|
//#region src/plugins/@tanstack/query-core/v5/mutationOptions.ts
|
|
7848
7849
|
const createMutationOptions = ({ operation, plugin }) => {
|
|
7850
|
+
if (hasOperationSse({ operation })) return;
|
|
7849
7851
|
const symbolMutationOptionsType = plugin.external(`${plugin.name}.MutationOptions`);
|
|
7850
7852
|
const typeData = useTypeData({
|
|
7851
7853
|
operation,
|
|
@@ -10117,7 +10119,8 @@ function patternNode$3(ctx$1) {
|
|
|
10117
10119
|
const { schema, symbols } = ctx$1;
|
|
10118
10120
|
const { v } = symbols;
|
|
10119
10121
|
if (!schema.pattern) return;
|
|
10120
|
-
|
|
10122
|
+
const flags = /\\[pP]\{/.test(schema.pattern) ? "u" : void 0;
|
|
10123
|
+
return $(v).attr(identifiers$1.actions.regex).call($.regexp(schema.pattern, flags));
|
|
10121
10124
|
}
|
|
10122
10125
|
function stringResolver$3(ctx$1) {
|
|
10123
10126
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
@@ -11342,11 +11345,11 @@ function numberToNode$2({ plugin, schema, state }) {
|
|
|
11342
11345
|
//#endregion
|
|
11343
11346
|
//#region src/plugins/zod/mini/toAst/object.ts
|
|
11344
11347
|
function additionalPropertiesNode$2(ctx$1) {
|
|
11345
|
-
const { schema, walk, walkerCtx } = ctx$1;
|
|
11348
|
+
const { applyModifiers, schema, walk, walkerCtx } = ctx$1;
|
|
11346
11349
|
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length > 0) return;
|
|
11347
11350
|
const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
|
|
11348
11351
|
if (additionalResult.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
|
|
11349
|
-
return additionalResult.expression
|
|
11352
|
+
return applyModifiers(additionalResult, {}).expression;
|
|
11350
11353
|
}
|
|
11351
11354
|
function baseNode$9(ctx$1) {
|
|
11352
11355
|
const { nodes, symbols } = ctx$1;
|
|
@@ -11451,7 +11454,8 @@ function patternNode$2(ctx$1) {
|
|
|
11451
11454
|
const { schema, symbols } = ctx$1;
|
|
11452
11455
|
const { z } = symbols;
|
|
11453
11456
|
if (!schema.pattern) return;
|
|
11454
|
-
|
|
11457
|
+
const flags = /\\[pP]\{/.test(schema.pattern) ? "u" : void 0;
|
|
11458
|
+
return $(z).attr(identifiers.regex).call($.regexp(schema.pattern, flags));
|
|
11455
11459
|
}
|
|
11456
11460
|
function stringResolver$2(ctx$1) {
|
|
11457
11461
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
@@ -12203,11 +12207,11 @@ function numberToNode$1({ plugin, schema, state }) {
|
|
|
12203
12207
|
//#endregion
|
|
12204
12208
|
//#region src/plugins/zod/v3/toAst/object.ts
|
|
12205
12209
|
function additionalPropertiesNode$1(ctx$1) {
|
|
12206
|
-
const { schema, walk, walkerCtx } = ctx$1;
|
|
12210
|
+
const { applyModifiers, schema, walk, walkerCtx } = ctx$1;
|
|
12207
12211
|
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length > 0) return;
|
|
12208
12212
|
const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
|
|
12209
12213
|
if (additionalResult.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
|
|
12210
|
-
return additionalResult.expression
|
|
12214
|
+
return applyModifiers(additionalResult, {}).expression;
|
|
12211
12215
|
}
|
|
12212
12216
|
function baseNode$5(ctx$1) {
|
|
12213
12217
|
const { nodes, symbols } = ctx$1;
|
|
@@ -12308,7 +12312,8 @@ function minLengthNode$1(ctx$1) {
|
|
|
12308
12312
|
function patternNode$1(ctx$1) {
|
|
12309
12313
|
const { chain, schema } = ctx$1;
|
|
12310
12314
|
if (!schema.pattern) return;
|
|
12311
|
-
|
|
12315
|
+
const flags = /\\[pP]\{/.test(schema.pattern) ? "u" : void 0;
|
|
12316
|
+
return chain.current.attr(identifiers.regex).call($.regexp(schema.pattern, flags));
|
|
12312
12317
|
}
|
|
12313
12318
|
function stringResolver$1(ctx$1) {
|
|
12314
12319
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
@@ -13067,11 +13072,11 @@ function numberToNode({ plugin, schema, state }) {
|
|
|
13067
13072
|
//#endregion
|
|
13068
13073
|
//#region src/plugins/zod/v4/toAst/object.ts
|
|
13069
13074
|
function additionalPropertiesNode(ctx$1) {
|
|
13070
|
-
const { schema, walk, walkerCtx } = ctx$1;
|
|
13075
|
+
const { applyModifiers, schema, walk, walkerCtx } = ctx$1;
|
|
13071
13076
|
if (!schema.additionalProperties || schema.properties && Object.keys(schema.properties).length > 0) return;
|
|
13072
13077
|
const additionalResult = walk(schema.additionalProperties, childContext(walkerCtx, "additionalProperties"));
|
|
13073
13078
|
if (additionalResult.hasLazyExpression) ctx$1.utils.ast.hasLazyExpression = true;
|
|
13074
|
-
return additionalResult.expression
|
|
13079
|
+
return applyModifiers(additionalResult, {}).expression;
|
|
13075
13080
|
}
|
|
13076
13081
|
function baseNode$1(ctx$1) {
|
|
13077
13082
|
const { nodes, symbols } = ctx$1;
|
|
@@ -13172,7 +13177,8 @@ function minLengthNode(ctx$1) {
|
|
|
13172
13177
|
function patternNode(ctx$1) {
|
|
13173
13178
|
const { chain, schema } = ctx$1;
|
|
13174
13179
|
if (!schema.pattern) return;
|
|
13175
|
-
|
|
13180
|
+
const flags = /\\[pP]\{/.test(schema.pattern) ? "u" : void 0;
|
|
13181
|
+
return chain.current.attr(identifiers.regex).call($.regexp(schema.pattern, flags));
|
|
13176
13182
|
}
|
|
13177
13183
|
function stringResolver(ctx$1) {
|
|
13178
13184
|
const constNode$8 = ctx$1.nodes.const(ctx$1);
|
|
@@ -14118,4 +14124,4 @@ async function resolveJobs({ logger, userConfigs }) {
|
|
|
14118
14124
|
|
|
14119
14125
|
//#endregion
|
|
14120
14126
|
export { postProcessors as _, clientDefaultConfig as a, TypeScriptRenderer as c, reserved as d, keywords as f, getTypedConfig as g, getClientPlugin as h, generateClientBundle as i, TsDslContext as l, TsDsl as m, defaultPlugins as n, clientDefaultMeta as o, regexp as p, clientPluginHandler as r, $ as s, resolveJobs as t, ctx as u };
|
|
14121
|
-
//# sourceMappingURL=init-
|
|
14127
|
+
//# sourceMappingURL=init-CuDouDN2.mjs.map
|