@graphql-codegen/typescript-apollo-angular 3.5.3-alpha-0814e49cc.0 → 3.5.3
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/package.json +4 -4
- package/typings/config.d.cts +140 -0
- package/typings/index.d.cts +7 -0
- package/typings/visitor.d.cts +42 -0
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/typescript-apollo-angular",
|
|
3
|
-
"version": "3.5.3
|
|
3
|
+
"version": "3.5.3",
|
|
4
4
|
"description": "GraphQL Code Generator plugin for generating ready-to-use Angular Components 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"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@graphql-codegen/plugin-helpers": "^2.6.
|
|
10
|
-
"@graphql-codegen/visitor-plugin-common": "2.12.1
|
|
9
|
+
"@graphql-codegen/plugin-helpers": "^2.6.2",
|
|
10
|
+
"@graphql-codegen/visitor-plugin-common": "2.12.1",
|
|
11
11
|
"auto-bind": "~4.0.0",
|
|
12
12
|
"change-case-all": "1.0.14",
|
|
13
13
|
"tslib": "~2.4.0"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"exports": {
|
|
29
29
|
".": {
|
|
30
30
|
"require": {
|
|
31
|
-
"types": "./typings/index.d.
|
|
31
|
+
"types": "./typings/index.d.cts",
|
|
32
32
|
"default": "./cjs/index.js"
|
|
33
33
|
},
|
|
34
34
|
"import": {
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { RawClientSideBasePluginConfig } from '@graphql-codegen/visitor-plugin-common';
|
|
2
|
+
/**
|
|
3
|
+
* @description This plugin generates Apollo services (`Query`, `Mutation` and `Subscription`) with TypeScript typings.
|
|
4
|
+
*
|
|
5
|
+
* It will generate a strongly typed Angular service for every defined query, mutation or subscription. The generated Angular services are ready to inject and use within your Angular component.
|
|
6
|
+
*
|
|
7
|
+
* It extends the basic TypeScript plugins: `@graphql-codegen/typescript`, `@graphql-codegen/typescript-operations` - and thus shares a similar configuration.
|
|
8
|
+
*
|
|
9
|
+
* To shed some more light regards this template, it's recommended to go through this article: https://apollo-angular.com/docs/get-started, and to read the Code Generation with Apollo Angular: https://the-guild.dev/blog/apollo-angular-12
|
|
10
|
+
*/
|
|
11
|
+
export interface ApolloAngularRawPluginConfig extends RawClientSideBasePluginConfig {
|
|
12
|
+
/**
|
|
13
|
+
* @description Version of `apollo-angular` package
|
|
14
|
+
* @default 2
|
|
15
|
+
*
|
|
16
|
+
* @exampleMarkdown
|
|
17
|
+
* ```yaml
|
|
18
|
+
* config:
|
|
19
|
+
* apolloAngularVersion: 1
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
apolloAngularVersion?: number;
|
|
23
|
+
/**
|
|
24
|
+
* @description Allows to define `ngModule` as part of the plugin's config so it's globally available.
|
|
25
|
+
*
|
|
26
|
+
* @exampleMarkdown
|
|
27
|
+
* ```yaml
|
|
28
|
+
* config:
|
|
29
|
+
* ngModule: ./path/to/module#MyModule
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
ngModule?: string;
|
|
33
|
+
/**
|
|
34
|
+
* @description Defined the global value of `namedClient`.
|
|
35
|
+
*
|
|
36
|
+
* @exampleMarkdown
|
|
37
|
+
* ```yaml
|
|
38
|
+
* config:
|
|
39
|
+
* namedClient: 'customName'
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
namedClient?: string;
|
|
43
|
+
/**
|
|
44
|
+
* @description Defined the global value of `serviceName`.
|
|
45
|
+
*
|
|
46
|
+
* @exampleMarkdown
|
|
47
|
+
* ```yaml
|
|
48
|
+
* config:
|
|
49
|
+
* serviceName: 'MySDK'
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
serviceName?: string;
|
|
53
|
+
/**
|
|
54
|
+
* @description Defined the global value of `serviceProvidedInRoot`.
|
|
55
|
+
*
|
|
56
|
+
* @exampleMarkdown
|
|
57
|
+
* ```yaml
|
|
58
|
+
* config:
|
|
59
|
+
* serviceProvidedInRoot: false
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
serviceProvidedInRoot?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* @description Define the Injector of the SDK class.
|
|
65
|
+
*
|
|
66
|
+
* @exampleMarkdown
|
|
67
|
+
* ```yaml
|
|
68
|
+
* config:
|
|
69
|
+
* serviceProvidedIn: ./path/to/module#MyModule
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
serviceProvidedIn?: string;
|
|
73
|
+
/**
|
|
74
|
+
* @description Set to `true` in order to generate a SDK service class that uses all generated services.
|
|
75
|
+
* @default false
|
|
76
|
+
*/
|
|
77
|
+
sdkClass?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* @description Allows to define a custom suffix for query operations.
|
|
80
|
+
* @default GQL
|
|
81
|
+
*
|
|
82
|
+
* @exampleMarkdown
|
|
83
|
+
* ```yaml
|
|
84
|
+
* config:
|
|
85
|
+
* querySuffix: 'QueryService'
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
querySuffix?: string;
|
|
89
|
+
/**
|
|
90
|
+
* @description Allows to define a custom suffix for mutation operations.
|
|
91
|
+
* @default GQL
|
|
92
|
+
*
|
|
93
|
+
* @exampleMarkdown
|
|
94
|
+
* ```yaml
|
|
95
|
+
* config:
|
|
96
|
+
* mutationSuffix: 'MutationService'
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
mutationSuffix?: string;
|
|
100
|
+
/**
|
|
101
|
+
* @description Allows to define a custom suffix for Subscription operations.
|
|
102
|
+
* @default GQL
|
|
103
|
+
*
|
|
104
|
+
* @exampleMarkdown
|
|
105
|
+
* ```yaml
|
|
106
|
+
* config:
|
|
107
|
+
* subscriptionSuffix: 'SubscriptionService'
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
subscriptionSuffix?: 'GQL' | string;
|
|
111
|
+
/**
|
|
112
|
+
* @description Allows to define a custom Apollo-Angular package to import types from.
|
|
113
|
+
* @default 'apollo-angular'
|
|
114
|
+
*/
|
|
115
|
+
apolloAngularPackage?: 'apollo-angular' | string;
|
|
116
|
+
/**
|
|
117
|
+
* @description Add additional dependency injections for generated services
|
|
118
|
+
* @default []
|
|
119
|
+
*
|
|
120
|
+
* @exampleMarkdown
|
|
121
|
+
* ```yaml
|
|
122
|
+
* config:
|
|
123
|
+
* additionalDI
|
|
124
|
+
* - 'testService: TestService'
|
|
125
|
+
* - 'testService1': TestService1'
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
additionalDI?: string[];
|
|
129
|
+
/**
|
|
130
|
+
* @description Add `override` modifier to make the generated code compatible with the `noImplicitOverride` option of Typescript v4.3+.
|
|
131
|
+
* @default false
|
|
132
|
+
*
|
|
133
|
+
* @exampleMarkdown
|
|
134
|
+
* ```yaml
|
|
135
|
+
* config:
|
|
136
|
+
* addExplicitOverride: true
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
addExplicitOverride?: boolean;
|
|
140
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PluginValidateFn, PluginFunction } from '@graphql-codegen/plugin-helpers';
|
|
2
|
+
import { ApolloAngularVisitor } from './visitor.cjs';
|
|
3
|
+
import { ApolloAngularRawPluginConfig } from './config.cjs';
|
|
4
|
+
export declare const plugin: PluginFunction<ApolloAngularRawPluginConfig>;
|
|
5
|
+
export declare const addToSchema: import("graphql").DocumentNode;
|
|
6
|
+
export declare const validate: PluginValidateFn<any>;
|
|
7
|
+
export { ApolloAngularVisitor };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ClientSideBaseVisitor, ClientSideBasePluginConfig, LoadedFragment } from '@graphql-codegen/visitor-plugin-common';
|
|
2
|
+
import { OperationDefinitionNode, GraphQLSchema } from 'graphql';
|
|
3
|
+
import { ApolloAngularRawPluginConfig } from './config.cjs';
|
|
4
|
+
import { Types } from '@graphql-codegen/plugin-helpers';
|
|
5
|
+
export interface ApolloAngularPluginConfig extends ClientSideBasePluginConfig {
|
|
6
|
+
apolloAngularVersion: number;
|
|
7
|
+
ngModule?: string;
|
|
8
|
+
namedClient?: string;
|
|
9
|
+
serviceName?: string;
|
|
10
|
+
serviceProvidedInRoot?: boolean;
|
|
11
|
+
serviceProvidedIn?: string;
|
|
12
|
+
sdkClass?: boolean;
|
|
13
|
+
querySuffix?: string;
|
|
14
|
+
mutationSuffix?: string;
|
|
15
|
+
subscriptionSuffix?: string;
|
|
16
|
+
apolloAngularPackage: string;
|
|
17
|
+
additionalDI?: string[];
|
|
18
|
+
addExplicitOverride: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class ApolloAngularVisitor extends ClientSideBaseVisitor<ApolloAngularRawPluginConfig, ApolloAngularPluginConfig> {
|
|
21
|
+
private _allOperations;
|
|
22
|
+
private _externalImportPrefix;
|
|
23
|
+
private _operationsToInclude;
|
|
24
|
+
private dependencyInjections;
|
|
25
|
+
private dependencyInjectionArgs;
|
|
26
|
+
constructor(schema: GraphQLSchema, fragments: LoadedFragment[], _allOperations: OperationDefinitionNode[], rawConfig: ApolloAngularRawPluginConfig, documents?: Types.DocumentFile[]);
|
|
27
|
+
getImports(): string[];
|
|
28
|
+
private _extractNgModule;
|
|
29
|
+
private _parseNgModule;
|
|
30
|
+
private _operationHasDirective;
|
|
31
|
+
private _removeDirective;
|
|
32
|
+
private _removeDirectives;
|
|
33
|
+
private _extractDirective;
|
|
34
|
+
protected _prepareDocument(documentStr: string): string;
|
|
35
|
+
private _namedClient;
|
|
36
|
+
private _extractNamedClient;
|
|
37
|
+
private _providedIn;
|
|
38
|
+
private _getDocumentNodeVariable;
|
|
39
|
+
private _operationSuffix;
|
|
40
|
+
protected buildOperation(node: OperationDefinitionNode, documentVariableName: string, operationType: string, operationResultType: string, operationVariablesTypes: string): string;
|
|
41
|
+
get sdkClass(): string;
|
|
42
|
+
}
|