@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.cjs CHANGED
@@ -33,7 +33,15 @@ var isIntegerType = (ast) => {
33
33
  const annotations = refinement.annotations;
34
34
  if (annotations) {
35
35
  const identifier = AST__namespace.getIdentifierAnnotation(refinement);
36
- if (identifier._tag === "Some" && identifier.value === "Int") {
36
+ if (identifier._tag === "Some") {
37
+ const id = identifier.value;
38
+ if (id === "Int" || id.includes("Int")) {
39
+ return true;
40
+ }
41
+ }
42
+ const JSONSchemaSymbol = /* @__PURE__ */ Symbol.for("effect/annotation/JSONSchema");
43
+ const jsonSchema = annotations[JSONSchemaSymbol];
44
+ if (jsonSchema && jsonSchema.type === "integer") {
37
45
  return true;
38
46
  }
39
47
  }
@@ -101,7 +109,8 @@ var toGraphQLType = (schema) => {
101
109
  if (fieldName === "_tag") continue;
102
110
  const fieldSchema = S2__namespace.make(field2.type);
103
111
  let fieldType = toGraphQLType(fieldSchema);
104
- if (!field2.isOptional) {
112
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
113
+ if (!field2.isOptional && !isOptionField) {
105
114
  fieldType = new graphql.GraphQLNonNull(fieldType);
106
115
  }
107
116
  fields[fieldName] = { type: fieldType };
@@ -177,7 +186,8 @@ var toGraphQLInputType = (schema) => {
177
186
  if (fieldName === "_tag") continue;
178
187
  const fieldSchema = S2__namespace.make(field2.type);
179
188
  let fieldType = toGraphQLInputType(fieldSchema);
180
- if (!field2.isOptional) {
189
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
190
+ if (!field2.isOptional && !isOptionField) {
181
191
  fieldType = new graphql.GraphQLNonNull(fieldType);
182
192
  }
183
193
  fields[fieldName] = { type: fieldType };
@@ -228,7 +238,8 @@ var toGraphQLArgs = (schema) => {
228
238
  if (fieldName === "_tag") continue;
229
239
  const fieldSchema = S2__namespace.make(field2.type);
230
240
  let fieldType = toGraphQLInputType(fieldSchema);
231
- if (!field2.isOptional) {
241
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
242
+ if (!field2.isOptional && !isOptionField) {
232
243
  fieldType = new graphql.GraphQLNonNull(fieldType);
233
244
  }
234
245
  args[fieldName] = { type: fieldType };