@effect-gql/core 1.4.7 → 1.4.8

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/builder/index.js CHANGED
@@ -11,7 +11,15 @@ var isIntegerType = (ast) => {
11
11
  const annotations = refinement.annotations;
12
12
  if (annotations) {
13
13
  const identifier = AST.getIdentifierAnnotation(refinement);
14
- if (identifier._tag === "Some" && identifier.value === "Int") {
14
+ if (identifier._tag === "Some") {
15
+ const id = identifier.value;
16
+ if (id === "Int" || id.includes("Int")) {
17
+ return true;
18
+ }
19
+ }
20
+ const JSONSchemaSymbol = /* @__PURE__ */ Symbol.for("effect/annotation/JSONSchema");
21
+ const jsonSchema = annotations[JSONSchemaSymbol];
22
+ if (jsonSchema && jsonSchema.type === "integer") {
15
23
  return true;
16
24
  }
17
25
  }
@@ -79,7 +87,8 @@ var toGraphQLType = (schema) => {
79
87
  if (fieldName === "_tag") continue;
80
88
  const fieldSchema = S2.make(field2.type);
81
89
  let fieldType = toGraphQLType(fieldSchema);
82
- if (!field2.isOptional) {
90
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
91
+ if (!field2.isOptional && !isOptionField) {
83
92
  fieldType = new GraphQLNonNull(fieldType);
84
93
  }
85
94
  fields[fieldName] = { type: fieldType };
@@ -155,7 +164,8 @@ var toGraphQLInputType = (schema) => {
155
164
  if (fieldName === "_tag") continue;
156
165
  const fieldSchema = S2.make(field2.type);
157
166
  let fieldType = toGraphQLInputType(fieldSchema);
158
- if (!field2.isOptional) {
167
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
168
+ if (!field2.isOptional && !isOptionField) {
159
169
  fieldType = new GraphQLNonNull(fieldType);
160
170
  }
161
171
  fields[fieldName] = { type: fieldType };
@@ -206,7 +216,8 @@ var toGraphQLArgs = (schema) => {
206
216
  if (fieldName === "_tag") continue;
207
217
  const fieldSchema = S2.make(field2.type);
208
218
  let fieldType = toGraphQLInputType(fieldSchema);
209
- if (!field2.isOptional) {
219
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
220
+ if (!field2.isOptional && !isOptionField) {
210
221
  fieldType = new GraphQLNonNull(fieldType);
211
222
  }
212
223
  args[fieldName] = { type: fieldType };