@graphql-codegen/typescript-rtk-query 4.0.3 → 4.0.4-alpha-20260623130710-2e193a37fae6d6f4ef94f7f7bbb836035a1c0599
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/visitor.js +10 -8
- package/esm/visitor.js +10 -8
- package/package.json +2 -2
- package/typings/visitor.d.cts +1 -0
- package/typings/visitor.d.ts +1 -0
package/cjs/visitor.js
CHANGED
|
@@ -30,17 +30,19 @@ class RTKQueryVisitor extends visitor_plugin_common_1.ClientSideBaseVisitor {
|
|
|
30
30
|
get hasOperations() {
|
|
31
31
|
return this._collectedOperations.length > 0;
|
|
32
32
|
}
|
|
33
|
+
get hasFragments() {
|
|
34
|
+
return this._fragments.size > 0;
|
|
35
|
+
}
|
|
33
36
|
getImports() {
|
|
34
37
|
const baseImports = super.getImports();
|
|
35
|
-
if (
|
|
36
|
-
|
|
38
|
+
if (this.hasFragments || this.hasOperations) {
|
|
39
|
+
const typedDocumentStringPropImport = this._generateImport(visitor_plugin_common_1.typedDocumentString.import, visitor_plugin_common_1.typedDocumentString.import.propName, true);
|
|
40
|
+
baseImports.push(typedDocumentStringPropImport);
|
|
41
|
+
}
|
|
42
|
+
if (this.hasOperations) {
|
|
43
|
+
baseImports.push(`import { ${this.config.importBaseApiAlternateName} } from '${this.config.importBaseApiFrom}';`);
|
|
37
44
|
}
|
|
38
|
-
|
|
39
|
-
return [
|
|
40
|
-
...baseImports,
|
|
41
|
-
typedDocumentStringPropImport,
|
|
42
|
-
`import { ${this.config.importBaseApiAlternateName} } from '${this.config.importBaseApiFrom}';`,
|
|
43
|
-
];
|
|
45
|
+
return baseImports;
|
|
44
46
|
}
|
|
45
47
|
getInjectCall() {
|
|
46
48
|
if (!this.hasOperations) {
|
package/esm/visitor.js
CHANGED
|
@@ -26,17 +26,19 @@ export class RTKQueryVisitor extends ClientSideBaseVisitor {
|
|
|
26
26
|
get hasOperations() {
|
|
27
27
|
return this._collectedOperations.length > 0;
|
|
28
28
|
}
|
|
29
|
+
get hasFragments() {
|
|
30
|
+
return this._fragments.size > 0;
|
|
31
|
+
}
|
|
29
32
|
getImports() {
|
|
30
33
|
const baseImports = super.getImports();
|
|
31
|
-
if (
|
|
32
|
-
|
|
34
|
+
if (this.hasFragments || this.hasOperations) {
|
|
35
|
+
const typedDocumentStringPropImport = this._generateImport(typedDocumentString.import, typedDocumentString.import.propName, true);
|
|
36
|
+
baseImports.push(typedDocumentStringPropImport);
|
|
37
|
+
}
|
|
38
|
+
if (this.hasOperations) {
|
|
39
|
+
baseImports.push(`import { ${this.config.importBaseApiAlternateName} } from '${this.config.importBaseApiFrom}';`);
|
|
33
40
|
}
|
|
34
|
-
|
|
35
|
-
return [
|
|
36
|
-
...baseImports,
|
|
37
|
-
typedDocumentStringPropImport,
|
|
38
|
-
`import { ${this.config.importBaseApiAlternateName} } from '${this.config.importBaseApiFrom}';`,
|
|
39
|
-
];
|
|
41
|
+
return baseImports;
|
|
40
42
|
}
|
|
41
43
|
getInjectCall() {
|
|
42
44
|
if (!this.hasOperations) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-rtk-query",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4-alpha-20260623130710-2e193a37fae6d6f4ef94f7f7bbb836035a1c0599",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for injecting graphql endpoints into a preconfigured RTK Query api",
|
|
5
5
|
"peerDependenciesMeta": {
|
|
6
6
|
"graphql-request": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@graphql-codegen/plugin-helpers": "^7.0.1",
|
|
18
|
-
"@graphql-codegen/visitor-plugin-common": "^7.1.
|
|
18
|
+
"@graphql-codegen/visitor-plugin-common": "^7.1.1",
|
|
19
19
|
"auto-bind": "~4.0.0",
|
|
20
20
|
"change-case-all": "1.0.15",
|
|
21
21
|
"tslib": "^2.8.1"
|
package/typings/visitor.d.cts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class RTKQueryVisitor extends ClientSideBaseVisitor<RTKQueryRawPl
|
|
|
10
10
|
constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: RTKQueryRawPluginConfig, documents: Types.DocumentFile[]);
|
|
11
11
|
get imports(): Set<string>;
|
|
12
12
|
get hasOperations(): boolean;
|
|
13
|
+
get hasFragments(): boolean;
|
|
13
14
|
getImports(): string[];
|
|
14
15
|
getInjectCall(): string;
|
|
15
16
|
private injectTransformResponse;
|
package/typings/visitor.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class RTKQueryVisitor extends ClientSideBaseVisitor<RTKQueryRawPl
|
|
|
10
10
|
constructor(schema: GraphQLSchema, fragments: LoadedFragment[], rawConfig: RTKQueryRawPluginConfig, documents: Types.DocumentFile[]);
|
|
11
11
|
get imports(): Set<string>;
|
|
12
12
|
get hasOperations(): boolean;
|
|
13
|
+
get hasFragments(): boolean;
|
|
13
14
|
getImports(): string[];
|
|
14
15
|
getInjectCall(): string;
|
|
15
16
|
private injectTransformResponse;
|