Socket
Socket
Sign inDemoInstall

@aws-amplify/graphql-model-transformer

Package Overview
Dependencies
57
Maintainers
9
Versions
408
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.9.0-gen2-release-0418.0 to 2.9.0-gen2-release-0418-2.0

4

API.md

@@ -24,2 +24,3 @@ ## API Report File for "@aws-amplify/graphql-model-transformer"

import { QueryFieldType } from '@aws-amplify/graphql-transformer-interfaces';
import { QuietReferenceNode } from 'graphql-mapping-template';
import { SQLLambdaModelDataSourceStrategy } from '@aws-amplify/graphql-transformer-interfaces';

@@ -51,2 +52,5 @@ import { SubscriptionFieldType } from '@aws-amplify/graphql-transformer-interfaces';

// @public (undocumented)
export const defaultAutoId: () => QuietReferenceNode;
// @public (undocumented)
export class DynamoDBModelVTLGenerator implements ModelVTLGenerator {

@@ -53,0 +57,0 @@ // (undocumented)

@@ -6,4 +6,8 @@ # Change Log

# [2.9.0-gen2-release-0418.0](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@2.8.0...@aws-amplify/graphql-model-transformer@2.9.0-gen2-release-0418.0) (2024-04-18)
# [2.9.0-gen2-release-0418-2.0](https://github.com/aws-amplify/amplify-category-api/compare/@aws-amplify/graphql-model-transformer@2.8.0...@aws-amplify/graphql-model-transformer@2.9.0-gen2-release-0418-2.0) (2024-04-18)
### Bug Fixes
- auto generated id when timestamps: null ([#2470](https://github.com/aws-amplify/amplify-category-api/issues/2470)) ([936a4f9](https://github.com/aws-amplify/amplify-category-api/commit/936a4f9b40ae21a7bd4250616c8d83835bb75784))
### Features

@@ -10,0 +14,0 @@

@@ -0,3 +1,5 @@

import { QuietReferenceNode } from 'graphql-mapping-template';
export declare const generatePostAuthExpression: (isSandboxModeEnabled: boolean, genericIamAccessEnabled: boolean | undefined) => string;
export declare const generateResolverKey: (typeName: string, fieldName: string) => string;
export declare const defaultAutoId: () => QuietReferenceNode;
//# sourceMappingURL=common.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateResolverKey = exports.generatePostAuthExpression = void 0;
exports.defaultAutoId = exports.generateResolverKey = exports.generatePostAuthExpression = void 0;
const graphql_mapping_template_1 = require("graphql-mapping-template");

@@ -28,2 +28,6 @@ const API_KEY = 'API Key Authorization';

exports.generateResolverKey = generateResolverKey;
const defaultAutoId = () => {
return (0, graphql_mapping_template_1.qref)((0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('ctx.stash.defaultValues.put'), (0, graphql_mapping_template_1.str)('id'), (0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('util.autoId'))));
};
exports.defaultAutoId = defaultAutoId;
//# sourceMappingURL=common.js.map

13

lib/resolvers/dynamodb/mutation.js

@@ -6,3 +6,4 @@ "use strict";

const graphql_transformer_common_1 = require("graphql-transformer-common");
const common_1 = require("./common");
const common_1 = require("../common");
const common_2 = require("./common");
const generateUpdateRequestTemplate = (modelName, isSyncEnabled) => {

@@ -74,3 +75,3 @@ const objectKeyVariable = 'ctx.stash.metadata.modelObjectKey';

(0, graphql_mapping_template_1.iff)((0, graphql_mapping_template_1.ref)('args.condition'), (0, graphql_mapping_template_1.qref)((0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('ctx.stash.conditions.add'), (0, graphql_mapping_template_1.ref)('args.condition')))),
(0, common_1.generateConditionSlot)('ctx.stash.conditions', 'Conditions'),
(0, common_2.generateConditionSlot)('ctx.stash.conditions', 'Conditions'),
(0, graphql_mapping_template_1.set)((0, graphql_mapping_template_1.ref)('UpdateItem'), (0, graphql_mapping_template_1.obj)({

@@ -119,3 +120,3 @@ version: (0, graphql_mapping_template_1.str)('2018-05-29'),

...generateKeyConditionTemplate(false),
(0, common_1.generateConditionSlot)('ctx.stash.conditions', 'Conditions'),
(0, common_2.generateConditionSlot)('ctx.stash.conditions', 'Conditions'),
(0, graphql_mapping_template_1.iff)((0, graphql_mapping_template_1.ref)('Conditions'), (0, graphql_mapping_template_1.compoundExpression)([

@@ -140,5 +141,7 @@ (0, graphql_mapping_template_1.iff)((0, graphql_mapping_template_1.ref)('keyConditionExprNames'), (0, graphql_mapping_template_1.qref)((0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('Conditions.expressionNames.putAll'), (0, graphql_mapping_template_1.ref)('keyConditionExprNames')))),

];
if (initializeIdField) {
statements.push((0, common_1.defaultAutoId)());
}
if (modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.timestamps) {
statements.push((0, graphql_mapping_template_1.set)((0, graphql_mapping_template_1.ref)('createdAt'), (0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('util.time.nowISO8601'))));
statements.push((0, graphql_mapping_template_1.qref)((0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('ctx.stash.defaultValues.put'), (0, graphql_mapping_template_1.str)('id'), (0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('util.autoId')))));
if (modelConfig.timestamps.createdAt) {

@@ -169,3 +172,3 @@ statements.push((0, graphql_mapping_template_1.qref)((0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('ctx.stash.defaultValues.put'), (0, graphql_mapping_template_1.str)(modelConfig.timestamps.createdAt), (0, graphql_mapping_template_1.ref)('createdAt'))));

(0, graphql_mapping_template_1.iff)((0, graphql_mapping_template_1.ref)('args.condition'), (0, graphql_mapping_template_1.qref)((0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('ctx.stash.conditions.add'), (0, graphql_mapping_template_1.ref)('args.condition')))),
(0, common_1.generateConditionSlot)('ctx.stash.conditions', 'Conditions'),
(0, common_2.generateConditionSlot)('ctx.stash.conditions', 'Conditions'),
(0, graphql_mapping_template_1.iff)((0, graphql_mapping_template_1.ref)('Conditions'), (0, graphql_mapping_template_1.compoundExpression)([

@@ -172,0 +175,0 @@ (0, graphql_mapping_template_1.iff)((0, graphql_mapping_template_1.ref)('keyConditionExprNames'), (0, graphql_mapping_template_1.qref)((0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('Conditions.expressionNames.putAll'), (0, graphql_mapping_template_1.ref)('keyConditionExprNames')))),

@@ -5,2 +5,3 @@ "use strict";

const graphql_mapping_template_1 = require("graphql-mapping-template");
const common_1 = require("../common");
const resolver_1 = require("./resolver");

@@ -11,7 +12,7 @@ const generateCreateInitSlotTemplate = (modelConfig, initializeIdField) => {

];
if (initializeIdField) {
statements.push((0, common_1.defaultAutoId)());
}
if (modelConfig === null || modelConfig === void 0 ? void 0 : modelConfig.timestamps) {
statements.push((0, graphql_mapping_template_1.set)((0, graphql_mapping_template_1.ref)('createdAt'), (0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('util.time.nowISO8601'))));
if (initializeIdField) {
statements.push((0, graphql_mapping_template_1.qref)((0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('ctx.stash.defaultValues.put'), (0, graphql_mapping_template_1.str)('id'), (0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('util.autoId')))));
}
if (modelConfig.timestamps.createdAt) {

@@ -18,0 +19,0 @@ statements.push((0, graphql_mapping_template_1.qref)((0, graphql_mapping_template_1.methodCall)((0, graphql_mapping_template_1.ref)('ctx.stash.defaultValues.put'), (0, graphql_mapping_template_1.str)(modelConfig.timestamps.createdAt), (0, graphql_mapping_template_1.ref)('createdAt'))));

@@ -92,3 +92,8 @@ "use strict";

};
const initializeIdField = !!type.fields.find((field) => field.name.value === 'id');
const outputType = ctx.output.getObject(type.name.value);
const initializeIdField = !!(outputType === null || outputType === void 0 ? void 0 : outputType.fields.find((field) => field.name.value === 'id' &&
((field.type.kind === 'NonNullType' &&
field.type.type.kind === 'NamedType' &&
(field.type.type.name.value === 'ID' || field.type.type.name.value === 'String')) ||
(field.type.kind === 'NamedType' && (field.type.name.value === 'ID' || field.type.name.value === 'String')))));
resolver.addToSlot('init', graphql_transformer_core_1.MappingTemplate.s3MappingTemplateFromString(vtlGenerator.generateCreateInitSlotTemplate(initSlotConfig, initializeIdField), `${typeName}.${fieldName}.{slotName}.{slotIndex}.req.vtl`));

@@ -95,0 +100,0 @@ }

{
"name": "@aws-amplify/graphql-model-transformer",
"version": "2.9.0-gen2-release-0418.0",
"version": "2.9.0-gen2-release-0418-2.0",
"description": "Amplify graphql @model transformer",

@@ -35,8 +35,8 @@ "repository": {

"dependencies": {
"@aws-amplify/graphql-directives": "1.1.0-gen2-release-0418.0",
"@aws-amplify/graphql-transformer-core": "2.6.1-gen2-release-0418.0",
"@aws-amplify/graphql-transformer-interfaces": "3.7.0-gen2-release-0418.0",
"@aws-amplify/graphql-directives": "1.1.0-gen2-release-0418-2.0",
"@aws-amplify/graphql-transformer-core": "2.6.1-gen2-release-0418-2.0",
"@aws-amplify/graphql-transformer-interfaces": "3.7.0-gen2-release-0418-2.0",
"graphql": "^15.5.0",
"graphql-mapping-template": "4.20.15",
"graphql-transformer-common": "4.30.1-gen2-release-0418.0"
"graphql-transformer-common": "4.30.1-gen2-release-0418-2.0"
},

@@ -48,3 +48,3 @@ "peerDependencies": {

"devDependencies": {
"@aws-amplify/graphql-transformer-test-utils": "0.5.1-gen2-release-0418.0",
"@aws-amplify/graphql-transformer-test-utils": "0.5.1-gen2-release-0418-2.0",
"@aws-sdk/client-dynamodb": "^3.431.0",

@@ -92,3 +92,3 @@ "@types/aws-lambda": "8.10.119",

},
"gitHead": "1c71771315848090d494ad0883d2bd634f78bdc0"
"gitHead": "1752c32dcd54a85370c3ea3f298e25fe25909d93"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc