graphql-genie
Advanced tools
Comparing version 0.4.12 to 0.4.13
@@ -403,3 +403,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
case 'create': | ||
if ((isArray && isEmpty(record[field.name])) || !record[field.name]) { | ||
if (!record.hasOwnProperty(field.name)) { | ||
record[field.name] = new Date(); | ||
@@ -417,3 +417,3 @@ } | ||
update.replace = {}; | ||
if ((isArray && isEmpty(update.replace[field.name])) || !update.replace[field.name]) { | ||
if (!update.replace.hasOwnProperty(field.name)) { | ||
update.replace[field.name] = new Date(); | ||
@@ -420,0 +420,0 @@ } |
@@ -9,4 +9,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { GenerateUpdate } from './GenerateUpdate'; | ||
import { GraphQLObjectType, getNamedType, introspectionFromSchema, isObjectType, isScalarType, printType } from 'graphql'; | ||
import { GraphQLObjectType, getNamedType, getNullableType, introspectionFromSchema, isEnumType, isListType, isObjectType, isScalarType, printType } from 'graphql'; | ||
import { GenerateUpsert } from './GenerateUpsert'; | ||
import FortuneGraph from './FortuneGraph'; | ||
@@ -18,3 +18,3 @@ import { GenerateConnections } from './GenerateConnections'; | ||
import { assign, forOwn, get, isArray, isEmpty, isFunction, isPlainObject, isString, set } from 'lodash'; | ||
import { GenerateUpsert } from './GenerateUpsert'; | ||
import { GenerateUpdate } from './GenerateUpdate'; | ||
import { GraphQLSchemaBuilder } from './GraphQLSchemaBuilder'; | ||
@@ -340,6 +340,6 @@ import { getReturnType } from './GraphQLUtils'; | ||
const schemaFieldType = getNamedType(schemaField.type); | ||
if (merge || !isScalarType(schemaFieldType)) { | ||
if (merge || (!isScalarType(schemaFieldType) && !isEnumType(schemaFieldType))) { | ||
let currValue = object[fieldName]; | ||
if (!isEmpty(currValue)) { | ||
if (!isScalarType(schemaFieldType)) { | ||
if (!isScalarType(schemaFieldType) && !isEnumType(schemaFieldType)) { | ||
if (isArray(currValue)) { | ||
@@ -397,2 +397,5 @@ // if it's an array then set | ||
} | ||
else { | ||
update[fieldName] = isListType(getNullableType(schemaField.type)) ? { set: currValue } : currValue; | ||
} | ||
} | ||
@@ -399,0 +402,0 @@ } |
{ | ||
"name": "graphql-genie", | ||
"version": "0.4.12", | ||
"version": "0.4.13", | ||
"description": "GraphQL Genie", | ||
@@ -5,0 +5,0 @@ "browser": "./lib/browser.umd.js", |
@@ -445,3 +445,3 @@ import { atob, btoa } from 'abab'; | ||
case 'create': | ||
if ((isArray && isEmpty(record[field.name])) || !record[field.name]) { | ||
if (!record.hasOwnProperty(field.name)) { | ||
record[field.name] = new Date(); | ||
@@ -458,3 +458,3 @@ } | ||
if (!('replace' in update)) update.replace = {}; | ||
if ((isArray && isEmpty(update.replace[field.name])) || !update.replace[field.name]) { | ||
if (!update.replace.hasOwnProperty(field.name)) { | ||
update.replace[field.name] = new Date(); | ||
@@ -461,0 +461,0 @@ } |
import { GenerateUpdate } from './GenerateUpdate'; | ||
import { GraphQLFieldResolver, GraphQLInputObjectType, GraphQLObjectType, GraphQLSchema, IntrospectionObjectType, IntrospectionQuery, IntrospectionType, getNamedType, introspectionFromSchema, isObjectType, isScalarType, printType } from 'graphql'; | ||
import { GraphQLFieldResolver, GraphQLInputObjectType, GraphQLObjectType, GraphQLSchema, IntrospectionObjectType, IntrospectionQuery, IntrospectionType, getNamedType, getNullableType, introspectionFromSchema, isEnumType, isListType, isObjectType, isScalarType, printType } from 'graphql'; | ||
import { GenerateUpsert } from './GenerateUpsert'; | ||
import FortuneGraph from './FortuneGraph'; | ||
@@ -10,3 +10,3 @@ import { GenerateConnections } from './GenerateConnections'; | ||
import { assign, forOwn, get, isArray, isEmpty, isFunction, isPlainObject, isString, set } from 'lodash'; | ||
import { GenerateUpsert } from './GenerateUpsert'; | ||
import { GenerateUpdate } from './GenerateUpdate'; | ||
import { DataResolver, FortuneOptions, GenerateConfig, GenericObject, GeniePlugin, GraphQLGenieOptions, TypeGenerator } from './GraphQLGenieInterfaces'; | ||
@@ -396,6 +396,6 @@ import { GraphQLSchemaBuilder } from './GraphQLSchemaBuilder'; | ||
const schemaFieldType = getNamedType(schemaField.type); | ||
if (merge || !isScalarType(schemaFieldType)) { | ||
if (merge || (!isScalarType(schemaFieldType) && !isEnumType(schemaFieldType))) { | ||
let currValue = object[fieldName]; | ||
if (!isEmpty(currValue)) { | ||
if (!isScalarType(schemaFieldType)) { | ||
if (!isScalarType(schemaFieldType) && !isEnumType(schemaFieldType)) { | ||
if (isArray(currValue)) { | ||
@@ -451,3 +451,4 @@ // if it's an array then set | ||
} | ||
} else { | ||
update[fieldName] = isListType(getNullableType(schemaField.type)) ? {set: currValue} : currValue; | ||
} | ||
@@ -454,0 +455,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1004000
20847