@kubb/plugin-react-query 5.8.0-canary.20261025T221214 → 5.8.0-canary.20261025T222431

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
@@ -102,6 +102,24 @@ function getContentTypeInfo(node) {
102
102
  function getResponseContentTypeInfo(node) {
103
103
  return buildContentTypeInfo(getPrimarySuccessResponse(node)?.content?.map((e) => e.contentType) ?? []);
104
104
  }
105
+ /**
106
+ * Reads the single base content type of an operation's primary success response, lowercased and
107
+ * stripped of any `; charset=...` suffix. Returns `undefined` when the response declares zero or
108
+ * more than one content type, since neither case has a single type to act on.
109
+ */
110
+ function getPrimarySuccessContentType(node) {
111
+ const contentTypes = getPrimarySuccessResponse(node)?.content?.map((entry) => entry.contentType) ?? [];
112
+ if (contentTypes.length !== 1) return void 0;
113
+ return contentTypes[0].split(";")[0].trim().toLowerCase();
114
+ }
115
+ /**
116
+ * Whether an operation streams its primary success response as Server-Sent Events
117
+ * (`text/event-stream`). The client generator uses this to return a typed event stream instead of a
118
+ * one-shot `RequestResult`.
119
+ */
120
+ function isEventStream(node) {
121
+ return getPrimarySuccessContentType(node) === "text/event-stream";
122
+ }
105
123
  const requestConfigBaseType = `Partial<Omit<RequestConfig, 'path' | 'query' | 'body' | 'headers' | 'url'>>`;
106
124
  function buildRequestConfigType(node) {
107
125
  const request = getContentTypeInfo(node);
@@ -520,7 +538,7 @@ var compatibility = {
520
538
  };
521
539
  //#endregion
522
540
  //#region package.json
523
- var version = "5.8.0-canary.20261025T221214";
541
+ var version = "5.8.0-canary.20261025T222431";
524
542
  //#endregion
525
543
  //#region ../../internals/client/src/resolveOperationTypes.ts
526
544
  /**
@@ -1056,9 +1074,14 @@ function resolveMutationConfig(mutation, options) {
1056
1074
  /**
1057
1075
  * Classifies an operation as a query or a mutation from the resolved `query` / `mutation` method lists.
1058
1076
  * Disabled query and mutation configs do not claim operations, and a method already claimed by an
1059
- * enabled query config never counts as a mutation.
1077
+ * enabled query config never counts as a mutation. Event streams are consumed through the client
1078
+ * directly, so they do not generate query or mutation hooks.
1060
1079
  */
1061
1080
  function classifyOperation(node, { query, mutation }) {
1081
+ if (isEventStream(node)) return {
1082
+ isQuery: false,
1083
+ isMutation: false
1084
+ };
1062
1085
  const isQuery = !!query && query.methods.some((method) => node.method.toLowerCase() === method.toLowerCase());
1063
1086
  const queryMethods = new Set(query ? query.methods : []);
1064
1087
  return {