@hey-api/openapi-ts 0.90.9 → 0.90.10

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/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
- const require_openApi = require('./openApi-BaGlRfMs.cjs');
3
- const require_src = require('./src-CO2t0IHm.cjs');
2
+ const require_openApi = require('./openApi-Dy5wknYZ.cjs');
3
+ const require_src = require('./src-DMQOp4DI.cjs');
4
4
  let _hey_api_codegen_core = require("@hey-api/codegen-core");
5
5
 
6
6
  exports.$ = require_openApi.$;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
- import { A as CallArgs, C as keywords, D as ExampleOptions, E as TypeTsDsl, M as OperationStrategy, N as Casing, O as TsDslContext, P as IR, S as regexp, T as TsDsl, _ as PluginHandler, a as Plugin, b as reserved, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as Client$2, h as ExpressionTransformer, i as DefinePlugin, j as OperationPath, k as ctx, l as OpenApiParameterObject, m as TypeTransformer, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as $, w as MaybeTsDsl, x as TypeScriptRenderer, y as DollarTsDsl } from "./types-WLqvV8HC.cjs";
3
- import { Logger } from "@hey-api/codegen-core";
2
+ import { A as CallArgs, C as keywords, D as ExampleOptions, E as TypeTsDsl, M as OperationStrategy, N as Casing, O as TsDslContext, P as IR, S as regexp, T as TsDsl, _ as PluginHandler, a as Plugin, b as reserved, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as Client$2, h as ExpressionTransformer, i as DefinePlugin, j as OperationPath, k as ctx, l as OpenApiParameterObject, m as TypeTransformer, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as $, w as MaybeTsDsl, x as TypeScriptRenderer, y as DollarTsDsl } from "./types-BcLsQaJ_.cjs";
3
+ import { Logger, Logger as Logger$1 } from "@hey-api/codegen-core";
4
4
  import { LazyOrAsync, MaybeArray } from "@hey-api/types";
5
5
  import { HttpClient, HttpErrorResponse, HttpHeaders, HttpRequest, HttpResponse } from "@angular/common/http";
6
6
  import { Injector } from "@angular/core";
@@ -881,7 +881,7 @@ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean
881
881
  *
882
882
  * @param userConfig User provided {@link UserConfig} configuration(s).
883
883
  */
884
- declare function createClient(userConfig?: LazyOrAsync<MaybeArray<UserConfig>>, logger?: any): Promise<ReadonlyArray<Context>>;
884
+ declare function createClient(userConfig?: LazyOrAsync<MaybeArray<UserConfig>>, logger?: Logger$1): Promise<ReadonlyArray<Context>>;
885
885
  //#endregion
886
886
  //#region src/config/parser.d.ts
887
887
  declare const defaultPaginationKeywords: readonly ["after", "before", "cursor", "offset", "page", "start"];
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
- import { A as MaybeTsDsl, B as IR, C as Client, D as TypeScriptRenderer, E as reserved, F as ctx, I as CallArgs, L as OperationPath, M as TypeTsDsl, N as ExampleOptions, O as regexp, P as TsDslContext, R as OperationStrategy, S as Client$1, T as DollarTsDsl, _ as PluginHandler, a as Plugin, b as Client$4, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as Client$2, h as ExpressionTransformer, i as DefinePlugin, j as TsDsl, k as keywords, l as OpenApiParameterObject, m as TypeTransformer, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as Client$6, w as $, x as Client$3, y as Client$5, z as Casing } from "./types-CQTciSfa.mjs";
3
- import { Logger } from "@hey-api/codegen-core";
2
+ import { A as MaybeTsDsl, B as IR, C as Client, D as TypeScriptRenderer, E as reserved, F as ctx, I as CallArgs, L as OperationPath, M as TypeTsDsl, N as ExampleOptions, O as regexp, P as TsDslContext, R as OperationStrategy, S as Client$1, T as DollarTsDsl, _ as PluginHandler, a as Plugin, b as Client$4, c as OpenApiOperationObject, d as OpenApiResponseObject, f as OpenApiSchemaObject, g as Client$2, h as ExpressionTransformer, i as DefinePlugin, j as TsDsl, k as keywords, l as OpenApiParameterObject, m as TypeTransformer, n as UserConfig, o as OpenApi, p as Context, s as OpenApiMetaObject, u as OpenApiRequestBodyObject, v as Client$6, w as $, x as Client$3, y as Client$5, z as Casing } from "./types-CLcjoomL.mjs";
3
+ import { Logger, Logger as Logger$1 } from "@hey-api/codegen-core";
4
4
  import { LazyOrAsync, MaybeArray } from "@hey-api/types";
