@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/index.cjs CHANGED
@@ -38,7 +38,15 @@ var isIntegerType = (ast) => {
38
38
  const annotations = refinement.annotations;
39
39
  if (annotations) {
40
40
  const identifier = AST__namespace.getIdentifierAnnotation(refinement);
41
- if (identifier._tag === "Some" && identifier.value === "Int") {
41
+ if (identifier._tag === "Some") {
42
+ const id = identifier.value;
43
+ if (id === "Int" || id.includes("Int")) {
44
+ return true;
45
+ }
46
+ }
47
+ const JSONSchemaSymbol = /* @__PURE__ */ Symbol.for("effect/annotation/JSONSchema");
48
+ const jsonSchema = annotations[JSONSchemaSymbol];
49
+ if (jsonSchema && jsonSchema.type === "integer") {
42
50
  return true;
43
51
  }
44
52
  }
@@ -106,7 +114,8 @@ var toGraphQLType = (schema) => {
106
114
  if (fieldName === "_tag") continue;
107
115
  const fieldSchema = S2__namespace.make(field2.type);
108
116
  let fieldType = toGraphQLType(fieldSchema);
109
- if (!field2.isOptional) {
117
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
118
+ if (!field2.isOptional && !isOptionField) {
110
119
  fieldType = new graphql.GraphQLNonNull(fieldType);
111
120
  }
112
121
  fields[fieldName] = { type: fieldType };
@@ -182,7 +191,8 @@ var toGraphQLInputType = (schema) => {
182
191
  if (fieldName === "_tag") continue;
183
192
  const fieldSchema = S2__namespace.make(field2.type);
184
193
  let fieldType = toGraphQLInputType(fieldSchema);
185
- if (!field2.isOptional) {
194
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
195
+ if (!field2.isOptional && !isOptionField) {
186
196
  fieldType = new graphql.GraphQLNonNull(fieldType);
187
197
  }
188
198
  fields[fieldName] = { type: fieldType };
@@ -245,7 +255,8 @@ var toGraphQLObjectType = (name, schema, additionalFields) => {
245
255
  if (fieldName === "_tag") continue;
246
256
  const fieldSchema = S2__namespace.make(field2.type);
247
257
  let fieldType = toGraphQLType(fieldSchema);
248
- if (!field2.isOptional) {
258
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
259
+ if (!field2.isOptional && !isOptionField) {
249
260
  fieldType = new graphql.GraphQLNonNull(fieldType);
250
261
  }
251
262
  fields[fieldName] = { type: fieldType };
@@ -277,7 +288,8 @@ var toGraphQLArgs = (schema) => {
277
288
  if (fieldName === "_tag") continue;
278
289
  const fieldSchema = S2__namespace.make(field2.type);
279
290
  let fieldType = toGraphQLInputType(fieldSchema);
280
- if (!field2.isOptional) {
291
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
292
+ if (!field2.isOptional && !isOptionField) {
281
293
  fieldType = new graphql.GraphQLNonNull(fieldType);
282
294
  }
283
295
  args[fieldName] = { type: fieldType };