@graphql-codegen/typescript-solid-query 1.0.1 → 1.0.2-alpha-20260304095758-ba55fb7bf1f82cf1202d5f4e96c70180e3ddfe36
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/cjs/fetcher.js +8 -8
- package/esm/fetcher.js +8 -8
- package/package.json +1 -1
- package/typings/fetcher.d.cts +2 -2
- package/typings/fetcher.d.ts +2 -2
package/cjs/fetcher.js
CHANGED
|
@@ -47,7 +47,7 @@ class FetcherRenderer {
|
|
|
47
47
|
>(${argumentsResult}) => {
|
|
48
48
|
${implHookOuter}
|
|
49
49
|
return ${infiniteQuery.getHook()}<${operationResultType}, TError, TData>(
|
|
50
|
-
${this.generateInfiniteQueryFormattedParameters(this.generateInfiniteQueryKey(config
|
|
50
|
+
${this.generateInfiniteQueryFormattedParameters(this.generateInfiniteQueryKey(config), implFetcher)}
|
|
51
51
|
)};`;
|
|
52
52
|
};
|
|
53
53
|
return { generateBaseInfiniteQueryHook, variables, options };
|
|
@@ -71,7 +71,7 @@ class FetcherRenderer {
|
|
|
71
71
|
>(${argumentsResult}) => {
|
|
72
72
|
${implHookOuter}
|
|
73
73
|
return ${query.getHook()}<${operationResultType}, TError, TData>(
|
|
74
|
-
${this.generateQueryFormattedParameters(this.generateQueryKey(config
|
|
74
|
+
${this.generateQueryFormattedParameters(this.generateQueryKey(config), implFetcher)}
|
|
75
75
|
)};`;
|
|
76
76
|
};
|
|
77
77
|
return {
|
|
@@ -119,8 +119,8 @@ class FetcherRenderer {
|
|
|
119
119
|
const { infiniteQuery } = this.createQueryMethodMap(isSuspense);
|
|
120
120
|
return `options: Omit<${infiniteQuery.getOptions()}<${operationResultType}, TError, TData>, 'queryKey'> & { queryKey?: ${infiniteQuery.getOptions()}<${operationResultType}, TError, TData>['queryKey'] }`;
|
|
121
121
|
}
|
|
122
|
-
generateInfiniteQueryKey(config
|
|
123
|
-
const identifier =
|
|
122
|
+
generateInfiniteQueryKey(config) {
|
|
123
|
+
const identifier = 'infinite';
|
|
124
124
|
if (config.hasRequiredVariables)
|
|
125
125
|
return `['${config.node.name.value}.${identifier}', variables]`;
|
|
126
126
|
return `variables === undefined ? ['${config.node.name.value}.${identifier}'] : ['${config.node.name.value}.${identifier}', variables]`;
|
|
@@ -131,12 +131,12 @@ class FetcherRenderer {
|
|
|
131
131
|
const { operationName, node } = config;
|
|
132
132
|
return {
|
|
133
133
|
hook: this.generateInfiniteQueryHook(config, isSuspense),
|
|
134
|
-
getKey: `${infiniteQuery.getHook(operationName)}.getKey = (${signature}) => ${this.generateInfiniteQueryKey(config
|
|
134
|
+
getKey: `${infiniteQuery.getHook(operationName)}.getKey = (${signature}) => ${this.generateInfiniteQueryKey(config)};`,
|
|
135
135
|
rootKey: `${infiniteQuery.getHook(operationName)}.rootKey = '${node.name.value}.infinite';`,
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
generateQueryKey(config
|
|
139
|
-
const identifier =
|
|
138
|
+
generateQueryKey(config) {
|
|
139
|
+
const identifier = config.node.name.value;
|
|
140
140
|
if (config.hasRequiredVariables)
|
|
141
141
|
return `['${identifier}', variables]`;
|
|
142
142
|
return `variables === undefined ? ['${identifier}'] : ['${identifier}', variables]`;
|
|
@@ -148,7 +148,7 @@ class FetcherRenderer {
|
|
|
148
148
|
return {
|
|
149
149
|
hook: this.generateQueryHook(config, isSuspense),
|
|
150
150
|
document: `${query.getHook(operationName)}.document = ${documentVariableName};`,
|
|
151
|
-
getKey: `${query.getHook(operationName)}.getKey = (${signature}) => ${this.generateQueryKey(config
|
|
151
|
+
getKey: `${query.getHook(operationName)}.getKey = (${signature}) => ${this.generateQueryKey(config)};`,
|
|
152
152
|
rootKey: `${query.getHook(operationName)}.rootKey = '${node.name.value}';`,
|
|
153
153
|
};
|
|
154
154
|
}
|
package/esm/fetcher.js
CHANGED
|
@@ -43,7 +43,7 @@ export class FetcherRenderer {
|
|
|
43
43
|
>(${argumentsResult}) => {
|
|
44
44
|
${implHookOuter}
|
|
45
45
|
return ${infiniteQuery.getHook()}<${operationResultType}, TError, TData>(
|
|
46
|
-
${this.generateInfiniteQueryFormattedParameters(this.generateInfiniteQueryKey(config
|
|
46
|
+
${this.generateInfiniteQueryFormattedParameters(this.generateInfiniteQueryKey(config), implFetcher)}
|
|
47
47
|
)};`;
|
|
48
48
|
};
|
|
49
49
|
return { generateBaseInfiniteQueryHook, variables, options };
|
|
@@ -67,7 +67,7 @@ export class FetcherRenderer {
|
|
|
67
67
|
>(${argumentsResult}) => {
|
|
68
68
|
${implHookOuter}
|
|
69
69
|
return ${query.getHook()}<${operationResultType}, TError, TData>(
|
|
70
|
-
${this.generateQueryFormattedParameters(this.generateQueryKey(config
|
|
70
|
+
${this.generateQueryFormattedParameters(this.generateQueryKey(config), implFetcher)}
|
|
71
71
|
)};`;
|
|
72
72
|
};
|
|
73
73
|
return {
|
|
@@ -115,8 +115,8 @@ export class FetcherRenderer {
|
|
|
115
115
|
const { infiniteQuery } = this.createQueryMethodMap(isSuspense);
|
|
116
116
|
return `options: Omit<${infiniteQuery.getOptions()}<${operationResultType}, TError, TData>, 'queryKey'> & { queryKey?: ${infiniteQuery.getOptions()}<${operationResultType}, TError, TData>['queryKey'] }`;
|
|
117
117
|
}
|
|
118
|
-
generateInfiniteQueryKey(config
|
|
119
|
-
const identifier =
|
|
118
|
+
generateInfiniteQueryKey(config) {
|
|
119
|
+
const identifier = 'infinite';
|
|
120
120
|
if (config.hasRequiredVariables)
|
|
121
121
|
return `['${config.node.name.value}.${identifier}', variables]`;
|
|
122
122
|
return `variables === undefined ? ['${config.node.name.value}.${identifier}'] : ['${config.node.name.value}.${identifier}', variables]`;
|
|
@@ -127,12 +127,12 @@ export class FetcherRenderer {
|
|
|
127
127
|
const { operationName, node } = config;
|
|
128
128
|
return {
|
|
129
129
|
hook: this.generateInfiniteQueryHook(config, isSuspense),
|
|
130
|
-
getKey: `${infiniteQuery.getHook(operationName)}.getKey = (${signature}) => ${this.generateInfiniteQueryKey(config
|
|
130
|
+
getKey: `${infiniteQuery.getHook(operationName)}.getKey = (${signature}) => ${this.generateInfiniteQueryKey(config)};`,
|
|
131
131
|
rootKey: `${infiniteQuery.getHook(operationName)}.rootKey = '${node.name.value}.infinite';`,
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
generateQueryKey(config
|
|
135
|
-
const identifier =
|
|
134
|
+
generateQueryKey(config) {
|
|
135
|
+
const identifier = config.node.name.value;
|
|
136
136
|
if (config.hasRequiredVariables)
|
|
137
137
|
return `['${identifier}', variables]`;
|
|
138
138
|
return `variables === undefined ? ['${identifier}'] : ['${identifier}', variables]`;
|
|
@@ -144,7 +144,7 @@ export class FetcherRenderer {
|
|
|
144
144
|
return {
|
|
145
145
|
hook: this.generateQueryHook(config, isSuspense),
|
|
146
146
|
document: `${query.getHook(operationName)}.document = ${documentVariableName};`,
|
|
147
|
-
getKey: `${query.getHook(operationName)}.getKey = (${signature}) => ${this.generateQueryKey(config
|
|
147
|
+
getKey: `${query.getHook(operationName)}.getKey = (${signature}) => ${this.generateQueryKey(config)};`,
|
|
148
148
|
rootKey: `${query.getHook(operationName)}.rootKey = '${node.name.value}';`,
|
|
149
149
|
};
|
|
150
150
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-solid-query",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-alpha-20260304095758-ba55fb7bf1f82cf1202d5f4e96c70180e3ddfe36",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating a ready-to-use Solid-Query Hooks based on GraphQL operations",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
package/typings/fetcher.d.cts
CHANGED
|
@@ -50,13 +50,13 @@ export declare abstract class FetcherRenderer {
|
|
|
50
50
|
private generateQueryOptionsSignature;
|
|
51
51
|
private generateInfiniteQueryVariablesSignature;
|
|
52
52
|
private generateInfiniteQueryOptionsSignature;
|
|
53
|
-
generateInfiniteQueryKey(config: GenerateConfig
|
|
53
|
+
generateInfiniteQueryKey(config: GenerateConfig): string;
|
|
54
54
|
generateInfiniteQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
|
|
55
55
|
hook: string;
|
|
56
56
|
getKey: string;
|
|
57
57
|
rootKey: string;
|
|
58
58
|
};
|
|
59
|
-
generateQueryKey(config: GenerateConfig
|
|
59
|
+
generateQueryKey(config: GenerateConfig): string;
|
|
60
60
|
generateQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
|
|
61
61
|
hook: string;
|
|
62
62
|
document: string;
|
package/typings/fetcher.d.ts
CHANGED
|
@@ -50,13 +50,13 @@ export declare abstract class FetcherRenderer {
|
|
|
50
50
|
private generateQueryOptionsSignature;
|
|
51
51
|
private generateInfiniteQueryVariablesSignature;
|
|
52
52
|
private generateInfiniteQueryOptionsSignature;
|
|
53
|
-
generateInfiniteQueryKey(config: GenerateConfig
|
|
53
|
+
generateInfiniteQueryKey(config: GenerateConfig): string;
|
|
54
54
|
generateInfiniteQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
|
|
55
55
|
hook: string;
|
|
56
56
|
getKey: string;
|
|
57
57
|
rootKey: string;
|
|
58
58
|
};
|
|
59
|
-
generateQueryKey(config: GenerateConfig
|
|
59
|
+
generateQueryKey(config: GenerateConfig): string;
|
|
60
60
|
generateQueryOutput(config: GenerateConfig, isSuspense?: boolean): {
|
|
61
61
|
hook: string;
|
|
62
62
|
document: string;
|