@ttoss/appsync-api 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/{chunk-PZ5B6I7R.js → chunk-QJWASMKO.js} +30 -11
- package/dist/esm/cli.js +1 -1
- package/dist/esm/index.js +10 -9
- package/dist/index.d.ts +14 -6
- package/dist/index.js +44 -23
- package/package.json +4 -4
- package/src/createApiTemplate.ts +49 -12
- package/src/createAppSyncResolverHandler.ts +6 -1
- package/src/index.ts +1 -1
|
@@ -539,7 +539,7 @@ var getPackageLambdaLayerStackName = (packageName) => {
|
|
|
539
539
|
// package.json
|
|
540
540
|
var package_default = {
|
|
541
541
|
name: "@ttoss/appsync-api",
|
|
542
|
-
version: "0.7.
|
|
542
|
+
version: "0.7.2",
|
|
543
543
|
description: "A library for building GraphQL APIs for AWS AppSync.",
|
|
544
544
|
license: "UNLICENSED",
|
|
545
545
|
author: "ttoss",
|
|
@@ -583,8 +583,8 @@ var package_default = {
|
|
|
583
583
|
},
|
|
584
584
|
devDependencies: {
|
|
585
585
|
"@ttoss/config": "^1.27.0",
|
|
586
|
-
"@types/aws-lambda": "^8.10.
|
|
587
|
-
carlin: "^1.22.
|
|
586
|
+
"@types/aws-lambda": "^8.10.110",
|
|
587
|
+
carlin: "^1.22.1",
|
|
588
588
|
graphql: "^16.6.0",
|
|
589
589
|
"graphql-compose": "^9.0.10"
|
|
590
590
|
},
|
|
@@ -616,10 +616,12 @@ var AppSyncLambdaFunctionLogicalId = "AppSyncLambdaFunction";
|
|
|
616
616
|
var AppSyncLambdaFunctionAppSyncDataSourceLogicalId = "AppSyncLambdaFunctionAppSyncDataSource";
|
|
617
617
|
var AppSyncGraphQLApiKeyLogicalId = "AppSyncGraphQLApiKey";
|
|
618
618
|
var createApiTemplate = ({
|
|
619
|
-
|
|
619
|
+
additionalAuthenticationProviders,
|
|
620
|
+
authenticationType = "AMAZON_COGNITO_USER_POOLS",
|
|
620
621
|
schemaComposer,
|
|
621
622
|
dataSource,
|
|
622
|
-
lambdaFunction
|
|
623
|
+
lambdaFunction,
|
|
624
|
+
userPoolConfig
|
|
623
625
|
}) => {
|
|
624
626
|
const sdl = schemaComposer.toSDL();
|
|
625
627
|
graphql.validateSchema(schemaComposer.buildSchema());
|
|
@@ -671,7 +673,7 @@ var createApiTemplate = ({
|
|
|
671
673
|
[AppSyncGraphQLApiLogicalId]: {
|
|
672
674
|
Type: "AWS::AppSync::GraphQLApi",
|
|
673
675
|
Properties: {
|
|
674
|
-
AuthenticationType:
|
|
676
|
+
AuthenticationType: authenticationType,
|
|
675
677
|
Name: {
|
|
676
678
|
"Fn::Join": [
|
|
677
679
|
":",
|
|
@@ -761,12 +763,16 @@ var createApiTemplate = ({
|
|
|
761
763
|
}
|
|
762
764
|
};
|
|
763
765
|
});
|
|
766
|
+
const apiKey = additionalAuthenticationProviders?.includes("API_KEY") || authenticationType === "API_KEY";
|
|
767
|
+
const cognitoUserPoolAuth = additionalAuthenticationProviders?.includes("AMAZON_COGNITO_USER_POOLS") || authenticationType === "AMAZON_COGNITO_USER_POOLS";
|
|
768
|
+
if (additionalAuthenticationProviders) {
|
|
769
|
+
template.Resources[AppSyncGraphQLApiLogicalId].Properties.AdditionalAuthenticationProviders = additionalAuthenticationProviders?.map((provider) => {
|
|
770
|
+
return {
|
|
771
|
+
AuthenticationType: provider
|
|
772
|
+
};
|
|
773
|
+
});
|
|
774
|
+
}
|
|
764
775
|
if (apiKey) {
|
|
765
|
-
template.Resources[AppSyncGraphQLApiLogicalId].Properties.AdditionalAuthenticationProvider = [
|
|
766
|
-
{
|
|
767
|
-
AuthenticationType: "API_KEY"
|
|
768
|
-
}
|
|
769
|
-
];
|
|
770
776
|
template.Resources[AppSyncGraphQLApiKeyLogicalId] = {
|
|
771
777
|
Type: "AWS::AppSync::ApiKey",
|
|
772
778
|
Properties: {
|
|
@@ -782,6 +788,19 @@ var createApiTemplate = ({
|
|
|
782
788
|
}
|
|
783
789
|
};
|
|
784
790
|
}
|
|
791
|
+
if (cognitoUserPoolAuth) {
|
|
792
|
+
if (!userPoolConfig) {
|
|
793
|
+
throw new Error(
|
|
794
|
+
"userPoolConfig is required when using AMAZON_COGNITO_USER_POOLS authentication."
|
|
795
|
+
);
|
|
796
|
+
}
|
|
797
|
+
template.Resources[AppSyncGraphQLApiLogicalId].Properties.UserPoolConfig = {
|
|
798
|
+
AppIdClientRegex: userPoolConfig.appIdClientRegex,
|
|
799
|
+
AwsRegion: userPoolConfig.awsRegion,
|
|
800
|
+
DefaultAction: userPoolConfig.defaultAction,
|
|
801
|
+
UserPoolId: userPoolConfig.userPoolId
|
|
802
|
+
};
|
|
803
|
+
}
|
|
785
804
|
if (lambdaFunction.environment?.variables) {
|
|
786
805
|
template.Resources[AppSyncLambdaFunctionLogicalId].Properties.Environment = {
|
|
787
806
|
Variables: lambdaFunction.environment.variables
|
package/dist/esm/cli.js
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
2
|
import {
|
|
3
3
|
createApiTemplate
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QJWASMKO.js";
|
|
5
5
|
import "./chunk-NQOARNEJ.js";
|
|
6
6
|
|
|
7
|
-
// src/index.ts
|
|
8
|
-
import { schemaComposer } from "graphql-compose";
|
|
9
|
-
|
|
10
7
|
// src/createAppSyncResolverHandler.ts
|
|
11
8
|
var createAppSyncResolverHandler = ({
|
|
12
|
-
schemaComposer
|
|
9
|
+
schemaComposer
|
|
13
10
|
}) => {
|
|
14
11
|
return async (event, context) => {
|
|
15
12
|
const { info, arguments: args, source } = event;
|
|
16
13
|
const { parentTypeName, fieldName } = info;
|
|
17
|
-
const resolver =
|
|
18
|
-
return resolver(
|
|
14
|
+
const resolver = schemaComposer.getResolveMethods()[parentTypeName][fieldName];
|
|
15
|
+
return resolver(
|
|
16
|
+
source,
|
|
17
|
+
args,
|
|
18
|
+
{ ...context, identity: event.identity },
|
|
19
|
+
info
|
|
20
|
+
);
|
|
19
21
|
};
|
|
20
22
|
};
|
|
21
23
|
export {
|
|
22
24
|
createApiTemplate,
|
|
23
|
-
createAppSyncResolverHandler
|
|
24
|
-
schemaComposer
|
|
25
|
+
createAppSyncResolverHandler
|
|
25
26
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
import { SchemaComposer } from 'graphql-compose';
|
|
2
|
-
export { ResolverResolveParams, schemaComposer } from 'graphql-compose';
|
|
3
2
|
import { CloudFormationTemplate } from '@ttoss/cloudformation';
|
|
4
3
|
import { AppSyncResolverHandler as AppSyncResolverHandler$1 } from 'aws-lambda';
|
|
4
|
+
export { AppSyncIdentityCognito } from 'aws-lambda';
|
|
5
5
|
|
|
6
|
-
type
|
|
6
|
+
type StringOrImport = string | {
|
|
7
7
|
'Fn::ImportValue': string;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type AuthenticationType = 'AMAZON_COGNITO_USER_POOLS' | 'API_KEY';
|
|
10
|
+
declare const createApiTemplate: ({ additionalAuthenticationProviders, authenticationType, schemaComposer, dataSource, lambdaFunction, userPoolConfig, }: {
|
|
11
|
+
additionalAuthenticationProviders?: AuthenticationType[] | undefined;
|
|
12
|
+
authenticationType?: AuthenticationType | undefined;
|
|
11
13
|
schemaComposer: SchemaComposer<any>;
|
|
12
14
|
dataSource: {
|
|
13
|
-
roleArn:
|
|
15
|
+
roleArn: StringOrImport;
|
|
14
16
|
};
|
|
15
17
|
lambdaFunction: {
|
|
16
18
|
environment?: {
|
|
17
19
|
variables: Record<string, string>;
|
|
18
20
|
};
|
|
19
|
-
roleArn:
|
|
21
|
+
roleArn: StringOrImport;
|
|
20
22
|
};
|
|
23
|
+
userPoolConfig?: {
|
|
24
|
+
appIdClientRegex: StringOrImport;
|
|
25
|
+
awsRegion: StringOrImport;
|
|
26
|
+
defaultAction: 'ALLOW' | 'DENY';
|
|
27
|
+
userPoolId: StringOrImport;
|
|
28
|
+
} | undefined;
|
|
21
29
|
}) => CloudFormationTemplate;
|
|
22
30
|
|
|
23
31
|
type AppSyncResolverHandler<TArguments, TResult, TSource = Record<string, any> | null> = AppSyncResolverHandler$1<TArguments, TResult, TSource>;
|
package/dist/index.js
CHANGED
|
@@ -471,11 +471,9 @@ var require_tslib = __commonJS({
|
|
|
471
471
|
var src_exports = {};
|
|
472
472
|
__export(src_exports, {
|
|
473
473
|
createApiTemplate: () => createApiTemplate,
|
|
474
|
-
createAppSyncResolverHandler: () => createAppSyncResolverHandler
|
|
475
|
-
schemaComposer: () => import_graphql_compose2.schemaComposer
|
|
474
|
+
createAppSyncResolverHandler: () => createAppSyncResolverHandler
|
|
476
475
|
});
|
|
477
476
|
module.exports = __toCommonJS(src_exports);
|
|
478
|
-
var import_graphql_compose2 = require("graphql-compose");
|
|
479
477
|
|
|
480
478
|
// src/createApiTemplate.ts
|
|
481
479
|
var import_graphql_compose = require("graphql-compose");
|
|
@@ -572,7 +570,7 @@ var getPackageLambdaLayerStackName = (packageName) => {
|
|
|
572
570
|
// package.json
|
|
573
571
|
var package_default = {
|
|
574
572
|
name: "@ttoss/appsync-api",
|
|
575
|
-
version: "0.7.
|
|
573
|
+
version: "0.7.2",
|
|
576
574
|
description: "A library for building GraphQL APIs for AWS AppSync.",
|
|
577
575
|
license: "UNLICENSED",
|
|
578
576
|
author: "ttoss",
|
|
@@ -616,8 +614,8 @@ var package_default = {
|
|
|
616
614
|
},
|
|
617
615
|
devDependencies: {
|
|
618
616
|
"@ttoss/config": "^1.27.0",
|
|
619
|
-
"@types/aws-lambda": "^8.10.
|
|
620
|
-
carlin: "^1.22.
|
|
617
|
+
"@types/aws-lambda": "^8.10.110",
|
|
618
|
+
carlin: "^1.22.1",
|
|
621
619
|
graphql: "^16.6.0",
|
|
622
620
|
"graphql-compose": "^9.0.10"
|
|
623
621
|
},
|
|
@@ -649,14 +647,16 @@ var AppSyncLambdaFunctionLogicalId = "AppSyncLambdaFunction";
|
|
|
649
647
|
var AppSyncLambdaFunctionAppSyncDataSourceLogicalId = "AppSyncLambdaFunctionAppSyncDataSource";
|
|
650
648
|
var AppSyncGraphQLApiKeyLogicalId = "AppSyncGraphQLApiKey";
|
|
651
649
|
var createApiTemplate = ({
|
|
652
|
-
|
|
653
|
-
|
|
650
|
+
additionalAuthenticationProviders,
|
|
651
|
+
authenticationType = "AMAZON_COGNITO_USER_POOLS",
|
|
652
|
+
schemaComposer,
|
|
654
653
|
dataSource,
|
|
655
|
-
lambdaFunction
|
|
654
|
+
lambdaFunction,
|
|
655
|
+
userPoolConfig
|
|
656
656
|
}) => {
|
|
657
|
-
const sdl =
|
|
658
|
-
import_graphql_compose.graphql.validateSchema(
|
|
659
|
-
const resolveMethods =
|
|
657
|
+
const sdl = schemaComposer.toSDL();
|
|
658
|
+
import_graphql_compose.graphql.validateSchema(schemaComposer.buildSchema());
|
|
659
|
+
const resolveMethods = schemaComposer.getResolveMethods();
|
|
660
660
|
const resolveMethodsEntries = Object.entries(resolveMethods).flatMap(
|
|
661
661
|
([typeName, fieldResolvers]) => {
|
|
662
662
|
return Object.entries(fieldResolvers).map(([fieldName]) => {
|
|
@@ -704,7 +704,7 @@ var createApiTemplate = ({
|
|
|
704
704
|
[AppSyncGraphQLApiLogicalId]: {
|
|
705
705
|
Type: "AWS::AppSync::GraphQLApi",
|
|
706
706
|
Properties: {
|
|
707
|
-
AuthenticationType:
|
|
707
|
+
AuthenticationType: authenticationType,
|
|
708
708
|
Name: {
|
|
709
709
|
"Fn::Join": [
|
|
710
710
|
":",
|
|
@@ -794,12 +794,16 @@ var createApiTemplate = ({
|
|
|
794
794
|
}
|
|
795
795
|
};
|
|
796
796
|
});
|
|
797
|
+
const apiKey = additionalAuthenticationProviders?.includes("API_KEY") || authenticationType === "API_KEY";
|
|
798
|
+
const cognitoUserPoolAuth = additionalAuthenticationProviders?.includes("AMAZON_COGNITO_USER_POOLS") || authenticationType === "AMAZON_COGNITO_USER_POOLS";
|
|
799
|
+
if (additionalAuthenticationProviders) {
|
|
800
|
+
template.Resources[AppSyncGraphQLApiLogicalId].Properties.AdditionalAuthenticationProviders = additionalAuthenticationProviders?.map((provider) => {
|
|
801
|
+
return {
|
|
802
|
+
AuthenticationType: provider
|
|
803
|
+
};
|
|
804
|
+
});
|
|
805
|
+
}
|
|
797
806
|
if (apiKey) {
|
|
798
|
-
template.Resources[AppSyncGraphQLApiLogicalId].Properties.AdditionalAuthenticationProvider = [
|
|
799
|
-
{
|
|
800
|
-
AuthenticationType: "API_KEY"
|
|
801
|
-
}
|
|
802
|
-
];
|
|
803
807
|
template.Resources[AppSyncGraphQLApiKeyLogicalId] = {
|
|
804
808
|
Type: "AWS::AppSync::ApiKey",
|
|
805
809
|
Properties: {
|
|
@@ -815,6 +819,19 @@ var createApiTemplate = ({
|
|
|
815
819
|
}
|
|
816
820
|
};
|
|
817
821
|
}
|
|
822
|
+
if (cognitoUserPoolAuth) {
|
|
823
|
+
if (!userPoolConfig) {
|
|
824
|
+
throw new Error(
|
|
825
|
+
"userPoolConfig is required when using AMAZON_COGNITO_USER_POOLS authentication."
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
template.Resources[AppSyncGraphQLApiLogicalId].Properties.UserPoolConfig = {
|
|
829
|
+
AppIdClientRegex: userPoolConfig.appIdClientRegex,
|
|
830
|
+
AwsRegion: userPoolConfig.awsRegion,
|
|
831
|
+
DefaultAction: userPoolConfig.defaultAction,
|
|
832
|
+
UserPoolId: userPoolConfig.userPoolId
|
|
833
|
+
};
|
|
834
|
+
}
|
|
818
835
|
if (lambdaFunction.environment?.variables) {
|
|
819
836
|
template.Resources[AppSyncLambdaFunctionLogicalId].Properties.Environment = {
|
|
820
837
|
Variables: lambdaFunction.environment.variables
|
|
@@ -825,18 +842,22 @@ var createApiTemplate = ({
|
|
|
825
842
|
|
|
826
843
|
// src/createAppSyncResolverHandler.ts
|
|
827
844
|
var createAppSyncResolverHandler = ({
|
|
828
|
-
schemaComposer
|
|
845
|
+
schemaComposer
|
|
829
846
|
}) => {
|
|
830
847
|
return async (event, context) => {
|
|
831
848
|
const { info, arguments: args, source } = event;
|
|
832
849
|
const { parentTypeName, fieldName } = info;
|
|
833
|
-
const resolver =
|
|
834
|
-
return resolver(
|
|
850
|
+
const resolver = schemaComposer.getResolveMethods()[parentTypeName][fieldName];
|
|
851
|
+
return resolver(
|
|
852
|
+
source,
|
|
853
|
+
args,
|
|
854
|
+
{ ...context, identity: event.identity },
|
|
855
|
+
info
|
|
856
|
+
);
|
|
835
857
|
};
|
|
836
858
|
};
|
|
837
859
|
// Annotate the CommonJS export names for ESM import in node:
|
|
838
860
|
0 && (module.exports = {
|
|
839
861
|
createApiTemplate,
|
|
840
|
-
createAppSyncResolverHandler
|
|
841
|
-
schemaComposer
|
|
862
|
+
createAppSyncResolverHandler
|
|
842
863
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/appsync-api",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "A library for building GraphQL APIs for AWS AppSync.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@ttoss/config": "^1.27.0",
|
|
47
|
-
"@types/aws-lambda": "^8.10.
|
|
48
|
-
"carlin": "^1.22.
|
|
47
|
+
"@types/aws-lambda": "^8.10.110",
|
|
48
|
+
"carlin": "^1.22.1",
|
|
49
49
|
"graphql": "^16.6.0",
|
|
50
50
|
"graphql-compose": "^9.0.10"
|
|
51
51
|
},
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
]
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "10be24617873f18eee0400543cace2a8e8c5ceee"
|
|
72
72
|
}
|
package/src/createApiTemplate.ts
CHANGED
|
@@ -14,28 +14,39 @@ const AppSyncLambdaFunctionAppSyncDataSourceLogicalId =
|
|
|
14
14
|
|
|
15
15
|
export const AppSyncGraphQLApiKeyLogicalId = 'AppSyncGraphQLApiKey';
|
|
16
16
|
|
|
17
|
-
type
|
|
17
|
+
type StringOrImport =
|
|
18
18
|
| string
|
|
19
19
|
| {
|
|
20
20
|
'Fn::ImportValue': string;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
+
type AuthenticationType = 'AMAZON_COGNITO_USER_POOLS' | 'API_KEY';
|
|
24
|
+
|
|
23
25
|
export const createApiTemplate = ({
|
|
24
|
-
|
|
26
|
+
additionalAuthenticationProviders,
|
|
27
|
+
authenticationType = 'AMAZON_COGNITO_USER_POOLS',
|
|
25
28
|
schemaComposer,
|
|
26
29
|
dataSource,
|
|
27
30
|
lambdaFunction,
|
|
31
|
+
userPoolConfig,
|
|
28
32
|
}: {
|
|
29
|
-
|
|
33
|
+
additionalAuthenticationProviders?: AuthenticationType[];
|
|
34
|
+
authenticationType?: AuthenticationType;
|
|
30
35
|
schemaComposer: SchemaComposer<any>;
|
|
31
36
|
dataSource: {
|
|
32
|
-
roleArn:
|
|
37
|
+
roleArn: StringOrImport;
|
|
33
38
|
};
|
|
34
39
|
lambdaFunction: {
|
|
35
40
|
environment?: {
|
|
36
41
|
variables: Record<string, string>;
|
|
37
42
|
};
|
|
38
|
-
roleArn:
|
|
43
|
+
roleArn: StringOrImport;
|
|
44
|
+
};
|
|
45
|
+
userPoolConfig?: {
|
|
46
|
+
appIdClientRegex: StringOrImport;
|
|
47
|
+
awsRegion: StringOrImport;
|
|
48
|
+
defaultAction: 'ALLOW' | 'DENY';
|
|
49
|
+
userPoolId: StringOrImport;
|
|
39
50
|
};
|
|
40
51
|
}): CloudFormationTemplate => {
|
|
41
52
|
/**
|
|
@@ -103,7 +114,7 @@ export const createApiTemplate = ({
|
|
|
103
114
|
[AppSyncGraphQLApiLogicalId]: {
|
|
104
115
|
Type: 'AWS::AppSync::GraphQLApi',
|
|
105
116
|
Properties: {
|
|
106
|
-
AuthenticationType:
|
|
117
|
+
AuthenticationType: authenticationType,
|
|
107
118
|
Name: {
|
|
108
119
|
'Fn::Join': [
|
|
109
120
|
':',
|
|
@@ -199,15 +210,26 @@ export const createApiTemplate = ({
|
|
|
199
210
|
};
|
|
200
211
|
});
|
|
201
212
|
|
|
202
|
-
|
|
213
|
+
const apiKey =
|
|
214
|
+
additionalAuthenticationProviders?.includes('API_KEY') ||
|
|
215
|
+
authenticationType === 'API_KEY';
|
|
216
|
+
|
|
217
|
+
const cognitoUserPoolAuth =
|
|
218
|
+
additionalAuthenticationProviders?.includes('AMAZON_COGNITO_USER_POOLS') ||
|
|
219
|
+
authenticationType === 'AMAZON_COGNITO_USER_POOLS';
|
|
220
|
+
|
|
221
|
+
if (additionalAuthenticationProviders) {
|
|
203
222
|
template.Resources[
|
|
204
223
|
AppSyncGraphQLApiLogicalId
|
|
205
|
-
].Properties.
|
|
206
|
-
{
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
224
|
+
].Properties.AdditionalAuthenticationProviders =
|
|
225
|
+
additionalAuthenticationProviders?.map((provider) => {
|
|
226
|
+
return {
|
|
227
|
+
AuthenticationType: provider,
|
|
228
|
+
};
|
|
229
|
+
});
|
|
230
|
+
}
|
|
210
231
|
|
|
232
|
+
if (apiKey) {
|
|
211
233
|
template.Resources[AppSyncGraphQLApiKeyLogicalId] = {
|
|
212
234
|
Type: 'AWS::AppSync::ApiKey',
|
|
213
235
|
Properties: {
|
|
@@ -226,6 +248,21 @@ export const createApiTemplate = ({
|
|
|
226
248
|
};
|
|
227
249
|
}
|
|
228
250
|
|
|
251
|
+
if (cognitoUserPoolAuth) {
|
|
252
|
+
if (!userPoolConfig) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
'userPoolConfig is required when using AMAZON_COGNITO_USER_POOLS authentication.'
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
template.Resources[AppSyncGraphQLApiLogicalId].Properties.UserPoolConfig = {
|
|
259
|
+
AppIdClientRegex: userPoolConfig.appIdClientRegex,
|
|
260
|
+
AwsRegion: userPoolConfig.awsRegion,
|
|
261
|
+
DefaultAction: userPoolConfig.defaultAction,
|
|
262
|
+
UserPoolId: userPoolConfig.userPoolId,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
|
|
229
266
|
if (lambdaFunction.environment?.variables) {
|
|
230
267
|
template.Resources[AppSyncLambdaFunctionLogicalId].Properties.Environment =
|
|
231
268
|
{
|
|
@@ -18,6 +18,11 @@ export const createAppSyncResolverHandler = ({
|
|
|
18
18
|
const resolver = (
|
|
19
19
|
schemaComposer.getResolveMethods()[parentTypeName] as any
|
|
20
20
|
)[fieldName];
|
|
21
|
-
return resolver(
|
|
21
|
+
return resolver(
|
|
22
|
+
source,
|
|
23
|
+
args,
|
|
24
|
+
{ ...context, identity: event.identity },
|
|
25
|
+
info
|
|
26
|
+
);
|
|
22
27
|
};
|
|
23
28
|
};
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { type ResolverResolveParams, schemaComposer } from 'graphql-compose';
|
|
2
1
|
export { createApiTemplate } from './createApiTemplate';
|
|
3
2
|
export {
|
|
4
3
|
type AppSyncResolverHandler,
|
|
5
4
|
createAppSyncResolverHandler,
|
|
6
5
|
} from './createAppSyncResolverHandler';
|
|
6
|
+
export type { AppSyncIdentityCognito } from 'aws-lambda';
|