@kubb/plugin-react-query 3.0.0-alpha.5 → 3.0.0-alpha.6
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/{chunk-JFX7DCS7.cjs → chunk-GTVJ55F2.cjs} +116 -150
- package/dist/chunk-GTVJ55F2.cjs.map +1 -0
- package/dist/{chunk-5IL6M74X.js → chunk-IVMTW4XS.js} +168 -202
- package/dist/chunk-IVMTW4XS.js.map +1 -0
- package/dist/components.cjs +2 -4
- package/dist/components.cjs.map +1 -1
- package/dist/components.d.cts +1 -2
- package/dist/components.d.ts +1 -2
- package/dist/components.js +1 -3
- package/dist/{index-C9fwRDH7.d.cts → index-5kpkk-7M.d.cts} +7 -41
- package/dist/{index-C9fwRDH7.d.ts → index-5kpkk-7M.d.ts} +7 -41
- package/dist/index.cjs +19 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +7 -47
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
- package/src/OperationGenerator.tsx +0 -29
- package/src/__snapshots__/mutateAsQuery/updatePetWithForm.ts +11 -6
- package/src/__snapshots__/pathParamsTypeInline/getPetById.ts +11 -6
- package/src/__snapshots__/pathParamsTypeObject/getPetById.ts +11 -6
- package/src/__snapshots__/queryOptions/getPetById.ts +9 -5
- package/src/__snapshots__/queryWithoutQueryOptions/getPetById.ts +9 -5
- package/src/__snapshots__/upload/UploadFile.ts +11 -6
- package/src/__snapshots__/uploadMutation/UploadFile.ts +9 -5
- package/src/__snapshots__/variablesTypeMutate/deletePet.ts +7 -4
- package/src/components/Mutation.tsx +30 -30
- package/src/components/Query.tsx +74 -78
- package/src/components/QueryKey.tsx +11 -8
- package/src/components/QueryOptions.tsx +21 -13
- package/src/components/SchemaType.tsx +9 -5
- package/src/components/__snapshots__/gen/showPetById.ts +58 -48
- package/src/components/__snapshots__/gen/useCreatePets.ts +36 -36
- package/src/components/__snapshots__/gen/useCreatePetsMutate.ts +36 -37
- package/src/components/index.ts +0 -1
- package/src/plugin.ts +8 -29
- package/src/types.ts +0 -3
- package/dist/chunk-5IL6M74X.js.map +0 -1
- package/dist/chunk-JFX7DCS7.cjs.map +0 -1
- package/src/components/Operations.tsx +0 -74
|
@@ -33,8 +33,8 @@ function SchemaType() {
|
|
|
33
33
|
const clientType = `${factoryName}Client`;
|
|
34
34
|
const isFormData = operation.getContentType() === "multipart/form-data";
|
|
35
35
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
36
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Type, { name: clientType, children: `typeof client<${TResponse}, ${TError}, ${isFormData ? "FormData" : TRequest}>` }),
|
|
37
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Type, { name: factoryName, children: `
|
|
36
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name: clientType, isTypeOnly: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Type, { name: clientType, children: `typeof client<${TResponse}, ${TError}, ${isFormData ? "FormData" : TRequest}>` }) }),
|
|
37
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name: factoryName, isTypeOnly: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Type, { name: factoryName, children: `
|
|
38
38
|
{
|
|
39
39
|
data: ${TData}
|
|
40
40
|
error: ${TError}
|
|
@@ -48,7 +48,7 @@ function SchemaType() {
|
|
|
48
48
|
return: Awaited<ReturnType<${clientType}>>
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
` })
|
|
51
|
+
` }) })
|
|
52
52
|
] });
|
|
53
53
|
}
|
|
54
54
|
|
|
@@ -83,7 +83,7 @@ ${_transformers2.default.createIndent(4)}`)}`;
|
|
|
83
83
|
})
|
|
84
84
|
}
|
|
85
85
|
` : void 0;
|
|
86
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { export: true, name, params, JSDoc, children: `
|
|
86
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { export: true, name, params, JSDoc, children: `
|
|
87
87
|
const { mutation: mutationOptions, client: clientOptions = {} } = options ?? {}
|
|
88
88
|
|
|
89
89
|
return ${hook.name}({
|
|
@@ -97,7 +97,7 @@ ${_transformers2.default.createIndent(4)}`)}`;
|
|
|
97
97
|
return ${dataReturnType === "data" ? "res.data" : "res"}
|
|
98
98
|
},
|
|
99
99
|
...mutationOptions
|
|
100
|
-
})` });
|
|
100
|
+
})` }) });
|
|
101
101
|
}
|
|
102
102
|
function RootTemplate({ children }) {
|
|
103
103
|
const {
|
|
@@ -113,7 +113,7 @@ function RootTemplate({ children }) {
|
|
|
113
113
|
const schemas = getSchemas(operation, { pluginKey: [_plugints.pluginTsName], type: "type" });
|
|
114
114
|
const file = getFile(operation);
|
|
115
115
|
const fileType = getFile(operation, { pluginKey: [_plugints.pluginTsName] });
|
|
116
|
-
return /* @__PURE__ */ _jsxruntime.
|
|
116
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
|
|
117
117
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Import, { name: "client", path: importPath }),
|
|
118
118
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Import, { name: ["ResponseConfig"], path: importPath, isTypeOnly: true }),
|
|
119
119
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -141,11 +141,11 @@ function RootTemplate({ children }) {
|
|
|
141
141
|
}
|
|
142
142
|
),
|
|
143
143
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Import, { name: ["useMutation"], path: typeof mutate !== "boolean" && mutate.importPath ? mutate.importPath : "@tanstack/react-query" }),
|
|
144
|
-
|
|
145
|
-
] })
|
|
144
|
+
children
|
|
145
|
+
] });
|
|
146
146
|
}
|
|
147
147
|
var defaultTemplates = { default: Template, root: RootTemplate };
|
|
148
|
-
function Mutation({ Template:
|
|
148
|
+
function Mutation({ Template: Template6 = defaultTemplates.default }) {
|
|
149
149
|
const {
|
|
150
150
|
plugin: {
|
|
151
151
|
options: { dataReturnType, mutate }
|
|
@@ -266,7 +266,7 @@ function Mutation({ Template: Template7 = defaultTemplates.default }) {
|
|
|
266
266
|
return null;
|
|
267
267
|
}
|
|
268
268
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
269
|
-
|
|
269
|
+
Template6,
|
|
270
270
|
{
|
|
271
271
|
name,
|
|
272
272
|
JSDoc: { comments: _utils3.getComments.call(void 0, operation) },
|
|
@@ -280,46 +280,15 @@ function Mutation({ Template: Template7 = defaultTemplates.default }) {
|
|
|
280
280
|
}
|
|
281
281
|
Mutation.File = function({ ...props }) {
|
|
282
282
|
const templates = { ...defaultTemplates, ...props.templates };
|
|
283
|
-
const
|
|
284
|
-
const
|
|
285
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
283
|
+
const Template6 = templates.default;
|
|
284
|
+
const RootTemplate2 = templates.root;
|
|
285
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, RootTemplate2, { children: [
|
|
286
286
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SchemaType, {}),
|
|
287
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Mutation, { Template:
|
|
287
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Mutation, { Template: Template6 })
|
|
288
288
|
] });
|
|
289
289
|
};
|
|
290
290
|
Mutation.templates = defaultTemplates;
|
|
291
291
|
|
|
292
|
-
// src/components/Operations.tsx
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
function Template2({}) {
|
|
296
|
-
return null;
|
|
297
|
-
}
|
|
298
|
-
function RootTemplate2({ children }) {
|
|
299
|
-
const {
|
|
300
|
-
pluginManager,
|
|
301
|
-
plugin: { key: pluginKey }
|
|
302
|
-
} = _react.useApp.call(void 0, );
|
|
303
|
-
const file = pluginManager.getFile({
|
|
304
|
-
name: "operations",
|
|
305
|
-
mode: "split",
|
|
306
|
-
extName: ".ts",
|
|
307
|
-
pluginKey
|
|
308
|
-
});
|
|
309
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Parser, { language: "typescript", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File, { baseName: file.baseName, path: file.path, meta: file.meta, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { children }) }) });
|
|
310
|
-
}
|
|
311
|
-
var defaultTemplates2 = { default: Template2, root: RootTemplate2 };
|
|
312
|
-
function Operations({ Template: Template7 = defaultTemplates2.default }) {
|
|
313
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template7, {});
|
|
314
|
-
}
|
|
315
|
-
Operations.File = function(props) {
|
|
316
|
-
const templates = { ...defaultTemplates2, ...props.templates };
|
|
317
|
-
const Template7 = templates.default;
|
|
318
|
-
const RootTemplate3 = templates.root;
|
|
319
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, RootTemplate3, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Operations, { Template: Template7 }) });
|
|
320
|
-
};
|
|
321
|
-
Operations.templates = defaultTemplates2;
|
|
322
|
-
|
|
323
292
|
// src/components/Query.tsx
|
|
324
293
|
var _core = require('@kubb/core');
|
|
325
294
|
|
|
@@ -429,7 +398,7 @@ function getImportNames() {
|
|
|
429
398
|
|
|
430
399
|
|
|
431
400
|
|
|
432
|
-
function
|
|
401
|
+
function Template2({ path, hookPath = path, isInfinite, hookName, queryOptions, optionsType, resultType }) {
|
|
433
402
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
434
403
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Import, { name: [optionsType, resultType], path, isTypeOnly: true }),
|
|
435
404
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Import, { name: [hookName], path: hookPath }),
|
|
@@ -437,14 +406,14 @@ function Template3({ path, hookPath = path, isInfinite, hookName, queryOptions,
|
|
|
437
406
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Import, { name: ["QueryKey", "WithRequired", isInfinite ? "InfiniteData" : void 0].filter(Boolean), path, isTypeOnly: true })
|
|
438
407
|
] });
|
|
439
408
|
}
|
|
440
|
-
var
|
|
409
|
+
var defaultTemplates2 = {
|
|
441
410
|
get react() {
|
|
442
411
|
return function({ context, hookPath, ...rest }) {
|
|
443
412
|
const importNames = getImportNames();
|
|
444
413
|
const isV5 = new (0, _core.PackageManager)().isValidSync(reactQueryDepRegex, ">=5");
|
|
445
414
|
const { isInfinite, isSuspense } = context;
|
|
446
415
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
447
|
-
|
|
416
|
+
Template2,
|
|
448
417
|
{
|
|
449
418
|
isInfinite,
|
|
450
419
|
...isSuspense ? importNames.querySuspense.react : isInfinite ? importNames.queryInfinite.react : importNames.query.react,
|
|
@@ -461,7 +430,7 @@ var defaultTemplates3 = {
|
|
|
461
430
|
const isV5 = new (0, _core.PackageManager)().isValidSync(reactQueryDepRegex, ">=5");
|
|
462
431
|
const { isInfinite } = context;
|
|
463
432
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
464
|
-
|
|
433
|
+
Template2,
|
|
465
434
|
{
|
|
466
435
|
isInfinite,
|
|
467
436
|
...isInfinite ? importNames.queryInfinite.solid : importNames.query.solid,
|
|
@@ -478,7 +447,7 @@ var defaultTemplates3 = {
|
|
|
478
447
|
const isV5 = new (0, _core.PackageManager)().isValidSync(reactQueryDepRegex, ">=5");
|
|
479
448
|
const { isInfinite } = context;
|
|
480
449
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
481
|
-
|
|
450
|
+
Template2,
|
|
482
451
|
{
|
|
483
452
|
isInfinite,
|
|
484
453
|
...isInfinite ? importNames.queryInfinite.svelte : importNames.query.svelte,
|
|
@@ -498,7 +467,7 @@ var defaultTemplates3 = {
|
|
|
498
467
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
499
468
|
isV5 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
500
469
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
501
|
-
|
|
470
|
+
Template2,
|
|
502
471
|
{
|
|
503
472
|
isInfinite,
|
|
504
473
|
...isInfinite ? importNames.queryInfinite.vue : importNames.query.vue,
|
|
@@ -526,9 +495,9 @@ var defaultTemplates3 = {
|
|
|
526
495
|
};
|
|
527
496
|
}
|
|
528
497
|
};
|
|
529
|
-
function QueryImports({ hookPath, isInfinite, isSuspense, Template:
|
|
498
|
+
function QueryImports({ hookPath, isInfinite, isSuspense, Template: Template6 = defaultTemplates2.react }) {
|
|
530
499
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
531
|
-
|
|
500
|
+
Template6,
|
|
532
501
|
{
|
|
533
502
|
hookPath,
|
|
534
503
|
context: {
|
|
@@ -538,7 +507,7 @@ function QueryImports({ hookPath, isInfinite, isSuspense, Template: Template7 =
|
|
|
538
507
|
}
|
|
539
508
|
);
|
|
540
509
|
}
|
|
541
|
-
QueryImports.templates =
|
|
510
|
+
QueryImports.templates = defaultTemplates2;
|
|
542
511
|
|
|
543
512
|
// src/components/QueryKey.tsx
|
|
544
513
|
|
|
@@ -548,26 +517,26 @@ QueryImports.templates = defaultTemplates3;
|
|
|
548
517
|
|
|
549
518
|
|
|
550
519
|
|
|
551
|
-
function
|
|
520
|
+
function Template3({ name, typeName, params, generics, returnType, JSDoc, keys }) {
|
|
552
521
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
553
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function.Arrow, { name, export: true, generics, params, returnType, singleLine: true, JSDoc, children: `[${keys}] as const` }),
|
|
554
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Type, { name: typeName, export: true, children: `ReturnType<typeof ${name}>` })
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function.Arrow, { name, export: true, generics, params, returnType, singleLine: true, JSDoc, children: `[${keys}] as const` }) }),
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, isTypeOnly: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Type, { name: typeName, export: true, children: `ReturnType<typeof ${name}>` }) })
|
|
555
524
|
] });
|
|
556
525
|
}
|
|
557
|
-
var
|
|
526
|
+
var defaultTemplates3 = {
|
|
558
527
|
get react() {
|
|
559
528
|
return function(props) {
|
|
560
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
529
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template3, { ...props });
|
|
561
530
|
};
|
|
562
531
|
},
|
|
563
532
|
get solid() {
|
|
564
533
|
return function(props) {
|
|
565
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
534
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template3, { ...props });
|
|
566
535
|
};
|
|
567
536
|
},
|
|
568
537
|
get svelte() {
|
|
569
538
|
return function(props) {
|
|
570
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
539
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template3, { ...props });
|
|
571
540
|
};
|
|
572
541
|
},
|
|
573
542
|
get vue() {
|
|
@@ -623,11 +592,11 @@ var defaultTemplates4 = {
|
|
|
623
592
|
withQueryParams ? "...(params ? [params] : [])" : void 0,
|
|
624
593
|
withRequest ? "...(request ? [request] : [])" : void 0
|
|
625
594
|
].filter(Boolean);
|
|
626
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
595
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template3, { ...rest, params: params.toString(), keys: keys.join(", ") });
|
|
627
596
|
};
|
|
628
597
|
}
|
|
629
598
|
};
|
|
630
|
-
function QueryKey({ name, typeName, factory, keysFn, Template:
|
|
599
|
+
function QueryKey({ name, typeName, factory, keysFn, Template: Template6 = defaultTemplates3.react }) {
|
|
631
600
|
const {
|
|
632
601
|
plugin: {
|
|
633
602
|
options: { pathParamsType }
|
|
@@ -663,9 +632,9 @@ function QueryKey({ name, typeName, factory, keysFn, Template: Template7 = defau
|
|
|
663
632
|
withQueryParams ? "...(params ? [params] : [])" : void 0,
|
|
664
633
|
withRequest ? "...(data ? [data] : [])" : void 0
|
|
665
634
|
].filter(Boolean);
|
|
666
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
635
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template6, { typeName, name, params: params.toString(), keys: keysFn(keys).join(", "), context: { factory } });
|
|
667
636
|
}
|
|
668
|
-
QueryKey.templates =
|
|
637
|
+
QueryKey.templates = defaultTemplates3;
|
|
669
638
|
|
|
670
639
|
// src/components/QueryOptions.tsx
|
|
671
640
|
|
|
@@ -678,7 +647,7 @@ QueryKey.templates = defaultTemplates4;
|
|
|
678
647
|
|
|
679
648
|
|
|
680
649
|
|
|
681
|
-
function
|
|
650
|
+
function Template4({ name, params, generics, returnType, JSDoc, hook, client, infinite, dataReturnType, parser }) {
|
|
682
651
|
const isV5 = new (0, _core.PackageManager)().isValidSync(reactQueryDepRegex, ">=5");
|
|
683
652
|
const isFormData = client.contentType === "multipart/form-data";
|
|
684
653
|
const headers = [
|
|
@@ -728,7 +697,7 @@ ${_transformers2.default.createIndent(4)}`)}`;
|
|
|
728
697
|
` : void 0;
|
|
729
698
|
if (infinite) {
|
|
730
699
|
if (isV5) {
|
|
731
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, params, JSDoc, children: `
|
|
700
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, params, JSDoc, children: `
|
|
732
701
|
const queryKey = ${hook.queryKey}
|
|
733
702
|
|
|
734
703
|
return infiniteQueryOptions({
|
|
@@ -745,9 +714,9 @@ ${_transformers2.default.createIndent(4)}`)}`;
|
|
|
745
714
|
${resolvedQueryOptions}
|
|
746
715
|
})
|
|
747
716
|
|
|
748
|
-
` });
|
|
717
|
+
` }) });
|
|
749
718
|
}
|
|
750
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, generics, returnType, params, JSDoc, children: `
|
|
719
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, generics, returnType, params, JSDoc, children: `
|
|
751
720
|
const queryKey = ${hook.queryKey}
|
|
752
721
|
|
|
753
722
|
return {
|
|
@@ -764,10 +733,10 @@ ${_transformers2.default.createIndent(4)}`)}`;
|
|
|
764
733
|
${resolvedQueryOptions}
|
|
765
734
|
}
|
|
766
735
|
|
|
767
|
-
` });
|
|
736
|
+
` }) });
|
|
768
737
|
}
|
|
769
738
|
if (isV5) {
|
|
770
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, params, JSDoc, children: `
|
|
739
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, params, JSDoc, children: `
|
|
771
740
|
const queryKey = ${hook.queryKey}
|
|
772
741
|
|
|
773
742
|
return queryOptions({
|
|
@@ -784,9 +753,9 @@ ${_transformers2.default.createIndent(4)}`)}`;
|
|
|
784
753
|
${resolvedQueryOptions}
|
|
785
754
|
})
|
|
786
755
|
|
|
787
|
-
` });
|
|
756
|
+
` }) });
|
|
788
757
|
}
|
|
789
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, generics, returnType, params, JSDoc, children: `
|
|
758
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, generics, returnType, params, JSDoc, children: `
|
|
790
759
|
const queryKey = ${hook.queryKey}
|
|
791
760
|
|
|
792
761
|
return {
|
|
@@ -803,22 +772,22 @@ ${_transformers2.default.createIndent(4)}`)}`;
|
|
|
803
772
|
${resolvedQueryOptions}
|
|
804
773
|
}
|
|
805
774
|
|
|
806
|
-
` });
|
|
775
|
+
` }) });
|
|
807
776
|
}
|
|
808
|
-
var
|
|
777
|
+
var defaultTemplates4 = {
|
|
809
778
|
get react() {
|
|
810
779
|
return function(props) {
|
|
811
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
780
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template4, { ...props });
|
|
812
781
|
};
|
|
813
782
|
},
|
|
814
783
|
get solid() {
|
|
815
784
|
return function(props) {
|
|
816
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
785
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template4, { ...props });
|
|
817
786
|
};
|
|
818
787
|
},
|
|
819
788
|
get svelte() {
|
|
820
789
|
return function(props) {
|
|
821
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
790
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template4, { ...props });
|
|
822
791
|
};
|
|
823
792
|
},
|
|
824
793
|
get vue() {
|
|
@@ -908,11 +877,11 @@ var defaultTemplates5 = {
|
|
|
908
877
|
queryKey: `${queryKey}(${queryKeyParams.toString()})`,
|
|
909
878
|
children: unrefs
|
|
910
879
|
};
|
|
911
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
880
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template4, { ...rest, params: params.toString(), hook, client });
|
|
912
881
|
};
|
|
913
882
|
}
|
|
914
883
|
};
|
|
915
|
-
function QueryOptions({ factory, infinite, suspense, resultType, dataReturnType, Template:
|
|
884
|
+
function QueryOptions({ factory, infinite, suspense, resultType, dataReturnType, Template: Template6 = defaultTemplates4.react }) {
|
|
916
885
|
const {
|
|
917
886
|
pluginManager,
|
|
918
887
|
plugin: {
|
|
@@ -998,7 +967,7 @@ function QueryOptions({ factory, infinite, suspense, resultType, dataReturnType,
|
|
|
998
967
|
return null;
|
|
999
968
|
}
|
|
1000
969
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1001
|
-
|
|
970
|
+
Template6,
|
|
1002
971
|
{
|
|
1003
972
|
name: queryOptionsName,
|
|
1004
973
|
params: params.toString(),
|
|
@@ -1016,16 +985,16 @@ function QueryOptions({ factory, infinite, suspense, resultType, dataReturnType,
|
|
|
1016
985
|
}
|
|
1017
986
|
);
|
|
1018
987
|
}
|
|
1019
|
-
QueryOptions.templates =
|
|
988
|
+
QueryOptions.templates = defaultTemplates4;
|
|
1020
989
|
|
|
1021
990
|
// src/components/Query.tsx
|
|
1022
991
|
|
|
1023
992
|
|
|
1024
|
-
function
|
|
993
|
+
function Template5({ name, generics, returnType, params, JSDoc, hook, infinite }) {
|
|
1025
994
|
const isV5 = new (0, _core.PackageManager)().isValidSync(reactQueryDepRegex, ">=5");
|
|
1026
995
|
const resolvedReturnType = `${returnType} & { queryKey: TQueryKey }`;
|
|
1027
996
|
if (isV5) {
|
|
1028
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
997
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, generics, returnType: resolvedReturnType, params, JSDoc, children: `
|
|
1029
998
|
const { query: queryOptions, client: clientOptions = {} } = options ?? {}
|
|
1030
999
|
const queryKey = queryOptions?.queryKey ?? ${hook.queryKey}
|
|
1031
1000
|
|
|
@@ -1041,7 +1010,7 @@ function Template6({ name, generics, returnType, params, JSDoc, hook, infinite }
|
|
|
1041
1010
|
|
|
1042
1011
|
` }) });
|
|
1043
1012
|
}
|
|
1044
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1013
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Source, { name, isExportable: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.Function, { name, export: true, generics, returnType: resolvedReturnType, params, JSDoc, children: `
|
|
1045
1014
|
const { query: queryOptions, client: clientOptions = {} } = options ?? {}
|
|
1046
1015
|
const queryKey = queryOptions?.queryKey ?? ${hook.queryKey}
|
|
1047
1016
|
|
|
@@ -1057,20 +1026,20 @@ function Template6({ name, generics, returnType, params, JSDoc, hook, infinite }
|
|
|
1057
1026
|
|
|
1058
1027
|
` }) });
|
|
1059
1028
|
}
|
|
1060
|
-
var
|
|
1029
|
+
var defaultTemplates5 = {
|
|
1061
1030
|
get react() {
|
|
1062
1031
|
return function(props) {
|
|
1063
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1032
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template5, { ...props });
|
|
1064
1033
|
};
|
|
1065
1034
|
},
|
|
1066
1035
|
get solid() {
|
|
1067
1036
|
return function(props) {
|
|
1068
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1037
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template5, { ...props });
|
|
1069
1038
|
};
|
|
1070
1039
|
},
|
|
1071
1040
|
get svelte() {
|
|
1072
1041
|
return function(props) {
|
|
1073
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1042
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Template5, { ...props });
|
|
1074
1043
|
};
|
|
1075
1044
|
},
|
|
1076
1045
|
get vue() {
|
|
@@ -1199,7 +1168,7 @@ var defaultTemplates6 = {
|
|
|
1199
1168
|
}
|
|
1200
1169
|
]);
|
|
1201
1170
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1202
|
-
|
|
1171
|
+
Template5,
|
|
1203
1172
|
{
|
|
1204
1173
|
...rest,
|
|
1205
1174
|
params: params.toString(),
|
|
@@ -1220,7 +1189,7 @@ function Query({
|
|
|
1220
1189
|
optionsType,
|
|
1221
1190
|
hookName,
|
|
1222
1191
|
resultType,
|
|
1223
|
-
Template:
|
|
1192
|
+
Template: Template6 = defaultTemplates5.react,
|
|
1224
1193
|
QueryKeyTemplate = QueryKey.templates.react,
|
|
1225
1194
|
QueryOptionsTemplate = QueryOptions.templates.react,
|
|
1226
1195
|
...props
|
|
@@ -1366,7 +1335,7 @@ function Query({
|
|
|
1366
1335
|
}
|
|
1367
1336
|
),
|
|
1368
1337
|
props.query && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1369
|
-
|
|
1338
|
+
Template6,
|
|
1370
1339
|
{
|
|
1371
1340
|
name: [name, props.infinite ? "Infinite" : void 0, props.suspense ? "Suspense" : void 0].filter(Boolean).join(""),
|
|
1372
1341
|
generics: generics.toString(),
|
|
@@ -1408,14 +1377,14 @@ Query.File = function({ templates }) {
|
|
|
1408
1377
|
const factoryName = getName(operation, { type: "type" });
|
|
1409
1378
|
const importNames = getImportNames();
|
|
1410
1379
|
const isV5 = new (0, _core.PackageManager)().isValidSync(reactQueryDepRegex, ">=5");
|
|
1411
|
-
const
|
|
1380
|
+
const Template6 = _optionalChain([templates, 'optionalAccess', _170 => _170.query, 'access', _171 => _171["react"]]) || defaultTemplates5["react"];
|
|
1412
1381
|
const QueryOptionsTemplate = _optionalChain([templates, 'optionalAccess', _172 => _172.queryOptions, 'access', _173 => _173["react"]]) || QueryOptions.templates["react"];
|
|
1413
1382
|
const QueryKeyTemplate = _optionalChain([templates, 'optionalAccess', _174 => _174.queryKey, 'access', _175 => _175["react"]]) || QueryKey.templates["react"];
|
|
1414
1383
|
const Import = _optionalChain([templates, 'optionalAccess', _176 => _176.queryImports, 'access', _177 => _177["react"]]) || QueryImports.templates["react"];
|
|
1415
1384
|
const factory = {
|
|
1416
1385
|
name: factoryName
|
|
1417
1386
|
};
|
|
1418
|
-
return /* @__PURE__ */ _jsxruntime.
|
|
1387
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _react.File, { baseName: file.baseName, path: file.path, meta: file.meta, children: [
|
|
1419
1388
|
parser === "zod" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Import, { name: [_optionalChain([zodSchemas, 'access', _178 => _178.response, 'optionalAccess', _179 => _179.name])], root: file.path, path: fileZodSchemas.path }),
|
|
1420
1389
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Import, { name: "client", path: importPath }),
|
|
1421
1390
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _react.File.Import, { name: ["ResponseConfig"], path: importPath, isTypeOnly: true }),
|
|
@@ -1438,61 +1407,58 @@ Query.File = function({ templates }) {
|
|
|
1438
1407
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, QueryImports, { hookPath: typeof query !== "boolean" ? query.importPath : void 0, Template: Import, isInfinite: false, isSuspense: false }),
|
|
1439
1408
|
!!infinite && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QueryImports, { hookPath: typeof query !== "boolean" ? query.importPath : void 0, Template: Import, isInfinite: true, isSuspense: false }),
|
|
1440
1409
|
!!suspense && isV5 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, QueryImports, { hookPath: typeof query !== "boolean" ? query.importPath : void 0, Template: Import, isInfinite: false, isSuspense: true }),
|
|
1441
|
-
/* @__PURE__ */ _jsxruntime.
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
] })
|
|
1492
|
-
] }) });
|
|
1410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, SchemaType, {}),
|
|
1411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1412
|
+
Query,
|
|
1413
|
+
{
|
|
1414
|
+
factory,
|
|
1415
|
+
Template: Template6,
|
|
1416
|
+
QueryKeyTemplate,
|
|
1417
|
+
QueryOptionsTemplate,
|
|
1418
|
+
infinite: false,
|
|
1419
|
+
suspense: false,
|
|
1420
|
+
query,
|
|
1421
|
+
queryOptions,
|
|
1422
|
+
hookName: importNames.query["react"].hookName,
|
|
1423
|
+
resultType: importNames.query["react"].resultType,
|
|
1424
|
+
optionsType: importNames.query["react"].optionsType
|
|
1425
|
+
}
|
|
1426
|
+
),
|
|
1427
|
+
!!infinite && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1428
|
+
Query,
|
|
1429
|
+
{
|
|
1430
|
+
factory,
|
|
1431
|
+
Template: Template6,
|
|
1432
|
+
QueryKeyTemplate,
|
|
1433
|
+
QueryOptionsTemplate,
|
|
1434
|
+
infinite,
|
|
1435
|
+
suspense: false,
|
|
1436
|
+
query,
|
|
1437
|
+
queryOptions,
|
|
1438
|
+
hookName: importNames.queryInfinite["react"].hookName,
|
|
1439
|
+
resultType: importNames.queryInfinite["react"].resultType,
|
|
1440
|
+
optionsType: importNames.queryInfinite["react"].optionsType
|
|
1441
|
+
}
|
|
1442
|
+
),
|
|
1443
|
+
!!suspense && isV5 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1444
|
+
Query,
|
|
1445
|
+
{
|
|
1446
|
+
factory,
|
|
1447
|
+
Template: Template6,
|
|
1448
|
+
QueryKeyTemplate,
|
|
1449
|
+
QueryOptionsTemplate,
|
|
1450
|
+
infinite: false,
|
|
1451
|
+
suspense,
|
|
1452
|
+
query,
|
|
1453
|
+
queryOptions,
|
|
1454
|
+
hookName: importNames.querySuspense["react"].hookName,
|
|
1455
|
+
resultType: importNames.querySuspense["react"].resultType,
|
|
1456
|
+
optionsType: importNames.querySuspense["react"].optionsType
|
|
1457
|
+
}
|
|
1458
|
+
)
|
|
1459
|
+
] });
|
|
1493
1460
|
};
|
|
1494
|
-
Query.templates =
|
|
1495
|
-
|
|
1461
|
+
Query.templates = defaultTemplates5;
|
|
1496
1462
|
|
|
1497
1463
|
|
|
1498
1464
|
|
|
@@ -1500,5 +1466,5 @@ Query.templates = defaultTemplates6;
|
|
|
1500
1466
|
|
|
1501
1467
|
|
|
1502
1468
|
|
|
1503
|
-
exports.Mutation = Mutation; exports.
|
|
1504
|
-
//# sourceMappingURL=chunk-
|
|
1469
|
+
exports.Mutation = Mutation; exports.QueryImports = QueryImports; exports.QueryKey = QueryKey; exports.QueryOptions = QueryOptions; exports.Query = Query;
|
|
1470
|
+
//# sourceMappingURL=chunk-GTVJ55F2.cjs.map
|