@graphql-codegen/c-sharp-common 0.1.1-alpha-0814e49cc.0 → 0.1.1
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
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/c-sharp-common",
|
|
3
|
-
"version": "0.1.1
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"sideEffects": false,
|
|
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
|
"graphql-tag": "2.12.6"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-codegen/plugin-helpers": "^2.6.
|
|
11
|
-
"@graphql-codegen/visitor-plugin-common": "^2.12.1
|
|
10
|
+
"@graphql-codegen/plugin-helpers": "^2.6.2",
|
|
11
|
+
"@graphql-codegen/visitor-plugin-common": "^2.12.1",
|
|
12
12
|
"auto-bind": "~4.0.0",
|
|
13
13
|
"change-case-all": "1.0.14",
|
|
14
14
|
"tslib": "~2.4.0"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
27
|
"require": {
|
|
28
|
-
"types": "./typings/index.d.
|
|
28
|
+
"types": "./typings/index.d.cts",
|
|
29
29
|
"default": "./cjs/index.js"
|
|
30
30
|
},
|
|
31
31
|
"import": {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { StringValueNode, NameNode } from 'graphql';
|
|
2
|
+
export declare type Access = 'private' | 'public' | 'protected';
|
|
3
|
+
export declare type Kind = 'namespace' | 'class' | 'record' | 'interface' | 'enum';
|
|
4
|
+
export declare class CSharpDeclarationBlock {
|
|
5
|
+
_name: string;
|
|
6
|
+
_extendStr: string[];
|
|
7
|
+
_implementsStr: string[];
|
|
8
|
+
_kind: Kind;
|
|
9
|
+
_access: Access;
|
|
10
|
+
_final: boolean;
|
|
11
|
+
_static: boolean;
|
|
12
|
+
_block: any;
|
|
13
|
+
_comment: any;
|
|
14
|
+
_nestedClasses: CSharpDeclarationBlock[];
|
|
15
|
+
nestedClass(nstCls: CSharpDeclarationBlock): CSharpDeclarationBlock;
|
|
16
|
+
access(access: Access): CSharpDeclarationBlock;
|
|
17
|
+
asKind(kind: Kind): CSharpDeclarationBlock;
|
|
18
|
+
final(): CSharpDeclarationBlock;
|
|
19
|
+
static(): CSharpDeclarationBlock;
|
|
20
|
+
withComment(comment: string | StringValueNode | null): CSharpDeclarationBlock;
|
|
21
|
+
withBlock(block: string): CSharpDeclarationBlock;
|
|
22
|
+
extends(extendStr: string[]): CSharpDeclarationBlock;
|
|
23
|
+
implements(implementsStr: string[]): CSharpDeclarationBlock;
|
|
24
|
+
withName(name: string | NameNode): CSharpDeclarationBlock;
|
|
25
|
+
get string(): string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface BaseTypeField {
|
|
2
|
+
type: string;
|
|
3
|
+
valueType: boolean;
|
|
4
|
+
required: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface ListTypeField {
|
|
7
|
+
required: boolean;
|
|
8
|
+
type: ListTypeField;
|
|
9
|
+
}
|
|
10
|
+
export interface CSharpField {
|
|
11
|
+
baseType: BaseTypeField;
|
|
12
|
+
listType?: ListTypeField;
|
|
13
|
+
}
|
|
14
|
+
export declare class CSharpFieldType implements CSharpField {
|
|
15
|
+
baseType: BaseTypeField;
|
|
16
|
+
listType?: ListTypeField;
|
|
17
|
+
constructor(fieldType: CSharpField);
|
|
18
|
+
get innerTypeName(): string;
|
|
19
|
+
get isOuterTypeRequired(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NameNode } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* Checks name against list of keywords. If it is, will prefix value with @
|
|
4
|
+
*
|
|
5
|
+
* Note:
|
|
6
|
+
* This class should first invoke the convertName from base-visitor to convert the string or node
|
|
7
|
+
* value according the naming configuration, eg upper or lower case. Then resulting string checked
|
|
8
|
+
* against the list or keywords.
|
|
9
|
+
* However the generated C# code is not yet able to handle fields that are in a different case so
|
|
10
|
+
* the invocation of convertName is omitted purposely.
|
|
11
|
+
*/
|
|
12
|
+
export declare function convertSafeName(node: NameNode | string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TypeNode, StringValueNode } from 'graphql';
|
|
2
|
+
import { ListTypeField, CSharpFieldType } from './c-sharp-field-types.cjs';
|
|
3
|
+
export declare function transformComment(comment: string | StringValueNode, indentLevel?: number): string;
|
|
4
|
+
export declare function isValueType(type: string): boolean;
|
|
5
|
+
export declare function getListTypeField(typeNode: TypeNode): ListTypeField | undefined;
|
|
6
|
+
export declare function getListTypeDepth(listType: ListTypeField): number;
|
|
7
|
+
export declare function getListInnerTypeNode(typeNode: TypeNode): TypeNode;
|
|
8
|
+
export declare function wrapFieldType(fieldType: CSharpFieldType, listTypeField?: ListTypeField, listType?: string): string;
|