5
5
 
6
6
  //#region src/generate.d.ts
@@ -10,7 +10,7 @@ import { LazyOrAsync, MaybeArray } from "@hey-api/types";
10
10
  *
11
11
  * @param userConfig User provided {@link UserConfig} configuration(s).
12
12
  */
13
- declare function createClient(userConfig?: LazyOrAsync<MaybeArray<UserConfig>>, logger?: any): Promise<ReadonlyArray<Context>>;
13
+ declare function createClient(userConfig?: LazyOrAsync<MaybeArray<UserConfig>>, logger?: Logger$1): Promise<ReadonlyArray<Context>>;
14
14
  //#endregion
15
15
  //#region src/config/parser.d.ts
16
16
  declare const defaultPaginationKeywords: readonly ["after", "before", "cursor", "offset", "page", "start"];
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { C as defaultPaginationKeywords, S as definePluginConfig, _ as regexp, a as defaultPlugins, b as OperationPath, c as clientDefaultConfig, d as $, f as TypeScriptRenderer, g as keywords, h as reserved, l as clientDefaultMeta, m as ctx, o as clientPluginHandler, p as TsDslContext, v as TsDsl, x as OperationStrategy } from "./openApi-CE_z8tev.mjs";
3
- import { i as createClient, n as defineConfig, r as utils, t as Logger } from "./src-DqFHTOrs.mjs";
2
+ import { C as defaultPaginationKeywords, S as definePluginConfig, _ as regexp, a as defaultPlugins, b as OperationPath, c as clientDefaultConfig, d as $, f as TypeScriptRenderer, g as keywords, h as reserved, l as clientDefaultMeta, m as ctx, o as clientPluginHandler, p as TsDslContext, v as TsDsl, x as OperationStrategy } from "./openApi-Gs-XGatv.mjs";
3
+ import { i as createClient, n as defineConfig, r as utils, t as Logger } from "./src-YIQMkx2V.mjs";
4
4
 
5
5
  export { $, Logger, OperationPath, OperationStrategy, TsDsl, TsDslContext, TypeScriptRenderer, clientDefaultConfig, clientDefaultMeta, clientPluginHandler, createClient, ctx, defaultPaginationKeywords, defaultPlugins, defineConfig, definePluginConfig, keywords, regexp, reserved, utils };
package/dist/internal.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- const require_openApi = require('./openApi-BaGlRfMs.cjs');
2
+ const require_openApi = require('./openApi-Dy5wknYZ.cjs');
3
3
 
4
4
  exports.getSpec = require_openApi.getSpec;
5
5
  exports.initConfigs = require_openApi.resolveJobs;
@@ -1,5 +1,5 @@
1
1
 
2
- import { n as UserConfig, p as Context, r as Input, t as Config } from "./types-WLqvV8HC.cjs";
2
+ import { n as UserConfig, p as Context, r as Input, t as Config } from "./types-BcLsQaJ_.cjs";
3
3
  import { Logger } from "@hey-api/codegen-core";
4
4
  import { getResolvedInput } from "@hey-api/json-schema-ref-parser";
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { n as UserConfig, p as Context, r as Input, t as Config } from "./types-CQTciSfa.mjs";
2
+ import { n as UserConfig, p as Context, r as Input, t as Config } from "./types-CLcjoomL.mjs";
3
3
  import { Logger } from "@hey-api/codegen-core";
4
4
  import { getResolvedInput } from "@hey-api/json-schema-ref-parser";
5
5
 
package/dist/internal.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
- import { i as resolveJobs, r as getSpec, t as parseOpenApiSpec } from "./openApi-CE_z8tev.mjs";
2
+ import { i as resolveJobs, r as getSpec, t as parseOpenApiSpec } from "./openApi-Gs-XGatv.mjs";
3
3
 
4
4
  export { getSpec, resolveJobs as initConfigs, parseOpenApiSpec };
@@ -5661,6 +5661,25 @@ const pathToJsonPointer = (path$10) => {
5661
5661
  const segments = path$10.map(encodeJsonPointerSegment).join("/");
5662
5662
  return "#" + (segments ? `/${segments}` : "");
5663
5663
  };
