@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.js CHANGED
@@ -13,7 +13,15 @@ var isIntegerType = (ast) => {
13
13
  const annotations = refinement.annotations;
14
14
  if (annotations) {
15
15
  const identifier = AST.getIdentifierAnnotation(refinement);
16
- if (identifier._tag === "Some" && identifier.value === "Int") {
16
+ if (identifier._tag === "Some") {
17
+ const id = identifier.value;
18
+ if (id === "Int" || id.includes("Int")) {
19
+ return true;
20
+ }
21
+ }
22
+ const JSONSchemaSymbol = /* @__PURE__ */ Symbol.for("effect/annotation/JSONSchema");
23
+ const jsonSchema = annotations[JSONSchemaSymbol];
24
+ if (jsonSchema && jsonSchema.type === "integer") {
17
25
  return true;
18
26
  }
19
27
  }
@@ -81,7 +89,8 @@ var toGraphQLType = (schema) => {
81
89
  if (fieldName === "_tag") continue;
82
90
  const fieldSchema = S2.make(field2.type);
83
91
  let fieldType = toGraphQLType(fieldSchema);
84
- if (!field2.isOptional) {
92
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
93
+ if (!field2.isOptional && !isOptionField) {
85
94
  fieldType = new GraphQLNonNull(fieldType);
86
95
  }
87
96
  fields[fieldName] = { type: fieldType };
@@ -157,7 +166,8 @@ var toGraphQLInputType = (schema) => {
157
166
  if (fieldName === "_tag") continue;
158
167
  const fieldSchema = S2.make(field2.type);
159
168
  let fieldType = toGraphQLInputType(fieldSchema);
160
- if (!field2.isOptional) {
169
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
170
+ if (!field2.isOptional && !isOptionField) {
161
171
  fieldType = new GraphQLNonNull(fieldType);
162
172
  }
163
173
  fields[fieldName] = { type: fieldType };
@@ -220,7 +230,8 @@ var toGraphQLObjectType = (name, schema, additionalFields) => {
220
230
  if (fieldName === "_tag") continue;
221
231
  const fieldSchema = S2.make(field2.type);
222
232
  let fieldType = toGraphQLType(fieldSchema);
223
- if (!field2.isOptional) {
233
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
234
+ if (!field2.isOptional && !isOptionField) {
224
235
  fieldType = new GraphQLNonNull(fieldType);
225
236
  }
226
237
  fields[fieldName] = { type: fieldType };
@@ -252,7 +263,8 @@ var toGraphQLArgs = (schema) => {
252
263
  if (fieldName === "_tag") continue;
253
264
  const fieldSchema = S2.make(field2.type);
254
265
  let fieldType = toGraphQLInputType(fieldSchema);
255
- if (!field2.isOptional) {
266
+ const isOptionField = isOptionTransformation(field2.type) || isOptionDeclaration(field2.type);
267
+ if (!field2.isOptional && !isOptionField) {
256
268
  fieldType = new GraphQLNonNull(fieldType);
257
269
  }
258
270
  args[fieldName] = { type: fieldType };