protoc-gen-pothos 0.1.1 → 0.2.0

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,28 @@
1
1
  # protoc-gen-pothos
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#224](https://github.com/proto-graphql/proto-graphql-js/pull/224) [`6c25f40`](https://github.com/proto-graphql/proto-graphql-js/commit/6c25f4035f1b788a63bf005dbc52ca5d0bd5f2a2) Thanks [@izumin5210](https://github.com/izumin5210)! - support `long_number` param for mapping 64bit numbers to GraphQL Int
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`6c25f40`](https://github.com/proto-graphql/proto-graphql-js/commit/6c25f4035f1b788a63bf005dbc52ca5d0bd5f2a2)]:
12
+ - @proto-graphql/codegen-core@0.2.0
13
+ - @proto-graphql/protoc-plugin-helpers@0.2.0
14
+
15
+ ## 0.1.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [#217](https://github.com/proto-graphql/proto-graphql-js/pull/217) [`5e2e85b`](https://github.com/proto-graphql/proto-graphql-js/commit/5e2e85baf6e0e21960104d3db30a4e21e04e1627) Thanks [@izumin5210](https://github.com/izumin5210)! - add `eslint-disable` directive to generated files
20
+
21
+ - [#218](https://github.com/proto-graphql/proto-graphql-js/pull/218) [`c1246c3`](https://github.com/proto-graphql/proto-graphql-js/commit/c1246c3a349f11e3b2bbfd6198c1a06b37270ece) Thanks [@izumin5210](https://github.com/izumin5210)! - fix non-null custom scalar field resolver
22
+
23
+ - Updated dependencies [[`c1246c3`](https://github.com/proto-graphql/proto-graphql-js/commit/c1246c3a349f11e3b2bbfd6198c1a06b37270ece)]:
24
+ - @proto-graphql/codegen-core@0.1.2
25
+
3
26
  ## 0.1.1
4
27
 
5
28
  ### Patch Changes
@@ -51,7 +51,9 @@ function createFieldDefinitionExpr(field) {
51
51
  }
52
52
  let createResolveStmts;
53
53
  if (!isInput) {
54
- if (field.type instanceof codegen_core_1.ObjectType && !field.isNullable()) {
54
+ const nullableInProto = field.type instanceof codegen_core_1.ObjectType ||
55
+ (field.type instanceof codegen_core_1.ScalarType && !field.type.isPrimitive() && !field.type.isWrapperType());
56
+ if (nullableInProto && !field.isNullable()) {
55
57
  createResolveStmts = (sourceExpr) => (0, nonNullResolver_1.createNonNullResolverStmts)(typescript_1.default.factory.createPropertyAccessExpression(sourceExpr, field.protoJsName));
56
58
  }
57
59
  if (field.type instanceof codegen_core_1.EnumType && field instanceof codegen_core_1.ObjectField) {
package/lib/printer.js CHANGED
@@ -56,6 +56,8 @@ function printSource(types, file) {
56
56
  "// Code generated by protoc-gen-pothos. DO NOT EDIT.",
57
57
  `// source: ${file.descriptor.getName()}`,
58
58
  "",
59
+ "/* eslint-disable */",
60
+ "",
59
61
  result,
60
62
  ].join("\n");
61
63
  return content;
@@ -45,7 +45,9 @@ export function createFieldDefinitionExpr(field) {
45
45
  }
46
46
  let createResolveStmts;
47
47
  if (!isInput) {
48
- if (field.type instanceof ObjectType && !field.isNullable()) {
48
+ const nullableInProto = field.type instanceof ObjectType ||
49
+ (field.type instanceof ScalarType && !field.type.isPrimitive() && !field.type.isWrapperType());
50
+ if (nullableInProto && !field.isNullable()) {
49
51
  createResolveStmts = (sourceExpr) => createNonNullResolverStmts(ts.factory.createPropertyAccessExpression(sourceExpr, field.protoJsName));
50
52
  }
51
53
  if (field.type instanceof EnumType && field instanceof ObjectField) {
package/module/printer.js CHANGED
@@ -49,6 +49,8 @@ function printSource(types, file) {
49
49
  "// Code generated by protoc-gen-pothos. DO NOT EDIT.",
50
50
  `// source: ${file.descriptor.getName()}`,
51
51
  "",
52
+ "/* eslint-disable */",
53
+ "",
52
54
  result,
53
55
  ].join("\n");
54
56
  return content;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protoc-gen-pothos",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Generate DSL for Pothos GraphQL from Protocol Buffers IDL",
5
5
  "keywords": [
6
6
  "graphql",
@@ -23,14 +23,16 @@
23
23
  "node": ">= 14.0.0"
24
24
  },
25
25
  "dependencies": {
26
- "@proto-graphql/codegen-core": "^0.1.1",
26
+ "@proto-graphql/codegen-core": "^0.2.0",
27
27
  "@proto-graphql/proto-descriptors": "^0.1.0",
28
- "@proto-graphql/protoc-plugin-helpers": "^0.1.1",
28
+ "@proto-graphql/protoc-plugin-helpers": "^0.2.0",
29
29
  "google-protobuf": "^3.20.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@pothos/core": "^3.22.7",
33
33
  "@testapis/ts-proto": "^0.5.1",
34
+ "@testapis/ts-proto-with-forcelong-long": "^0.6.0",
35
+ "@testapis/ts-proto-with-forcelong-number": "^0.6.0",
34
36
  "@types/glob": "^8.0.0",
35
37
  "glob": "^8.0.1"
36
38
  },