5664
+ /**
5665
+ * Checks if a $ref points to a top-level component (not a deep path reference).
5666
+ *
5667
+ * Top-level component references:
5668
+ * - OpenAPI 3.x: #/components/{type}/{name} (3 segments)
5669
+ * - OpenAPI 2.0: #/definitions/{name} (2 segments)
5670
+ *
5671
+ * Deep path references (4+ segments for 3.x, 3+ for 2.0) should be inlined
5672
+ * because they don't have corresponding registered symbols.
5673
+ *
5674
+ * @param $ref - The $ref string to check
5675
+ * @returns true if the ref points to a top-level component, false otherwise
5676
+ */
5677
+ const isTopLevelComponentRef = ($ref) => {
5678
+ const path$10 = jsonPointerToPath($ref);
5679
+ if (path$10[0] === "components") return path$10.length === 3;
5680
+ if (path$10[0] === "definitions") return path$10.length === 2;
5681
+ return false;
5682
+ };
5664
5683
  const resolveRef = ({ $ref, spec }) => {
5665
5684
  const path$10 = jsonPointerToPath(decodeURI($ref));
5666
5685
  let current = spec;
@@ -5679,7 +5698,7 @@ const resolveRef = ({ $ref, spec }) => {
5679
5698
  * - Prefixes all conflicting names with their location (e.g. path_foo, query_foo)
5680
5699
  * - Returns a flat map of resolved parameter names to their metadata
5681
5700
  */
5682
- const getSignatureParameters = ({ operation }) => {
5701
+ function getSignatureParameters({ operation }) {
5683
5702
  const locations = [
5684
5703
  "header",
5685
5704
  "path",
@@ -5766,7 +5785,10 @@ const getSignatureParameters = ({ operation }) => {
5766
5785
  name: "body",
5767
5786
  schema: operation.body.schema
5768
5787
  };
5769
- fields.push({ in: "body" });
5788
+ fields.push({
5789
+ key: "body",
5790
+ map: "body"
5791
+ });
5770
5792
  }
5771
5793
  }
5772
5794
  if (!Object.keys(signatureParameters).length) return;
@@ -5774,7 +5796,7 @@ const getSignatureParameters = ({ operation }) => {
5774
5796
  fields,
5775
5797
  parameters: signatureParameters
5776
5798
  };
5777
- };
5799
+ }
5778
5800
 
5779
5801
  //#endregion
5780
5802
  //#region src/plugins/@hey-api/sdk/shared/validator.ts
@@ -5826,7 +5848,7 @@ const operationOptionsType = ({ isDataAllowed = true, operation, plugin, throwOn
5826
5848
  if (throwOnError) return $.type(symbolOptions).generic(isDataAllowed ? symbolDataType ?? "unknown" : "never").generic(throwOnError);
5827
5849
  return $.type(symbolOptions).$if(!isDataAllowed || symbolDataType, (t) => t.generic(isDataAllowed ? symbolDataType : "never"));
5828
5850
  };
5829
- const operationParameters = ({ isRequiredOptions, operation, plugin }) => {
5851
+ function operationParameters({ isRequiredOptions, operation, plugin }) {
5830
5852
  const result = {
5831
5853
  argNames: [],
5832
5854
  fields: [],
@@ -5863,7 +5885,7 @@ const operationParameters = ({ isRequiredOptions, operation, plugin }) => {
5863
5885
  throwOnError: isNuxtClient ? void 0 : "ThrowOnError"
5864
5886
  }))));
5865
5887
  return result;
5866
- };
5888
+ }
5867
5889
  /**
5868
5890
  * Infers `responseType` value from provided response content type. This is
5869
5891
  * an adapted version of `getParseAs()` from the Fetch API client.
@@ -5886,7 +5908,7 @@ const getResponseType = (contentType) => {
5886
5908
  ].some((type) => cleanContent.startsWith(type))) return "blob";
5887
5909
  if (cleanContent.startsWith("text/")) return "text";
5888
5910
  };
5889
- const operationStatements = ({ isRequiredOptions, opParameters, operation, plugin }) => {
5911
+ function operationStatements({ isRequiredOptions, opParameters, operation, plugin }) {
5890
5912
  const client = getClientPlugin(plugin.context.config);
5891
5913
  const isNuxtClient = client.name === "@hey-api/client-nuxt";
5892
5914
  const symbolResponseType = plugin.querySymbol({
@@ -6017,7 +6039,7 @@ const operationStatements = ({ isRequiredOptions, opParameters, operation, plugi
6017
6039
  functionName = functionName.attr(operation.method);
6018
6040
  statements.push($.return(functionName.call(reqOptions).$if(isNuxtClient, (f$1) => f$1.generic(nuxtTypeComposable).generic($.type.or(symbolResponseType ?? "unknown", nuxtTypeDefault)).generic(symbolErrorType ?? "unknown").generic(nuxtTypeDefault), (f$1) => f$1.generic(symbolResponseType ?? "unknown").generic(symbolErrorType ?? "unknown").generic("ThrowOnError")).$if(plugin.config.responseStyle === "data", (f$1) => f$1.generic($.type.literal(plugin.config.responseStyle)))));
6019
6041
  return statements;
6020
- };
6042
+ }
6021
6043
 
6022
6044
  //#endregion
6023
6045
  //#region src/plugins/@hey-api/sdk/v1/node.ts
@@ -9174,7 +9196,13 @@ const createMutationOptions = ({ operation, plugin }) => {
9174
9196
  if (plugin.getPluginOrThrow("@hey-api/sdk").config.responseStyle === "data") statements.push($.return(awaitSdkFn));
9175
9197
  else statements.push($.const().object("data").assign(awaitSdkFn), $.return("data"));
9176
9198
  const mutationOptionsFn = "mutationOptions";
9177
- const symbolMutationOptions = plugin.symbol(applyNaming(operation.id, plugin.config.mutationOptions));
9199
+ const symbolMutationOptions = plugin.symbol(applyNaming(operation.id, plugin.config.mutationOptions), { meta: {
9200
+ category: "hook",
9201
+ resource: "operation",
9202
+ resourceId: operation.id,
9203
+ role: "mutationOptions",
9204
+ tool: plugin.name
9205
+ } });
9178
9206
  const statement = $.const(symbolMutationOptions).export().$if(plugin.config.comments && createOperationComment(operation), (c, v) => c.doc(v)).assign($.func().param("options", (p) => p.optional().type($.type("Partial").generic(typeData))).returns(mutationType).do($.const(mutationOptionsFn).type(mutationType).assign($.object().pretty().prop("mutationFn", $.func().async().param(fnOptions$1).do(...statements)).$if(handleMeta(plugin, operation, "mutationOptions"), (c, v) => c.prop("meta", v))), $(mutationOptionsFn).return()));
9179
9207
  plugin.node(statement);
9180
9208
  };
@@ -18150,7 +18178,7 @@ const parseEnum$2 = ({ context, schema, state }) => {
18150
18178
  };
18151
18179
  const parseRef$2 = ({ context, schema, state }) => {
18152
18180
  const irSchema = {};
18153
- if (!schema.$ref.startsWith("#/definitions/")) {
18181
+ if (!isTopLevelComponentRef(schema.$ref)) {
18154
18182
  if (!state.circularReferenceTracker.has(schema.$ref)) {
18155
18183
  const refSchema = context.resolveRef(schema.$ref);
18156
18184
  const originalRef = state.$ref;
@@ -19450,7 +19478,7 @@ const parseOneOf$1 = ({ context, schema, state }) => {
19450
19478
  return irSchema;
19451
19479
  };
19452
19480
  const parseRef$1 = ({ context, schema, state }) => {
19453
- if (!schema.$ref.startsWith("#/components/")) {
19481
+ if (!isTopLevelComponentRef(schema.$ref)) {
19454
19482
  if (!state.circularReferenceTracker.has(schema.$ref)) {
19455
19483
  const refSchema = context.resolveRef(schema.$ref);
19456
19484
  const originalRef = state.$ref;
@@ -20798,7 +20826,7 @@ const parseOneOf = ({ context, schema, state }) => {
20798
20826
  return irSchema;
20799
20827
  };
20800
20828
  const parseRef = ({ context, schema, state }) => {
20801
- if (!schema.$ref.startsWith("#/components/")) {
20829
+ if (!isTopLevelComponentRef(schema.$ref)) {
20802
20830
  if (!state.circularReferenceTracker.has(schema.$ref)) {
20803
20831
  const refSchema = context.resolveRef(schema.$ref);
20804
20832
  const originalRef = state.$ref;
@@ -22001,4 +22029,4 @@ Object.defineProperty(exports, 'toCase', {
22001
22029
  return toCase;
22002
22030
  }
22003
22031
  });
22004
- //# sourceMappingURL=openApi-BaGlRfMs.cjs.map
22032
+ //# sourceMappingURL=openApi-Dy5wknYZ.cjs.map