@kubb/plugin-react-query 5.3.0-canary.20261011T163220 → 5.3.0-canary.20261012T115854

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
@@ -360,8 +360,8 @@ function createGroupConfig(group) {
360
360
  *
361
361
  * - `contract` — a registered contract client plugin owns the `<op>` functions and the consumer
362
362
  * imports and calls them.
363
- * - `error` — no client plugin is registered, several are registered without a selector, or the
364
- * requested one is missing.
363
+ * - `error` — no client plugin is registered, several are registered without a selector, the
364
+ * requested one is missing, or `client` is not a known selector.
365
365
  *
366
366
  * The `client` string selects explicitly (`'fetch'` / `'axios'`); when it is unset a lone registered
367
367
  * contract client plugin is picked up automatically.
@@ -402,6 +402,10 @@ function resolveClient(options) {
402
402
  pluginName
403
403
  };
404
404
  }
405
+ if (client !== void 0) return {
406
+ kind: "error",
407
+ message: `Option \`client\` is ${typeof client === "string" ? `'${client}'` : String(client)}, but it must be one of 'fetch', 'axios'. Drop \`client\` to use the registered client plugin.`
408
+ };
405
409
  const registered = contractPlugins.filter(has);
406
410
  if (registered.length === 1) return {
407
411
  kind: "contract",
@@ -1549,8 +1553,7 @@ const infiniteQueryGenerator = (0, kubb_kit.defineGenerator)({
1549
1553
  if (!kubb_kit.ast.isHttpOperationNode(node)) return null;
1550
1554
  const { config, driver, resolver, root } = ctx;
1551
1555
  const { output, query, infinite, client, group, customOptions } = ctx.options;
1552
- const pluginTs = driver.getPlugin(_kubb_plugin_ts.pluginTsName);
1553
- if (!pluginTs) return null;
1556
+ const pluginTs = ctx.requirePlugin(_kubb_plugin_ts.pluginTsName);
1554
1557
  const tsResolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
1555
1558
  const infiniteOptions = infinite && typeof infinite === "object" ? infinite : null;
1556
1559
  if (!infiniteOptions) return null;
@@ -1723,8 +1726,7 @@ const mutationGenerator = (0, kubb_kit.defineGenerator)({
1723
1726
  if (!kubb_kit.ast.isHttpOperationNode(node)) return null;
1724
1727
  const { config, driver, resolver, root } = ctx;
1725
1728
  const { output, mutation, client, group, customOptions, hooks } = ctx.options;
1726
- const pluginTs = driver.getPlugin(_kubb_plugin_ts.pluginTsName);
1727
- if (!pluginTs) return null;
1729
+ const pluginTs = ctx.requirePlugin(_kubb_plugin_ts.pluginTsName);
1728
1730
  const tsResolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
1729
1731
  const importPath = mutation ? mutation.importPath : "@tanstack/react-query";
1730
1732
  const contractOp = resolveClientOperation({
@@ -1872,8 +1874,7 @@ const queryGenerator = (0, kubb_kit.defineGenerator)({
1872
1874
  if (!kubb_kit.ast.isHttpOperationNode(node)) return null;
1873
1875
  const { config, driver, resolver, root } = ctx;
1874
1876
  const { output, query, client, group, customOptions, hooks } = ctx.options;
1875
- const pluginTs = driver.getPlugin(_kubb_plugin_ts.pluginTsName);
1876
- if (!pluginTs) return null;
1877
+ const pluginTs = ctx.requirePlugin(_kubb_plugin_ts.pluginTsName);
1877
1878
  const tsResolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
1878
1879
  const importPath = query ? query.importPath : "@tanstack/react-query";
1879
1880
  const contractOp = resolveClientOperation({
@@ -2030,8 +2031,7 @@ const suspenseInfiniteQueryGenerator = (0, kubb_kit.defineGenerator)({
2030
2031
  if (!kubb_kit.ast.isHttpOperationNode(node)) return null;
2031
2032
  const { config, driver, resolver, root } = ctx;
2032
2033
  const { output, query, infinite, client, group, customOptions } = ctx.options;
2033
- const pluginTs = driver.getPlugin(_kubb_plugin_ts.pluginTsName);
2034
- if (!pluginTs) return null;
2034
+ const pluginTs = ctx.requirePlugin(_kubb_plugin_ts.pluginTsName);
2035
2035
  const tsResolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
2036
2036
  const infiniteOptions = infinite && typeof infinite === "object" ? infinite : null;
2037
2037
  if (!infiniteOptions) return null;
@@ -2204,8 +2204,7 @@ const suspenseQueryGenerator = (0, kubb_kit.defineGenerator)({
2204
2204
  if (!kubb_kit.ast.isHttpOperationNode(node)) return null;
2205
2205
  const { config, driver, resolver, root } = ctx;
2206
2206
  const { output, query, client, group, customOptions } = ctx.options;
2207
- const pluginTs = driver.getPlugin(_kubb_plugin_ts.pluginTsName);
2208
- if (!pluginTs) return null;
2207
+ const pluginTs = ctx.requirePlugin(_kubb_plugin_ts.pluginTsName);
2209
2208
  const tsResolver = driver.getResolver(_kubb_plugin_ts.pluginTsName);
2210
2209
  const importPath = query ? query.importPath : "@tanstack/react-query";
2211
2210
  const contractOp = resolveClientOperation({
@@ -2430,6 +2429,7 @@ const pluginReactQuery = (0, kubb_kit.definePlugin)((options) => {
2430
2429
  options,
2431
2430
  dependencies: [_kubb_plugin_ts.pluginTsName],
2432
2431
  hooks: { "kubb:plugin:setup"(ctx) {
2432
+ ctx.requirePlugin(_kubb_plugin_ts.pluginTsName);
2433
2433
  const resolver = userResolver ? kubb_kit.Resolver.merge(resolverReactQuery, userResolver) : resolverReactQuery;
2434
2434
  ctx.setOptions({
2435
2435
  output,