@aws-amplify/graphql-transformer-core
Advanced tools
Comparing version
@@ -8,3 +8,2 @@ ## API Report File for "@aws-amplify/graphql-transformer-core" | ||
import { AmplifyDynamoDbModelDataSourceStrategy } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { APIIAMResourceProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { ApiKeyConfig } from 'aws-cdk-lib/aws-appsync'; | ||
@@ -41,2 +40,3 @@ import { AppSyncAuthConfiguration } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import * as iam from 'aws-cdk-lib/aws-iam'; | ||
import { IamResource } from 'aws-cdk-lib/aws-appsync'; | ||
import { IGrantable } from 'aws-cdk-lib/aws-iam'; | ||
@@ -101,2 +101,3 @@ import { InlineMappingTemplateProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { UnionTypeExtensionNode } from 'graphql'; | ||
import { Visibility } from 'aws-cdk-lib/aws-appsync'; | ||
@@ -103,0 +104,0 @@ // @public (undocumented) |
@@ -1,3 +0,3 @@ | ||
import { AssetProvider, APIIAMResourceProvider, GraphQLAPIProvider, TransformHostProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { ApiKeyConfig, AuthorizationConfig, AuthorizationType, GraphqlApiBase, LogConfig, CfnApiKey } from 'aws-cdk-lib/aws-appsync'; | ||
import { AssetProvider, GraphQLAPIProvider, TransformHostProvider } from '@aws-amplify/graphql-transformer-interfaces'; | ||
import { ApiKeyConfig, AuthorizationConfig, AuthorizationType, GraphqlApiBase, LogConfig, CfnApiKey, Visibility, IamResource } from 'aws-cdk-lib/aws-appsync'; | ||
import { Grant, IGrantable } from 'aws-cdk-lib/aws-iam'; | ||
@@ -14,10 +14,2 @@ import { CfnResource } from 'aws-cdk-lib'; | ||
} | ||
export declare class IamResource implements APIIAMResourceProvider { | ||
static custom(...arns: string[]): IamResource; | ||
static ofType(type: string, ...fields: string[]): IamResource; | ||
static all(): IamResource; | ||
private arns; | ||
private constructor(); | ||
resourceArns(api: GraphQLAPIProvider): string[]; | ||
} | ||
export type TransformerAPIProps = GraphqlApiProps & { | ||
@@ -44,2 +36,4 @@ readonly createApiKey?: boolean; | ||
readonly assetProvider: AssetProvider; | ||
readonly graphQLEndpointArn: string; | ||
readonly visibility: Visibility; | ||
private schemaResource; | ||
@@ -50,3 +44,3 @@ private api; | ||
constructor(scope: Construct, id: string, props: TransformerAPIProps); | ||
grant(grantee: IGrantable, resources: APIIAMResourceProvider, ...actions: string[]): Grant; | ||
grant(grantee: IGrantable, resources: IamResource, ...actions: string[]): Grant; | ||
grantQuery(grantee: IGrantable, ...fields: string[]): Grant; | ||
@@ -53,0 +47,0 @@ grantMutation(grantee: IGrantable, ...fields: string[]): Grant; |
@@ -26,3 +26,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GraphQLApi = exports.IamResource = void 0; | ||
exports.GraphQLApi = void 0; | ||
const aws_appsync_1 = require("aws-cdk-lib/aws-appsync"); | ||
@@ -35,29 +35,2 @@ const aws_iam_1 = require("aws-cdk-lib/aws-iam"); | ||
const utils_1 = require("./utils"); | ||
class IamResource { | ||
static custom(...arns) { | ||
if (arns.length === 0) { | ||
throw new Error('At least 1 custom ARN must be provided.'); | ||
} | ||
return new IamResource(arns); | ||
} | ||
static ofType(type, ...fields) { | ||
const arns = fields.length ? fields.map((field) => `types/${type}/fields/${field}`) : [`types/${type}/*`]; | ||
return new IamResource(arns); | ||
} | ||
static all() { | ||
return new IamResource(['*']); | ||
} | ||
constructor(arns) { | ||
this.arns = arns; | ||
} | ||
resourceArns(api) { | ||
return this.arns.map((arn) => aws_cdk_lib_1.Stack.of(api).formatArn({ | ||
service: 'appsync', | ||
resource: `apis/${api.apiId}`, | ||
arnFormat: aws_cdk_lib_1.ArnFormat.SLASH_RESOURCE_NAME, | ||
resourceName: `${arn}`, | ||
})); | ||
} | ||
} | ||
exports.IamResource = IamResource; | ||
class GraphQLApi extends aws_appsync_1.GraphqlApiBase { | ||
@@ -92,2 +65,4 @@ constructor(scope, id, props) { | ||
this.name = this.api.name; | ||
this.graphQLEndpointArn = this.api.attrGraphQlEndpointArn; | ||
this.visibility = this.api.visibility === 'PRIVATE' ? aws_appsync_1.Visibility.PRIVATE : aws_appsync_1.Visibility.GLOBAL; | ||
this.schema = (_a = props.schema) !== null && _a !== void 0 ? _a : new schema_asset_1.TransformerSchema(); | ||
@@ -126,9 +101,9 @@ this.assetProvider = props.assetProvider; | ||
grantQuery(grantee, ...fields) { | ||
return this.grant(grantee, IamResource.ofType('Query', ...fields), 'appsync:GraphQL'); | ||
return this.grant(grantee, aws_appsync_1.IamResource.ofType('Query', ...fields), 'appsync:GraphQL'); | ||
} | ||
grantMutation(grantee, ...fields) { | ||
return this.grant(grantee, IamResource.ofType('Mutation', ...fields), 'appsync:GraphQL'); | ||
return this.grant(grantee, aws_appsync_1.IamResource.ofType('Mutation', ...fields), 'appsync:GraphQL'); | ||
} | ||
grantSubscription(grantee, ...fields) { | ||
return this.grant(grantee, IamResource.ofType('Subscription', ...fields), 'appsync:GraphQL'); | ||
return this.grant(grantee, aws_appsync_1.IamResource.ofType('Subscription', ...fields), 'appsync:GraphQL'); | ||
} | ||
@@ -135,0 +110,0 @@ createAPIKey(config) { |
{ | ||
"name": "@aws-amplify/graphql-transformer-core", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A framework to transform from GraphQL SDL to AWS CloudFormation.", | ||
@@ -33,3 +33,3 @@ "repository": { | ||
"@aws-amplify/graphql-directives": "2.0.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "4.0.0", | ||
"@aws-amplify/graphql-transformer-interfaces": "4.0.1", | ||
"fs-extra": "^8.1.0", | ||
@@ -46,3 +46,3 @@ "graphql": "^15.5.0", | ||
"peerDependencies": { | ||
"aws-cdk-lib": "^2.129.0", | ||
"aws-cdk-lib": "^2.152.0", | ||
"constructs": "^10.3.0" | ||
@@ -93,3 +93,3 @@ }, | ||
}, | ||
"gitHead": "041c6d1c401f6c4648cf327c068bb7b0d91384d4" | ||
"gitHead": "ff03cb41e09b3a91d1095efe0fb20f3520a5d671" | ||
} |
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
645964
-0.24%5490
-0.56%+ Added
- Removed