protoc-gen-pothos 0.2.1 → 0.2.2
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# protoc-gen-pothos
|
|
2
2
|
|
|
3
|
+
## 0.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#234](https://github.com/proto-graphql/proto-graphql-js/pull/234) [`a2a3e60`](https://github.com/proto-graphql/proto-graphql-js/commit/a2a3e60789f75c31c600333afd830a02ac0cccf8) Thanks [@izumin5210](https://github.com/izumin5210)! - support `ProtoScalar` in `ProtoField.type`
|
|
8
|
+
|
|
9
|
+
- [#236](https://github.com/proto-graphql/proto-graphql-js/pull/236) [`3410d43`](https://github.com/proto-graphql/proto-graphql-js/commit/3410d43a7d29d04e1ed52576ac8a28e9b43cb452) Thanks [@izumin5210](https://github.com/izumin5210)! - add `typeFullName` to extensions in GraphQLField
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [[`a2a3e60`](https://github.com/proto-graphql/proto-graphql-js/commit/a2a3e60789f75c31c600333afd830a02ac0cccf8)]:
|
|
12
|
+
- @proto-graphql/codegen-core@0.2.2
|
|
13
|
+
- @proto-graphql/proto-descriptors@0.2.0
|
|
14
|
+
- @proto-graphql/protoc-plugin-helpers@0.2.1
|
|
15
|
+
|
|
3
16
|
## 0.2.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -123,7 +123,21 @@ function createResolverExpr(createStmts) {
|
|
|
123
123
|
* ```
|
|
124
124
|
*/
|
|
125
125
|
function createExtensionsObjectLiteralExpr(field) {
|
|
126
|
+
let typeName;
|
|
127
|
+
if ((field instanceof codegen_core_1.ObjectField || field instanceof codegen_core_1.InputObjectField) && field.proto.type !== null) {
|
|
128
|
+
if (field.proto.type.kind === "Scalar") {
|
|
129
|
+
typeName = field.proto.type.type;
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
typeName = field.proto.type.fullName.toString();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
126
135
|
return typescript_1.default.factory.createObjectLiteralExpression([
|
|
127
|
-
typescript_1.default.factory.createPropertyAssignment("protobufField", typescript_1.default.factory.createObjectLiteralExpression([
|
|
136
|
+
typescript_1.default.factory.createPropertyAssignment("protobufField", typescript_1.default.factory.createObjectLiteralExpression([
|
|
137
|
+
typescript_1.default.factory.createPropertyAssignment("name", typescript_1.default.factory.createStringLiteral(field.proto.name)),
|
|
138
|
+
typeName
|
|
139
|
+
? typescript_1.default.factory.createPropertyAssignment("typeFullName", typescript_1.default.factory.createStringLiteral(typeName))
|
|
140
|
+
: undefined,
|
|
141
|
+
].filter((0, util_1.onlyNonNull)()), true)),
|
|
128
142
|
], true);
|
|
129
143
|
}
|
|
@@ -48,7 +48,7 @@ function createExtensionsObjectLiteralExpr(type) {
|
|
|
48
48
|
typescript_1.default.factory.createPropertyAssignment("package", typescript_1.default.factory.createStringLiteral(type.proto.file.package)),
|
|
49
49
|
typescript_1.default.factory.createPropertyAssignment("fields", typescript_1.default.factory.createArrayLiteralExpression(type.proto.oneofs[0].fields.map((f) => typescript_1.default.factory.createObjectLiteralExpression([
|
|
50
50
|
typescript_1.default.factory.createPropertyAssignment("name", typescript_1.default.factory.createStringLiteral(f.name)),
|
|
51
|
-
...(f.type
|
|
51
|
+
...(f.type && f.type.kind !== "Scalar"
|
|
52
52
|
? [
|
|
53
53
|
typescript_1.default.factory.createPropertyAssignment("type", typescript_1.default.factory.createStringLiteral(f.type.fullName.toString())),
|
|
54
54
|
]
|
|
@@ -65,7 +65,7 @@ function createExtensionsObjectLiteralExpr(type) {
|
|
|
65
65
|
typescript_1.default.factory.createPropertyAssignment("package", typescript_1.default.factory.createStringLiteral(type.proto.parent.file.package)),
|
|
66
66
|
typescript_1.default.factory.createPropertyAssignment("fields", typescript_1.default.factory.createArrayLiteralExpression(type.proto.fields.map((f) => typescript_1.default.factory.createObjectLiteralExpression([
|
|
67
67
|
typescript_1.default.factory.createPropertyAssignment("name", typescript_1.default.factory.createStringLiteral(f.name)),
|
|
68
|
-
...(f.type
|
|
68
|
+
...(f.type && f.type.kind !== "Scalar"
|
|
69
69
|
? [
|
|
70
70
|
typescript_1.default.factory.createPropertyAssignment("type", typescript_1.default.factory.createStringLiteral(f.type.fullName.toString())),
|
|
71
71
|
]
|
|
@@ -115,7 +115,21 @@ function createResolverExpr(createStmts) {
|
|
|
115
115
|
* ```
|
|
116
116
|
*/
|
|
117
117
|
function createExtensionsObjectLiteralExpr(field) {
|
|
118
|
+
let typeName;
|
|
119
|
+
if ((field instanceof ObjectField || field instanceof InputObjectField) && field.proto.type !== null) {
|
|
120
|
+
if (field.proto.type.kind === "Scalar") {
|
|
121
|
+
typeName = field.proto.type.type;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
typeName = field.proto.type.fullName.toString();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
118
127
|
return ts.factory.createObjectLiteralExpression([
|
|
119
|
-
ts.factory.createPropertyAssignment("protobufField", ts.factory.createObjectLiteralExpression([
|
|
128
|
+
ts.factory.createPropertyAssignment("protobufField", ts.factory.createObjectLiteralExpression([
|
|
129
|
+
ts.factory.createPropertyAssignment("name", ts.factory.createStringLiteral(field.proto.name)),
|
|
130
|
+
typeName
|
|
131
|
+
? ts.factory.createPropertyAssignment("typeFullName", ts.factory.createStringLiteral(typeName))
|
|
132
|
+
: undefined,
|
|
133
|
+
].filter(onlyNonNull()), true)),
|
|
120
134
|
], true);
|
|
121
135
|
}
|
|
@@ -41,7 +41,7 @@ function createExtensionsObjectLiteralExpr(type) {
|
|
|
41
41
|
ts.factory.createPropertyAssignment("package", ts.factory.createStringLiteral(type.proto.file.package)),
|
|
42
42
|
ts.factory.createPropertyAssignment("fields", ts.factory.createArrayLiteralExpression(type.proto.oneofs[0].fields.map((f) => ts.factory.createObjectLiteralExpression([
|
|
43
43
|
ts.factory.createPropertyAssignment("name", ts.factory.createStringLiteral(f.name)),
|
|
44
|
-
...(f.type
|
|
44
|
+
...(f.type && f.type.kind !== "Scalar"
|
|
45
45
|
? [
|
|
46
46
|
ts.factory.createPropertyAssignment("type", ts.factory.createStringLiteral(f.type.fullName.toString())),
|
|
47
47
|
]
|
|
@@ -58,7 +58,7 @@ function createExtensionsObjectLiteralExpr(type) {
|
|
|
58
58
|
ts.factory.createPropertyAssignment("package", ts.factory.createStringLiteral(type.proto.parent.file.package)),
|
|
59
59
|
ts.factory.createPropertyAssignment("fields", ts.factory.createArrayLiteralExpression(type.proto.fields.map((f) => ts.factory.createObjectLiteralExpression([
|
|
60
60
|
ts.factory.createPropertyAssignment("name", ts.factory.createStringLiteral(f.name)),
|
|
61
|
-
...(f.type
|
|
61
|
+
...(f.type && f.type.kind !== "Scalar"
|
|
62
62
|
? [
|
|
63
63
|
ts.factory.createPropertyAssignment("type", ts.factory.createStringLiteral(f.type.fullName.toString())),
|
|
64
64
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "protoc-gen-pothos",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Generate DSL for Pothos GraphQL from Protocol Buffers IDL",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"node": ">= 14.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@proto-graphql/codegen-core": "^0.2.
|
|
27
|
-
"@proto-graphql/proto-descriptors": "^0.
|
|
28
|
-
"@proto-graphql/protoc-plugin-helpers": "^0.2.
|
|
26
|
+
"@proto-graphql/codegen-core": "^0.2.2",
|
|
27
|
+
"@proto-graphql/proto-descriptors": "^0.2.0",
|
|
28
|
+
"@proto-graphql/protoc-plugin-helpers": "^0.2.1",
|
|
29
29
|
"google-protobuf": "^3.20.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|