@aws-amplify/graphql-transformer-core
Advanced tools
Comparing version 2.3.0-rds-3.0 to 2.3.0-rds-4.0
@@ -51,2 +51,3 @@ ## API Report File for "@aws-amplify/graphql-transformer-core" | ||
import { ObjectTypeExtensionNode } from 'graphql'; | ||
import { OperationTypeDefinitionNode } from 'graphql'; | ||
import { QueryFieldType } from '@aws-amplify/graphql-transformer-interfaces'; | ||
@@ -86,3 +87,3 @@ import { RDSLayerMapping } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { UnionTypeExtensionNode } from 'graphql'; | ||
import type { VpcSubnetConfig } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import type { VpcConfig } from '@aws-amplify/graphql-transformer-interfaces'; | ||
@@ -248,3 +249,3 @@ // @public (undocumented) | ||
// (undocumented) | ||
readonly sqlLambdaVpcConfig?: VpcSubnetConfig; | ||
readonly sqlLambdaVpcConfig?: VpcConfig; | ||
// Warning: (ae-forgotten-export) The symbol "StackMapping" needs to be exported by the entry point index.d.ts | ||
@@ -279,3 +280,3 @@ // | ||
// (undocumented) | ||
POSTGRESQL = "postgresql" | ||
POSTGRESQL = "postgres" | ||
} | ||
@@ -282,0 +283,0 @@ |
@@ -158,5 +158,6 @@ "use strict"; | ||
}; | ||
const subnetIds = vpc === null || vpc === void 0 ? void 0 : vpc.subnetAvailabilityZoneConfig.map((sn) => sn.SubnetId); | ||
if (vpc === null || vpc === void 0 ? void 0 : vpc.vpcId) { | ||
cfnFn.vpcConfig = { | ||
subnetIds: vpc === null || vpc === void 0 ? void 0 : vpc.subnetIds, | ||
subnetIds: subnetIds, | ||
securityGroupIds: vpc === null || vpc === void 0 ? void 0 : vpc.securityGroupIds, | ||
@@ -163,0 +164,0 @@ }; |
import { AppSyncAuthConfiguration, TransformerPluginProvider, TransformHostProvider, TransformerLog, NestedStackProvider, RDSLayerMapping, SynthParameters } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import type { AssetProvider, StackManagerProvider, TransformParameterProvider, TransformParameters, VpcSubnetConfig } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import type { AssetProvider, StackManagerProvider, TransformParameterProvider, TransformParameters, VpcConfig } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { DocumentNode } from 'graphql/language'; | ||
@@ -17,3 +17,3 @@ import { Construct } from 'constructs'; | ||
readonly resolverConfig?: ResolverConfig; | ||
readonly sqlLambdaVpcConfig?: VpcSubnetConfig; | ||
readonly sqlLambdaVpcConfig?: VpcConfig; | ||
readonly rdsLayerMapping?: RDSLayerMapping; | ||
@@ -20,0 +20,0 @@ } |
import { GraphQLAPIProvider, StackManagerProvider, TransformerContextOutputProvider, TransformerContextProvider, TransformerDataSourceManagerProvider, AppSyncAuthConfiguration, RDSLayerMapping, SynthParameters } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import type { AssetProvider, NestedStackProvider, TransformParameterProvider, TransformParameters, VpcSubnetConfig } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import type { AssetProvider, NestedStackProvider, TransformParameterProvider, TransformParameters, VpcConfig } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { TransformerContextMetadataProvider } from '@aws-amplify/graphql-transformer-interfaces/src/transformer-context/transformer-context-provider'; | ||
@@ -35,7 +35,7 @@ import { DocumentNode } from 'graphql'; | ||
readonly datasourceSecretParameterLocations: Map<string, RDSConnectionSecrets>; | ||
readonly sqlLambdaVpcConfig?: VpcSubnetConfig; | ||
readonly sqlLambdaVpcConfig?: VpcConfig; | ||
readonly rdsLayerMapping?: RDSLayerMapping; | ||
readonly customQueries: Map<string, string>; | ||
metadata: TransformerContextMetadata; | ||
constructor(scope: Construct, nestedStackProvider: NestedStackProvider, parameterProvider: TransformParameterProvider | undefined, assetProvider: AssetProvider, synthParameters: SynthParameters, inputDocument: DocumentNode, modelToDatasourceMap: Map<string, DatasourceType>, customQueries: Map<string, string>, stackMapping: Record<string, string>, authConfig: AppSyncAuthConfiguration, transformParameters: TransformParameters, resolverConfig?: ResolverConfig, datasourceSecretParameterLocations?: Map<string, RDSConnectionSecrets>, sqlLambdaVpcConfig?: VpcSubnetConfig, rdsLayerMapping?: RDSLayerMapping); | ||
constructor(scope: Construct, nestedStackProvider: NestedStackProvider, parameterProvider: TransformParameterProvider | undefined, assetProvider: AssetProvider, synthParameters: SynthParameters, inputDocument: DocumentNode, modelToDatasourceMap: Map<string, DatasourceType>, customQueries: Map<string, string>, stackMapping: Record<string, string>, authConfig: AppSyncAuthConfiguration, transformParameters: TransformParameters, resolverConfig?: ResolverConfig, datasourceSecretParameterLocations?: Map<string, RDSConnectionSecrets>, sqlLambdaVpcConfig?: VpcConfig, rdsLayerMapping?: RDSLayerMapping); | ||
get api(): GraphQLAPIProvider; | ||
@@ -42,0 +42,0 @@ getResolverConfig: <ResolverConfig_1>() => ResolverConfig_1 | undefined; |
@@ -1,2 +0,2 @@ | ||
import { DocumentNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InterfaceTypeExtensionNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, SchemaDefinitionNode, TypeDefinitionNode, TypeSystemDefinitionNode, UnionTypeDefinitionNode, UnionTypeExtensionNode } from 'graphql'; | ||
import { DocumentNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, FieldDefinitionNode, InputObjectTypeDefinitionNode, InputObjectTypeExtensionNode, InterfaceTypeExtensionNode, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, OperationTypeDefinitionNode, SchemaDefinitionNode, TypeDefinitionNode, TypeSystemDefinitionNode, UnionTypeDefinitionNode, UnionTypeExtensionNode } from 'graphql'; | ||
import { TransformerContextOutputProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
@@ -15,6 +15,12 @@ export declare function blankObject(name: string): ObjectTypeDefinitionNode; | ||
getQuery(): ObjectTypeDefinitionNode | undefined; | ||
addDefaultQuery(): void; | ||
ensureQuery(): void; | ||
getMutationTypeName(): string | undefined; | ||
getMutation(): ObjectTypeDefinitionNode | undefined; | ||
addDefaultMutation(): void; | ||
ensureMutation(): void; | ||
getSubscriptionTypeName(): string | undefined; | ||
getSubscription(): ObjectTypeDefinitionNode | undefined; | ||
addDefaultSubscription(): void; | ||
ensureSubscription(): void; | ||
addType(obj: TypeDefinitionNode): void; | ||
@@ -24,2 +30,3 @@ putType(obj: TypeDefinitionNode): void; | ||
hasType(name: string): boolean; | ||
addOperationType(operation: OperationTypeDefinitionNode): void; | ||
addObject(obj: ObjectTypeDefinitionNode): void; | ||
@@ -26,0 +33,0 @@ updateObject(obj: ObjectTypeDefinitionNode): void; |
@@ -69,27 +69,27 @@ "use strict"; | ||
} | ||
for (const ext of extensionNodes) { | ||
switch (ext.kind) { | ||
case graphql_1.Kind.OBJECT_TYPE_EXTENSION: | ||
this.addObjectExtension(ext); | ||
break; | ||
case graphql_1.Kind.INTERFACE_TYPE_EXTENSION: | ||
this.addInterfaceExtension(ext); | ||
break; | ||
case graphql_1.Kind.UNION_TYPE_EXTENSION: | ||
this.addUnionExtension(ext); | ||
break; | ||
case graphql_1.Kind.ENUM_TYPE_EXTENSION: | ||
this.addEnumExtension(ext); | ||
break; | ||
case graphql_1.Kind.INPUT_OBJECT_TYPE_EXTENSION: | ||
this.addInputExtension(ext); | ||
break; | ||
default: | ||
continue; | ||
} | ||
} | ||
for (const ext of extensionNodes) { | ||
switch (ext.kind) { | ||
case graphql_1.Kind.OBJECT_TYPE_EXTENSION: | ||
this.addObjectExtension(ext); | ||
break; | ||
case graphql_1.Kind.INTERFACE_TYPE_EXTENSION: | ||
this.addInterfaceExtension(ext); | ||
break; | ||
case graphql_1.Kind.UNION_TYPE_EXTENSION: | ||
this.addUnionExtension(ext); | ||
break; | ||
case graphql_1.Kind.ENUM_TYPE_EXTENSION: | ||
this.addEnumExtension(ext); | ||
break; | ||
case graphql_1.Kind.INPUT_OBJECT_TYPE_EXTENSION: | ||
this.addInputExtension(ext); | ||
break; | ||
default: | ||
continue; | ||
} | ||
if (!this.getSchema()) { | ||
this.putSchema(defaultSchema_1.DEFAULT_SCHEMA_DEFINITION); | ||
} | ||
} | ||
if (!this.getSchema()) { | ||
this.putSchema(defaultSchema_1.DEFAULT_SCHEMA_DEFINITION); | ||
} | ||
} | ||
@@ -125,2 +125,10 @@ getTypeDefinitionsOfKind(kind) { | ||
} | ||
addDefaultQuery() { | ||
this.addOperationType(defaultSchema_1.DEFAULT_QUERY_OPERATION); | ||
} | ||
ensureQuery() { | ||
if (!this.getQueryTypeName()) { | ||
this.addDefaultQuery(); | ||
} | ||
} | ||
getMutationTypeName() { | ||
@@ -139,2 +147,10 @@ const schemaNode = this.getSchema(); | ||
} | ||
addDefaultMutation() { | ||
this.addOperationType(defaultSchema_1.DEFAULT_MUTATION_OPERATION); | ||
} | ||
ensureMutation() { | ||
if (!this.getMutationTypeName()) { | ||
this.addDefaultMutation(); | ||
} | ||
} | ||
getSubscriptionTypeName() { | ||
@@ -153,2 +169,10 @@ const schemaNode = this.getSchema(); | ||
} | ||
addDefaultSubscription() { | ||
this.addOperationType(defaultSchema_1.DEFAULT_SUBSCRIPTION_OPERATION); | ||
} | ||
ensureSubscription() { | ||
if (!this.getSubscriptionTypeName()) { | ||
this.addDefaultSubscription(); | ||
} | ||
} | ||
addType(obj) { | ||
@@ -169,2 +193,12 @@ if (this.nodeMap[obj.name.value]) { | ||
} | ||
addOperationType(operation) { | ||
const schemaNode = this.getSchema(); | ||
if (schemaNode.operationTypes.find((op) => op.operation === operation.operation)) { | ||
throw new Error(`Conflicting ${operation.operation} operation found.`); | ||
} | ||
else { | ||
const updatedSchema = TransformerOutput.makeSchema([...schemaNode.operationTypes, operation]); | ||
this.putSchema(updatedSchema); | ||
} | ||
} | ||
addObject(obj) { | ||
@@ -197,2 +231,3 @@ if (this.nodeMap[obj.name.value]) { | ||
addQueryFields(fields) { | ||
this.ensureQuery(); | ||
const queryTypeName = this.getQueryTypeName(); | ||
@@ -208,2 +243,3 @@ if (queryTypeName) { | ||
addMutationFields(fields) { | ||
this.ensureMutation(); | ||
const mutationTypeName = this.getMutationTypeName(); | ||
@@ -219,2 +255,3 @@ if (mutationTypeName) { | ||
addSubscriptionFields(fields) { | ||
this.ensureSubscription(); | ||
const subscriptionTypeName = this.getSubscriptionTypeName(); | ||
@@ -221,0 +258,0 @@ if (subscriptionTypeName) { |
@@ -27,3 +27,2 @@ "use strict"; | ||
exports.TransformerResolver = exports.ResolverManager = void 0; | ||
const aws_appsync_1 = require("aws-cdk-lib/aws-appsync"); | ||
const aws_cdk_lib_1 = require("aws-cdk-lib"); | ||
@@ -146,3 +145,3 @@ const graphql_transformer_common_1 = require("graphql-transformer-common"); | ||
this.synthesize = (context, api) => { | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; | ||
const scope = this.scope || context.stackManager.scope; | ||
@@ -240,12 +239,25 @@ this.ensureNoneDataSource(api); | ||
`; | ||
const hasIamAuth = [context.authConfig.defaultAuthentication, ...(context.authConfig.additionalAuthenticationProviders || [])].some((mode) => (mode === null || mode === void 0 ? void 0 : mode.authenticationType) === aws_appsync_1.AuthorizationType.IAM); | ||
if (hasIamAuth) { | ||
const authRole = context.synthParameters.authenticatedUserRoleName; | ||
const unauthRole = context.synthParameters.unauthenticatedUserRoleName; | ||
const account = aws_cdk_lib_1.Stack.of(context.stackManager.scope).account; | ||
const account = aws_cdk_lib_1.Stack.of(context.stackManager.scope).account; | ||
const authRole = context.synthParameters.authenticatedUserRoleName; | ||
if (authRole) { | ||
initResolver += (0, ts_dedent_1.dedent) `\n | ||
$util.qr($ctx.stash.put("authRole", "arn:aws:sts::${account}:assumed-role/${authRole}/CognitoIdentityCredentials")) | ||
`; | ||
} | ||
const unauthRole = context.synthParameters.unauthenticatedUserRoleName; | ||
if (unauthRole) { | ||
initResolver += (0, ts_dedent_1.dedent) `\n | ||
$util.qr($ctx.stash.put("unauthRole", "arn:aws:sts::${account}:assumed-role/${unauthRole}/CognitoIdentityCredentials")) | ||
`; | ||
} | ||
const identityPoolId = context.synthParameters.identityPoolId; | ||
if (identityPoolId) { | ||
initResolver += (0, ts_dedent_1.dedent) `\n | ||
$util.qr($ctx.stash.put("identityPoolId", "${identityPoolId}")) | ||
`; | ||
} | ||
const adminRoles = (_k = context.synthParameters.adminRoles) !== null && _k !== void 0 ? _k : []; | ||
initResolver += (0, ts_dedent_1.dedent) `\n | ||
$util.qr($ctx.stash.put("adminRoles", ${JSON.stringify(adminRoles)})) | ||
`; | ||
initResolver += '\n$util.toJson({})'; | ||
@@ -252,0 +264,0 @@ api.host.addResolver(this.typeName, this.fieldName, cdk_compat_1.MappingTemplate.inlineTemplateFromString(initResolver), cdk_compat_1.MappingTemplate.inlineTemplateFromString('$util.toJson($ctx.prev.result)'), this.resolverLogicalId, undefined, [...requestFns, dataSourceProviderFn, ...responseFns].map((fn) => fn.functionId), scope); |
import { TransformerSecrets } from '@aws-amplify/graphql-transformer-interfaces'; | ||
export declare enum ImportedRDSType { | ||
MYSQL = "mysql", | ||
POSTGRESQL = "postgresql" | ||
POSTGRESQL = "postgres" | ||
} | ||
@@ -6,0 +6,0 @@ export type ImportedDataSourceType = ImportedRDSType; |
@@ -7,3 +7,3 @@ "use strict"; | ||
ImportedRDSType["MYSQL"] = "mysql"; | ||
ImportedRDSType["POSTGRESQL"] = "postgresql"; | ||
ImportedRDSType["POSTGRESQL"] = "postgres"; | ||
})(ImportedRDSType = exports.ImportedRDSType || (exports.ImportedRDSType = {})); | ||
@@ -10,0 +10,0 @@ exports.RDS_SCHEMA_FILE_NAME = 'schema.rds.graphql'; |
@@ -1,3 +0,6 @@ | ||
import { SchemaDefinitionNode } from 'graphql'; | ||
import { SchemaDefinitionNode, OperationTypeDefinitionNode } from 'graphql'; | ||
export declare const DEFAULT_QUERY_OPERATION: OperationTypeDefinitionNode; | ||
export declare const DEFAULT_MUTATION_OPERATION: OperationTypeDefinitionNode; | ||
export declare const DEFAULT_SUBSCRIPTION_OPERATION: OperationTypeDefinitionNode; | ||
export declare const DEFAULT_SCHEMA_DEFINITION: SchemaDefinitionNode; | ||
//# sourceMappingURL=defaultSchema.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_SCHEMA_DEFINITION = void 0; | ||
exports.DEFAULT_SCHEMA_DEFINITION = exports.DEFAULT_SUBSCRIPTION_OPERATION = exports.DEFAULT_MUTATION_OPERATION = exports.DEFAULT_QUERY_OPERATION = void 0; | ||
const graphql_1 = require("graphql"); | ||
exports.DEFAULT_SCHEMA_DEFINITION = { | ||
kind: graphql_1.Kind.SCHEMA_DEFINITION, | ||
directives: [], | ||
operationTypes: [ | ||
{ | ||
kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION, | ||
operation: 'query', | ||
type: { | ||
kind: graphql_1.Kind.NAMED_TYPE, | ||
name: { | ||
kind: graphql_1.Kind.NAME, | ||
value: 'Query', | ||
}, | ||
}, | ||
exports.DEFAULT_QUERY_OPERATION = { | ||
kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION, | ||
operation: 'query', | ||
type: { | ||
kind: graphql_1.Kind.NAMED_TYPE, | ||
name: { | ||
kind: graphql_1.Kind.NAME, | ||
value: 'Query', | ||
}, | ||
{ | ||
kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION, | ||
operation: 'mutation', | ||
type: { | ||
kind: graphql_1.Kind.NAMED_TYPE, | ||
name: { | ||
kind: graphql_1.Kind.NAME, | ||
value: 'Mutation', | ||
}, | ||
}, | ||
}, | ||
}; | ||
exports.DEFAULT_MUTATION_OPERATION = { | ||
kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION, | ||
operation: 'mutation', | ||
type: { | ||
kind: graphql_1.Kind.NAMED_TYPE, | ||
name: { | ||
kind: graphql_1.Kind.NAME, | ||
value: 'Mutation', | ||
}, | ||
{ | ||
kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION, | ||
operation: 'subscription', | ||
type: { | ||
kind: graphql_1.Kind.NAMED_TYPE, | ||
name: { | ||
kind: graphql_1.Kind.NAME, | ||
value: 'Subscription', | ||
}, | ||
}, | ||
}, | ||
}; | ||
exports.DEFAULT_SUBSCRIPTION_OPERATION = { | ||
kind: graphql_1.Kind.OPERATION_TYPE_DEFINITION, | ||
operation: 'subscription', | ||
type: { | ||
kind: graphql_1.Kind.NAMED_TYPE, | ||
name: { | ||
kind: graphql_1.Kind.NAME, | ||
value: 'Subscription', | ||
}, | ||
], | ||
}, | ||
}; | ||
exports.DEFAULT_SCHEMA_DEFINITION = { | ||
kind: graphql_1.Kind.SCHEMA_DEFINITION, | ||
directives: [], | ||
operationTypes: [exports.DEFAULT_QUERY_OPERATION, exports.DEFAULT_MUTATION_OPERATION, exports.DEFAULT_SUBSCRIPTION_OPERATION], | ||
}; | ||
//# sourceMappingURL=defaultSchema.js.map |
{ | ||
"name": "@aws-amplify/graphql-transformer-core", | ||
"version": "2.3.0-rds-3.0", | ||
"version": "2.3.0-rds-4.0", | ||
"description": "A framework to transform from GraphQL SDL to AWS CloudFormation.", | ||
@@ -31,6 +31,6 @@ "repository": { | ||
"dependencies": { | ||
"@aws-amplify/graphql-transformer-interfaces": "3.3.0-rds-3.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "3.3.0-rds-4.0", | ||
"fs-extra": "^8.1.0", | ||
"graphql": "^15.5.0", | ||
"graphql-transformer-common": "4.26.0-rds-3.0", | ||
"graphql-transformer-common": "4.26.0-rds-4.0", | ||
"hjson": "^3.2.2", | ||
@@ -77,3 +77,3 @@ "lodash": "^4.17.21", | ||
}, | ||
"gitHead": "c1efd4e687969d2cb64361ee656b7ce99a5eebb8" | ||
"gitHead": "6061315de250612308d4517fe794d28a97d3a961" | ||
} |
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 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
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
572126
4976
+ Added@aws-amplify/graphql-transformer-interfaces@3.3.0-rds-4.0(transitive)
+ Addedgraphql-mapping-template@4.20.13-rds-4.0(transitive)
+ Addedgraphql-transformer-common@4.26.0-rds-4.0(transitive)
- Removed@aws-amplify/graphql-transformer-interfaces@3.3.0-rds-3.0(transitive)
- Removedgraphql-mapping-template@4.20.13-rds-3.0(transitive)
- Removedgraphql-transformer-common@4.26.0-rds-3.0(transitive)
Updated@aws-amplify/graphql-transformer-interfaces@3.3.0-rds-4.0