@aws-amplify/graphql-model-transformer
Advanced tools
Comparing version 0.3.1 to 0.3.2-beta.0
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.3.2-beta.0](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-model-transformer@0.3.1...@aws-amplify/graphql-model-transformer@0.3.2-beta.0) (2021-02-11) | ||
**Note:** Version bump only for package @aws-amplify/graphql-model-transformer | ||
## [0.3.1](https://github.com/aws-amplify/amplify-cli/compare/@aws-amplify/graphql-model-transformer@0.3.0...@aws-amplify/graphql-model-transformer@0.3.1) (2021-02-10) | ||
@@ -8,0 +16,0 @@ |
@@ -7,3 +7,3 @@ "use strict"; | ||
const object_definition_wrapper_1 = require("../wrappers/object-definition-wrapper"); | ||
exports.makeConditionFilterInput = (ctx, name, object) => { | ||
const makeConditionFilterInput = (ctx, name, object) => { | ||
const input = object_definition_wrapper_1.InputObjectDefinitionWrapper.create(name); | ||
@@ -32,3 +32,4 @@ const wrappedObject = new object_definition_wrapper_1.ObjectDefinationWrapper(object); | ||
}; | ||
exports.addModelConditionInputs = (ctx) => { | ||
exports.makeConditionFilterInput = makeConditionFilterInput; | ||
const addModelConditionInputs = (ctx) => { | ||
const conditionsInput = ['String', 'Int', 'Float', 'Boolean', 'ID'].map(scalarName => makeModelScalarFilterInputObject(scalarName, true)); | ||
@@ -44,2 +45,3 @@ conditionsInput.push(makeAttributeTypeEnum()); | ||
}; | ||
exports.addModelConditionInputs = addModelConditionInputs; | ||
function generateModelScalarFilterInputName(typeName, includeFilter) { | ||
@@ -53,3 +55,3 @@ const nameOverride = graphql_transformer_common_1.DEFAULT_SCALARS[typeName]; | ||
exports.generateModelScalarFilterInputName = generateModelScalarFilterInputName; | ||
exports.createEnumModelFilters = (ctx, type) => { | ||
const createEnumModelFilters = (ctx, type) => { | ||
const typeWrapper = new object_definition_wrapper_1.ObjectDefinationWrapper(type); | ||
@@ -63,2 +65,3 @@ const enumFields = typeWrapper.fields.filter(field => { | ||
}; | ||
exports.createEnumModelFilters = createEnumModelFilters; | ||
function makeModelScalarFilterInputObject(type, supportsConditions) { | ||
@@ -65,0 +68,0 @@ const name = generateModelScalarFilterInputName(type, !supportsConditions); |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -7,3 +7,3 @@ "use strict"; | ||
const common_1 = require("./common"); | ||
exports.makeUpdateInputField = (obj, modelDirectiveConfig, knownModelTypes) => { | ||
const makeUpdateInputField = (obj, modelDirectiveConfig, knownModelTypes) => { | ||
var _a; | ||
@@ -48,3 +48,4 @@ const objectWrapped = new object_definition_wrapper_1.ObjectDefinationWrapper(obj); | ||
}; | ||
exports.makeDeleteInputField = (type) => { | ||
exports.makeUpdateInputField = makeUpdateInputField; | ||
const makeDeleteInputField = (type) => { | ||
const name = graphql_transformer_common_1.toPascalCase(['Delete', type.name.value, 'input']); | ||
@@ -56,3 +57,4 @@ const inputField = object_definition_wrapper_1.InputObjectDefinitionWrapper.create(name); | ||
}; | ||
exports.makeCreateInputField = (obj, modelDirectiveConfig, knownModelTypes) => { | ||
exports.makeDeleteInputField = makeDeleteInputField; | ||
const makeCreateInputField = (obj, modelDirectiveConfig, knownModelTypes) => { | ||
var _a; | ||
@@ -96,3 +98,4 @@ const objectWrapped = new object_definition_wrapper_1.ObjectDefinationWrapper(obj); | ||
}; | ||
exports.makeMutationConditionInput = (ctx, name, object) => { | ||
exports.makeCreateInputField = makeCreateInputField; | ||
const makeMutationConditionInput = (ctx, name, object) => { | ||
const input = common_1.makeConditionFilterInput(ctx, name, object); | ||
@@ -105,2 +108,3 @@ const idField = input.fields.find(f => f.name === 'id' && f.getTypeName() === 'ID'); | ||
}; | ||
exports.makeMutationConditionInput = makeMutationConditionInput; | ||
//# sourceMappingURL=mutation.js.map |
@@ -6,6 +6,7 @@ "use strict"; | ||
const common_1 = require("./common"); | ||
exports.makeListQueryFilterInput = (ctx, name, object) => { | ||
const makeListQueryFilterInput = (ctx, name, object) => { | ||
return common_1.makeConditionFilterInput(ctx, name, object).serialize(); | ||
}; | ||
exports.makeListQueryModel = (type, modelName) => { | ||
exports.makeListQueryFilterInput = makeListQueryFilterInput; | ||
const makeListQueryModel = (type, modelName) => { | ||
const outputType = object_definition_wrapper_1.ObjectDefinationWrapper.create(modelName); | ||
@@ -16,2 +17,3 @@ outputType.addField(object_definition_wrapper_1.FieldWrapper.create('items', type.name.value, true, true)); | ||
}; | ||
exports.makeListQueryModel = makeListQueryModel; | ||
//# sourceMappingURL=query.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ModelTransformer = void 0; | ||
var graphql_model_transformer_1 = require("./graphql-model-transformer"); | ||
Object.defineProperty(exports, "ModelTransformer", { enumerable: true, get: function () { return graphql_model_transformer_1.ModelTransformer; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const graphql_mapping_template_1 = require("graphql-mapping-template"); | ||
exports.generateConditionSlot = (inputConditionObjectName, conditionOutputVariableName) => { | ||
const generateConditionSlot = (inputConditionObjectName, conditionOutputVariableName) => { | ||
const statements = [ | ||
@@ -24,3 +24,4 @@ graphql_mapping_template_1.comment('Start Condtion block'), | ||
}; | ||
exports.generateDefaultResponseMappingTemplate = () => { | ||
exports.generateConditionSlot = generateConditionSlot; | ||
const generateDefaultResponseMappingTemplate = () => { | ||
const statements = [ | ||
@@ -31,5 +32,7 @@ graphql_mapping_template_1.ifElse(graphql_mapping_template_1.ref('ctx.error'), graphql_mapping_template_1.methodCall(graphql_mapping_template_1.ref('util.error'), graphql_mapping_template_1.ref('ctx.error.message'), graphql_mapping_template_1.ref('ctx.error.type')), graphql_mapping_template_1.toJson(graphql_mapping_template_1.ref('ctx.result'))), | ||
}; | ||
exports.generateResolverKey = (typeName, fieldName) => { | ||
exports.generateDefaultResponseMappingTemplate = generateDefaultResponseMappingTemplate; | ||
const generateResolverKey = (typeName, fieldName) => { | ||
return `${typeName}.${fieldName}`; | ||
}; | ||
exports.generateResolverKey = generateResolverKey; | ||
//# sourceMappingURL=common.js.map |
@@ -10,3 +10,3 @@ "use strict"; | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
@@ -13,0 +13,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -6,3 +6,3 @@ "use strict"; | ||
const common_1 = require("./common"); | ||
exports.generateUpdateRequestTemplate = (modelName) => { | ||
const generateUpdateRequestTemplate = (modelName) => { | ||
const objectKeyVariable = 'ctx.stash.metadata.modelObjetKey'; | ||
@@ -80,3 +80,4 @@ const keyFields = [graphql_mapping_template_1.str('id')]; | ||
}; | ||
exports.generateCreateRequestTemplate = (modelName) => { | ||
exports.generateUpdateRequestTemplate = generateUpdateRequestTemplate; | ||
const generateCreateRequestTemplate = (modelName) => { | ||
const statements = [ | ||
@@ -126,3 +127,4 @@ graphql_mapping_template_1.comment('Begin - KeyCondition'), | ||
}; | ||
exports.generateCreateInitSlotTemplate = (name, modelConfig) => { | ||
exports.generateCreateRequestTemplate = generateCreateRequestTemplate; | ||
const generateCreateInitSlotTemplate = (name, modelConfig) => { | ||
const statements = [ | ||
@@ -147,3 +149,4 @@ graphql_mapping_template_1.qref(graphql_mapping_template_1.methodCall(graphql_mapping_template_1.ref('ctx.stash.put'), graphql_mapping_template_1.str('defaultValues'), graphql_mapping_template_1.methodCall(graphql_mapping_template_1.ref('util.defaultIfNull'), graphql_mapping_template_1.ref('ctx.stash.defaultValues'), graphql_mapping_template_1.obj({})))), | ||
}; | ||
exports.generateDeleteRequestTemplate = () => { | ||
exports.generateCreateInitSlotTemplate = generateCreateInitSlotTemplate; | ||
const generateDeleteRequestTemplate = () => { | ||
const statements = [ | ||
@@ -172,3 +175,4 @@ graphql_mapping_template_1.set(graphql_mapping_template_1.ref('DeleteRequest'), graphql_mapping_template_1.obj({ | ||
}; | ||
exports.generateUpdateInitSlotTemplate = (modelName, modelConfig) => { | ||
exports.generateDeleteRequestTemplate = generateDeleteRequestTemplate; | ||
const generateUpdateInitSlotTemplate = (modelName, modelConfig) => { | ||
const statements = [ | ||
@@ -189,2 +193,3 @@ graphql_mapping_template_1.qref(graphql_mapping_template_1.methodCall(graphql_mapping_template_1.ref('ctx.stash.put'), graphql_mapping_template_1.str('defaultValues'), graphql_mapping_template_1.methodCall(graphql_mapping_template_1.ref('util.defaultIfNull'), graphql_mapping_template_1.ref('ctx.stash.defaultValues'), graphql_mapping_template_1.obj({})))), | ||
}; | ||
exports.generateUpdateInitSlotTemplate = generateUpdateInitSlotTemplate; | ||
//# sourceMappingURL=mutation.js.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const graphql_mapping_template_1 = require("graphql-mapping-template"); | ||
exports.generateGetRequestTemplate = () => { | ||
const generateGetRequestTemplate = () => { | ||
const statements = [ | ||
@@ -15,3 +15,4 @@ graphql_mapping_template_1.set(graphql_mapping_template_1.ref('GetRequest'), graphql_mapping_template_1.obj({ version: graphql_mapping_template_1.str('2018-05-29'), operation: graphql_mapping_template_1.str('GetItem') })), | ||
}; | ||
exports.generateListRequestTemplate = () => { | ||
exports.generateGetRequestTemplate = generateGetRequestTemplate; | ||
const generateListRequestTemplate = () => { | ||
const requestVariable = 'ListRequest'; | ||
@@ -45,2 +46,3 @@ const modelQueryObj = 'ctx.stash.modelQuery'; | ||
}; | ||
exports.generateListRequestTemplate = generateListRequestTemplate; | ||
//# sourceMappingURL=query.js.map |
@@ -5,10 +5,12 @@ "use strict"; | ||
const graphql_mapping_template_1 = require("graphql-mapping-template"); | ||
exports.generateSubscriptionRequestTemplate = () => { | ||
const generateSubscriptionRequestTemplate = () => { | ||
const statements = [graphql_mapping_template_1.toJson(graphql_mapping_template_1.obj({ version: graphql_mapping_template_1.str('2018-05-29'), payload: graphql_mapping_template_1.obj({}) }))]; | ||
return graphql_mapping_template_1.printBlock('Subscription Request template')(graphql_mapping_template_1.compoundExpression(statements)); | ||
}; | ||
exports.generateSubscriptionResponseTemplate = () => { | ||
exports.generateSubscriptionRequestTemplate = generateSubscriptionRequestTemplate; | ||
const generateSubscriptionResponseTemplate = () => { | ||
const statements = [graphql_mapping_template_1.toJson(graphql_mapping_template_1.nul())]; | ||
return graphql_mapping_template_1.printBlock('Subscription Resonse template')(graphql_mapping_template_1.compoundExpression(statements)); | ||
}; | ||
exports.generateSubscriptionResponseTemplate = generateSubscriptionResponseTemplate; | ||
//# sourceMappingURL=subscriptions.js.map |
{ | ||
"name": "@aws-amplify/graphql-model-transformer", | ||
"version": "0.3.1", | ||
"version": "0.3.2-beta.0", | ||
"description": "Amplfy graphql @model tranformer", | ||
@@ -26,4 +26,4 @@ "repository": { | ||
"dependencies": { | ||
"@aws-amplify/graphql-transformer-core": "0.3.1", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.3.0", | ||
"@aws-amplify/graphql-transformer-core": "0.3.2-beta.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "1.3.1-beta.0", | ||
"@aws-cdk/assets": "~1.72.0", | ||
@@ -56,3 +56,3 @@ "@aws-cdk/aws-applicationautoscaling": "~1.72.0", | ||
"graphql-mapping-template": "4.18.1", | ||
"graphql-transformer-common": "4.18.1", | ||
"graphql-transformer-common": "4.18.2-beta.0", | ||
"lodash": "^4.17.19" | ||
@@ -80,3 +80,3 @@ }, | ||
}, | ||
"gitHead": "67db4037eb63b37ae6bdc6394bc4da1606943f06" | ||
"gitHead": "91aed5dce72d5f325decc6f255b9f7f37c0dc73c" | ||
} |
@@ -18,3 +18,4 @@ import { | ||
NamedTypeNode, | ||
EnumTypeDefinitionNode} from 'graphql'; | ||
EnumTypeDefinitionNode, | ||
} from 'graphql'; | ||
import { DEFAULT_SCALARS } from 'graphql-transformer-common'; | ||
@@ -42,3 +43,2 @@ | ||
export class DirectiveWrapper { | ||
@@ -62,3 +62,3 @@ private arguments: ArgumentWrapper[] = []; | ||
const argValues = this.arguments.reduce( | ||
(acc: {}, arg: ArgumentWrapper) => ({ | ||
(acc: Record<string, any>, arg: ArgumentWrapper) => ({ | ||
...acc, | ||
@@ -65,0 +65,0 @@ [arg.name.value]: valueFromASTUntyped(arg.value), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
3876
1076824
+ Added@aws-amplify/graphql-transformer-core@0.3.2-beta.0(transitive)
+ Added@aws-amplify/graphql-transformer-interfaces@1.3.1-beta.0(transitive)
+ Addedgraphql-transformer-common@4.18.2-beta.0(transitive)
- Removed@aws-amplify/graphql-transformer-core@0.3.1(transitive)
- Removed@aws-amplify/graphql-transformer-interfaces@1.3.0(transitive)
- Removedgraphql-transformer-common@4.18.1(transitive)
Updated@aws-amplify/graphql-transformer-interfaces@1.3.1-beta.0