@ttoss/appsync-api 0.21.2 → 0.22.1
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/index.js +35 -21
- package/dist/index.d.mts +49 -55
- package/dist/index.d.ts +49 -55
- package/dist/index.js +34 -21
- package/package.json +7 -7
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
4
|
+
value,
|
|
5
|
+
configurable: true
|
|
6
|
+
});
|
|
2
7
|
|
|
3
8
|
// src/createApiTemplate.ts
|
|
4
9
|
import { graphql } from "@ttoss/graphql-api";
|
|
@@ -7,7 +12,7 @@ var AppSyncGraphQLSchemaLogicalId = "AppSyncGraphQLSchema";
|
|
|
7
12
|
var AppSyncLambdaFunctionLogicalId = "AppSyncLambdaFunction";
|
|
8
13
|
var AppSyncLambdaFunctionAppSyncDataSourceLogicalId = "AppSyncLambdaFunctionAppSyncDataSource";
|
|
9
14
|
var AppSyncGraphQLApiKeyLogicalId = "AppSyncGraphQLApiKey";
|
|
10
|
-
var createApiTemplate = ({
|
|
15
|
+
var createApiTemplate = /* @__PURE__ */__name(({
|
|
11
16
|
additionalAuthenticationProviders,
|
|
12
17
|
authenticationType = "AMAZON_COGNITO_USER_POOLS",
|
|
13
18
|
schemaComposer,
|
|
@@ -57,8 +62,8 @@ var createApiTemplate = ({
|
|
|
57
62
|
},
|
|
58
63
|
Resources: {
|
|
59
64
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html#cfn-appsync-graphqlapi-name
|
|
66
|
+
*/
|
|
62
67
|
[AppSyncGraphQLApiLogicalId]: {
|
|
63
68
|
Type: "AWS::AppSync::GraphQLApi",
|
|
64
69
|
Properties: {
|
|
@@ -97,9 +102,9 @@ var createApiTemplate = ({
|
|
|
97
102
|
Role: lambdaFunction.roleArn,
|
|
98
103
|
Runtime: "nodejs22.x",
|
|
99
104
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
105
|
+
* https://docs.aws.amazon.com/general/latest/gr/appsync.html
|
|
106
|
+
* Request execution time for mutations, queries, and subscriptions: 30 seconds
|
|
107
|
+
*/
|
|
103
108
|
Timeout: 29
|
|
104
109
|
}
|
|
105
110
|
},
|
|
@@ -169,11 +174,14 @@ var createApiTemplate = ({
|
|
|
169
174
|
const apiKey = additionalAuthenticationProviders?.includes("API_KEY") || authenticationType === "API_KEY";
|
|
170
175
|
const cognitoUserPoolAuth = additionalAuthenticationProviders?.includes("AMAZON_COGNITO_USER_POOLS") || authenticationType === "AMAZON_COGNITO_USER_POOLS";
|
|
171
176
|
if (additionalAuthenticationProviders) {
|
|
172
|
-
template.Resources[AppSyncGraphQLApiLogicalId].Properties
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
template.Resources[AppSyncGraphQLApiLogicalId].Properties = {
|
|
178
|
+
...template.Resources[AppSyncGraphQLApiLogicalId].Properties,
|
|
179
|
+
AdditionalAuthenticationProviders: additionalAuthenticationProviders?.map(provider => {
|
|
180
|
+
return {
|
|
181
|
+
AuthenticationType: provider
|
|
182
|
+
};
|
|
183
|
+
})
|
|
184
|
+
};
|
|
177
185
|
}
|
|
178
186
|
if (apiKey) {
|
|
179
187
|
template.Resources[AppSyncGraphQLApiKeyLogicalId] = {
|
|
@@ -197,16 +205,22 @@ var createApiTemplate = ({
|
|
|
197
205
|
if (!userPoolConfig) {
|
|
198
206
|
throw new Error("userPoolConfig is required when using AMAZON_COGNITO_USER_POOLS authentication.");
|
|
199
207
|
}
|
|
200
|
-
template.Resources[AppSyncGraphQLApiLogicalId].Properties
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
template.Resources[AppSyncGraphQLApiLogicalId].Properties = {
|
|
209
|
+
...template.Resources[AppSyncGraphQLApiLogicalId].Properties,
|
|
210
|
+
UserPoolConfig: {
|
|
211
|
+
AppIdClientRegex: userPoolConfig.appIdClientRegex,
|
|
212
|
+
AwsRegion: userPoolConfig.awsRegion,
|
|
213
|
+
DefaultAction: userPoolConfig.defaultAction,
|
|
214
|
+
UserPoolId: userPoolConfig.userPoolId
|
|
215
|
+
}
|
|
205
216
|
};
|
|
206
217
|
}
|
|
207
218
|
if (lambdaFunction.environment?.variables) {
|
|
208
|
-
template.Resources[AppSyncLambdaFunctionLogicalId].Properties
|
|
209
|
-
|
|
219
|
+
template.Resources[AppSyncLambdaFunctionLogicalId].Properties = {
|
|
220
|
+
...template.Resources[AppSyncLambdaFunctionLogicalId].Properties,
|
|
221
|
+
Environment: {
|
|
222
|
+
Variables: lambdaFunction.environment.variables
|
|
223
|
+
}
|
|
210
224
|
};
|
|
211
225
|
}
|
|
212
226
|
if (customDomain) {
|
|
@@ -262,11 +276,11 @@ var createApiTemplate = ({
|
|
|
262
276
|
};
|
|
263
277
|
}
|
|
264
278
|
return template;
|
|
265
|
-
};
|
|
279
|
+
}, "createApiTemplate");
|
|
266
280
|
|
|
267
281
|
// src/createAppSyncResolverHandler.ts
|
|
268
282
|
import { buildSchema } from "@ttoss/graphql-api";
|
|
269
|
-
var createAppSyncResolverHandler = ({
|
|
283
|
+
var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
270
284
|
...buildSchemaInput
|
|
271
285
|
}) => {
|
|
272
286
|
return async (event, appSyncHandlerContext) => {
|
|
@@ -329,5 +343,5 @@ var createAppSyncResolverHandler = ({
|
|
|
329
343
|
}
|
|
330
344
|
return response;
|
|
331
345
|
};
|
|
332
|
-
};
|
|
346
|
+
}, "createAppSyncResolverHandler");
|
|
333
347
|
export { createApiTemplate, createAppSyncResolverHandler };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,79 +2,73 @@ import { SchemaComposer, BuildSchemaInput } from '@ttoss/graphql-api';
|
|
|
2
2
|
import { AppSyncResolverHandler as AppSyncResolverHandler$1 } from 'aws-lambda';
|
|
3
3
|
export { AppSyncIdentityCognito } from 'aws-lambda';
|
|
4
4
|
|
|
5
|
+
type CloudFormationRef = {
|
|
6
|
+
Ref: string;
|
|
7
|
+
};
|
|
8
|
+
type CloudFormationGetAtt = {
|
|
9
|
+
'Fn::GetAtt': [string, string];
|
|
10
|
+
};
|
|
11
|
+
type CloudFormationJoin = {
|
|
12
|
+
'Fn::Join': [string, (string | CloudFormationRef)[]];
|
|
13
|
+
};
|
|
14
|
+
type CloudFormationSub = {
|
|
15
|
+
'Fn::Sub': string | [string, Record<string, any>];
|
|
16
|
+
};
|
|
17
|
+
type CloudFormationSelect = {
|
|
18
|
+
'Fn::Select': [number, string[]];
|
|
19
|
+
};
|
|
20
|
+
type CloudFormationSplit = {
|
|
21
|
+
'Fn::Split': [string, string];
|
|
22
|
+
};
|
|
23
|
+
type CloudFormationIntrinsic = CloudFormationRef | CloudFormationGetAtt | CloudFormationJoin | CloudFormationSub | CloudFormationSelect | CloudFormationSplit;
|
|
24
|
+
type CloudFormationValue<T = any> = T | CloudFormationIntrinsic;
|
|
5
25
|
type Parameter = {
|
|
6
26
|
AllowedValues?: string[];
|
|
7
|
-
Default?: string | number;
|
|
27
|
+
Default?: string | number | boolean;
|
|
8
28
|
Description?: string;
|
|
9
|
-
Type:
|
|
29
|
+
Type: 'String' | 'Number' | 'List<Number>' | 'CommaDelimitedList' | 'AWS::EC2::KeyPair::KeyName' | 'AWS::EC2::SecurityGroup::Id' | 'AWS::EC2::Subnet::Id' | 'AWS::EC2::VPC::Id' | 'List<AWS::EC2::VPC::Id>' | 'List<AWS::EC2::SecurityGroup::Id>' | 'List<AWS::EC2::Subnet::Id>';
|
|
10
30
|
NoEcho?: boolean;
|
|
31
|
+
MinLength?: number;
|
|
32
|
+
MaxLength?: number;
|
|
33
|
+
MinValue?: number;
|
|
34
|
+
MaxValue?: number;
|
|
35
|
+
AllowedPattern?: string;
|
|
36
|
+
ConstraintDescription?: string;
|
|
11
37
|
};
|
|
12
|
-
type Parameters =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
type
|
|
38
|
+
type Parameters = Record<string, Parameter>;
|
|
39
|
+
type Condition = Record<string, any>;
|
|
40
|
+
type Conditions = Record<string, Condition>;
|
|
41
|
+
type BaseResource = {
|
|
16
42
|
Type: string;
|
|
17
|
-
DeletionPolicy?: 'Delete' | 'Retain';
|
|
43
|
+
DeletionPolicy?: 'Delete' | 'Retain' | 'Snapshot';
|
|
44
|
+
UpdateReplacePolicy?: 'Delete' | 'Retain' | 'Snapshot';
|
|
18
45
|
Description?: string;
|
|
19
|
-
DependsOn?: string
|
|
46
|
+
DependsOn?: string | string[];
|
|
20
47
|
Condition?: string;
|
|
21
|
-
|
|
48
|
+
Metadata?: Record<string, any>;
|
|
49
|
+
CreationPolicy?: Record<string, any>;
|
|
50
|
+
UpdatePolicy?: Record<string, any>;
|
|
22
51
|
};
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
PolicyDocument: {
|
|
26
|
-
Version: '2012-10-17';
|
|
27
|
-
Statement: {
|
|
28
|
-
Sid?: string;
|
|
29
|
-
Effect: 'Allow' | 'Deny';
|
|
30
|
-
Action: string | string[];
|
|
31
|
-
Resource: string | string[] | {
|
|
32
|
-
[key: string]: any;
|
|
33
|
-
} | {
|
|
34
|
-
[key: string]: any;
|
|
35
|
-
}[];
|
|
36
|
-
}[];
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
type IAMRoleResource = Resource & {
|
|
40
|
-
Type: 'AWS::IAM::Role';
|
|
41
|
-
Properties: {
|
|
42
|
-
AssumeRolePolicyDocument: {
|
|
43
|
-
Version: '2012-10-17';
|
|
44
|
-
Statement: {
|
|
45
|
-
Effect: 'Allow' | 'Deny';
|
|
46
|
-
Action: string;
|
|
47
|
-
Principal: any;
|
|
48
|
-
Condition?: {
|
|
49
|
-
[key: string]: any;
|
|
50
|
-
};
|
|
51
|
-
}[];
|
|
52
|
-
};
|
|
53
|
-
ManagedPolicyArns?: string[];
|
|
54
|
-
Path?: string;
|
|
55
|
-
Policies?: Policy[];
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
type Resources = {
|
|
59
|
-
[key: string]: IAMRoleResource | Resource;
|
|
52
|
+
type Resource = BaseResource & {
|
|
53
|
+
Properties?: Record<string, any>;
|
|
60
54
|
};
|
|
55
|
+
type Resources = Record<string, Resource>;
|
|
61
56
|
type Output = {
|
|
62
57
|
Description?: string;
|
|
63
|
-
Value:
|
|
58
|
+
Value: CloudFormationValue;
|
|
64
59
|
Export?: {
|
|
65
|
-
Name: string
|
|
60
|
+
Name: CloudFormationValue<string>;
|
|
66
61
|
};
|
|
62
|
+
Condition?: string;
|
|
67
63
|
};
|
|
68
|
-
type Outputs =
|
|
69
|
-
[key: string]: Output;
|
|
70
|
-
};
|
|
64
|
+
type Outputs = Record<string, Output>;
|
|
71
65
|
type CloudFormationTemplate = {
|
|
72
66
|
AWSTemplateFormatVersion: '2010-09-09';
|
|
73
|
-
Metadata?: any
|
|
67
|
+
Metadata?: Record<string, any>;
|
|
74
68
|
Description?: string;
|
|
75
|
-
Transform?: 'AWS::Serverless-2016-10-31';
|
|
76
|
-
Mappings?:
|
|
77
|
-
Conditions?:
|
|
69
|
+
Transform?: 'AWS::Serverless-2016-10-31' | string[];
|
|
70
|
+
Mappings?: Record<string, Record<string, Record<string, string | number>>>;
|
|
71
|
+
Conditions?: Conditions;
|
|
78
72
|
Parameters?: Parameters;
|
|
79
73
|
Resources: Resources;
|
|
80
74
|
Outputs?: Outputs;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,79 +2,73 @@ import { SchemaComposer, BuildSchemaInput } from '@ttoss/graphql-api';
|
|
|
2
2
|
import { AppSyncResolverHandler as AppSyncResolverHandler$1 } from 'aws-lambda';
|
|
3
3
|
export { AppSyncIdentityCognito } from 'aws-lambda';
|
|
4
4
|
|
|
5
|
+
type CloudFormationRef = {
|
|
6
|
+
Ref: string;
|
|
7
|
+
};
|
|
8
|
+
type CloudFormationGetAtt = {
|
|
9
|
+
'Fn::GetAtt': [string, string];
|
|
10
|
+
};
|
|
11
|
+
type CloudFormationJoin = {
|
|
12
|
+
'Fn::Join': [string, (string | CloudFormationRef)[]];
|
|
13
|
+
};
|
|
14
|
+
type CloudFormationSub = {
|
|
15
|
+
'Fn::Sub': string | [string, Record<string, any>];
|
|
16
|
+
};
|
|
17
|
+
type CloudFormationSelect = {
|
|
18
|
+
'Fn::Select': [number, string[]];
|
|
19
|
+
};
|
|
20
|
+
type CloudFormationSplit = {
|
|
21
|
+
'Fn::Split': [string, string];
|
|
22
|
+
};
|
|
23
|
+
type CloudFormationIntrinsic = CloudFormationRef | CloudFormationGetAtt | CloudFormationJoin | CloudFormationSub | CloudFormationSelect | CloudFormationSplit;
|
|
24
|
+
type CloudFormationValue<T = any> = T | CloudFormationIntrinsic;
|
|
5
25
|
type Parameter = {
|
|
6
26
|
AllowedValues?: string[];
|
|
7
|
-
Default?: string | number;
|
|
27
|
+
Default?: string | number | boolean;
|
|
8
28
|
Description?: string;
|
|
9
|
-
Type:
|
|
29
|
+
Type: 'String' | 'Number' | 'List<Number>' | 'CommaDelimitedList' | 'AWS::EC2::KeyPair::KeyName' | 'AWS::EC2::SecurityGroup::Id' | 'AWS::EC2::Subnet::Id' | 'AWS::EC2::VPC::Id' | 'List<AWS::EC2::VPC::Id>' | 'List<AWS::EC2::SecurityGroup::Id>' | 'List<AWS::EC2::Subnet::Id>';
|
|
10
30
|
NoEcho?: boolean;
|
|
31
|
+
MinLength?: number;
|
|
32
|
+
MaxLength?: number;
|
|
33
|
+
MinValue?: number;
|
|
34
|
+
MaxValue?: number;
|
|
35
|
+
AllowedPattern?: string;
|
|
36
|
+
ConstraintDescription?: string;
|
|
11
37
|
};
|
|
12
|
-
type Parameters =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
type
|
|
38
|
+
type Parameters = Record<string, Parameter>;
|
|
39
|
+
type Condition = Record<string, any>;
|
|
40
|
+
type Conditions = Record<string, Condition>;
|
|
41
|
+
type BaseResource = {
|
|
16
42
|
Type: string;
|
|
17
|
-
DeletionPolicy?: 'Delete' | 'Retain';
|
|
43
|
+
DeletionPolicy?: 'Delete' | 'Retain' | 'Snapshot';
|
|
44
|
+
UpdateReplacePolicy?: 'Delete' | 'Retain' | 'Snapshot';
|
|
18
45
|
Description?: string;
|
|
19
|
-
DependsOn?: string
|
|
46
|
+
DependsOn?: string | string[];
|
|
20
47
|
Condition?: string;
|
|
21
|
-
|
|
48
|
+
Metadata?: Record<string, any>;
|
|
49
|
+
CreationPolicy?: Record<string, any>;
|
|
50
|
+
UpdatePolicy?: Record<string, any>;
|
|
22
51
|
};
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
PolicyDocument: {
|
|
26
|
-
Version: '2012-10-17';
|
|
27
|
-
Statement: {
|
|
28
|
-
Sid?: string;
|
|
29
|
-
Effect: 'Allow' | 'Deny';
|
|
30
|
-
Action: string | string[];
|
|
31
|
-
Resource: string | string[] | {
|
|
32
|
-
[key: string]: any;
|
|
33
|
-
} | {
|
|
34
|
-
[key: string]: any;
|
|
35
|
-
}[];
|
|
36
|
-
}[];
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
type IAMRoleResource = Resource & {
|
|
40
|
-
Type: 'AWS::IAM::Role';
|
|
41
|
-
Properties: {
|
|
42
|
-
AssumeRolePolicyDocument: {
|
|
43
|
-
Version: '2012-10-17';
|
|
44
|
-
Statement: {
|
|
45
|
-
Effect: 'Allow' | 'Deny';
|
|
46
|
-
Action: string;
|
|
47
|
-
Principal: any;
|
|
48
|
-
Condition?: {
|
|
49
|
-
[key: string]: any;
|
|
50
|
-
};
|
|
51
|
-
}[];
|
|
52
|
-
};
|
|
53
|
-
ManagedPolicyArns?: string[];
|
|
54
|
-
Path?: string;
|
|
55
|
-
Policies?: Policy[];
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
type Resources = {
|
|
59
|
-
[key: string]: IAMRoleResource | Resource;
|
|
52
|
+
type Resource = BaseResource & {
|
|
53
|
+
Properties?: Record<string, any>;
|
|
60
54
|
};
|
|
55
|
+
type Resources = Record<string, Resource>;
|
|
61
56
|
type Output = {
|
|
62
57
|
Description?: string;
|
|
63
|
-
Value:
|
|
58
|
+
Value: CloudFormationValue;
|
|
64
59
|
Export?: {
|
|
65
|
-
Name: string
|
|
60
|
+
Name: CloudFormationValue<string>;
|
|
66
61
|
};
|
|
62
|
+
Condition?: string;
|
|
67
63
|
};
|
|
68
|
-
type Outputs =
|
|
69
|
-
[key: string]: Output;
|
|
70
|
-
};
|
|
64
|
+
type Outputs = Record<string, Output>;
|
|
71
65
|
type CloudFormationTemplate = {
|
|
72
66
|
AWSTemplateFormatVersion: '2010-09-09';
|
|
73
|
-
Metadata?: any
|
|
67
|
+
Metadata?: Record<string, any>;
|
|
74
68
|
Description?: string;
|
|
75
|
-
Transform?: 'AWS::Serverless-2016-10-31';
|
|
76
|
-
Mappings?:
|
|
77
|
-
Conditions?:
|
|
69
|
+
Transform?: 'AWS::Serverless-2016-10-31' | string[];
|
|
70
|
+
Mappings?: Record<string, Record<string, Record<string, string | number>>>;
|
|
71
|
+
Conditions?: Conditions;
|
|
78
72
|
Parameters?: Parameters;
|
|
79
73
|
Resources: Resources;
|
|
80
74
|
Outputs?: Outputs;
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,10 @@ var __defProp = Object.defineProperty;
|
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
9
|
+
value,
|
|
10
|
+
configurable: true
|
|
11
|
+
});
|
|
8
12
|
var __export = (target, all) => {
|
|
9
13
|
for (var name in all) __defProp(target, name, {
|
|
10
14
|
get: all[name],
|
|
@@ -39,7 +43,7 @@ var AppSyncGraphQLSchemaLogicalId = "AppSyncGraphQLSchema";
|
|
|
39
43
|
var AppSyncLambdaFunctionLogicalId = "AppSyncLambdaFunction";
|
|
40
44
|
var AppSyncLambdaFunctionAppSyncDataSourceLogicalId = "AppSyncLambdaFunctionAppSyncDataSource";
|
|
41
45
|
var AppSyncGraphQLApiKeyLogicalId = "AppSyncGraphQLApiKey";
|
|
42
|
-
var createApiTemplate = ({
|
|
46
|
+
var createApiTemplate = /* @__PURE__ */__name(({
|
|
43
47
|
additionalAuthenticationProviders,
|
|
44
48
|
authenticationType = "AMAZON_COGNITO_USER_POOLS",
|
|
45
49
|
schemaComposer,
|
|
@@ -89,8 +93,8 @@ var createApiTemplate = ({
|
|
|
89
93
|
},
|
|
90
94
|
Resources: {
|
|
91
95
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
* https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-appsync-graphqlapi.html#cfn-appsync-graphqlapi-name
|
|
97
|
+
*/
|
|
94
98
|
[AppSyncGraphQLApiLogicalId]: {
|
|
95
99
|
Type: "AWS::AppSync::GraphQLApi",
|
|
96
100
|
Properties: {
|
|
@@ -129,9 +133,9 @@ var createApiTemplate = ({
|
|
|
129
133
|
Role: lambdaFunction.roleArn,
|
|
130
134
|
Runtime: "nodejs22.x",
|
|
131
135
|
/**
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
* https://docs.aws.amazon.com/general/latest/gr/appsync.html
|
|
137
|
+
* Request execution time for mutations, queries, and subscriptions: 30 seconds
|
|
138
|
+
*/
|
|
135
139
|
Timeout: 29
|
|
136
140
|
}
|
|
137
141
|
},
|
|
@@ -201,11 +205,14 @@ var createApiTemplate = ({
|
|
|
201
205
|
const apiKey = additionalAuthenticationProviders?.includes("API_KEY") || authenticationType === "API_KEY";
|
|
202
206
|
const cognitoUserPoolAuth = additionalAuthenticationProviders?.includes("AMAZON_COGNITO_USER_POOLS") || authenticationType === "AMAZON_COGNITO_USER_POOLS";
|
|
203
207
|
if (additionalAuthenticationProviders) {
|
|
204
|
-
template.Resources[AppSyncGraphQLApiLogicalId].Properties
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
template.Resources[AppSyncGraphQLApiLogicalId].Properties = {
|
|
209
|
+
...template.Resources[AppSyncGraphQLApiLogicalId].Properties,
|
|
210
|
+
AdditionalAuthenticationProviders: additionalAuthenticationProviders?.map(provider => {
|
|
211
|
+
return {
|
|
212
|
+
AuthenticationType: provider
|
|
213
|
+
};
|
|
214
|
+
})
|
|
215
|
+
};
|
|
209
216
|
}
|
|
210
217
|
if (apiKey) {
|
|
211
218
|
template.Resources[AppSyncGraphQLApiKeyLogicalId] = {
|
|
@@ -229,16 +236,22 @@ var createApiTemplate = ({
|
|
|
229
236
|
if (!userPoolConfig) {
|
|
230
237
|
throw new Error("userPoolConfig is required when using AMAZON_COGNITO_USER_POOLS authentication.");
|
|
231
238
|
}
|
|
232
|
-
template.Resources[AppSyncGraphQLApiLogicalId].Properties
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
239
|
+
template.Resources[AppSyncGraphQLApiLogicalId].Properties = {
|
|
240
|
+
...template.Resources[AppSyncGraphQLApiLogicalId].Properties,
|
|
241
|
+
UserPoolConfig: {
|
|
242
|
+
AppIdClientRegex: userPoolConfig.appIdClientRegex,
|
|
243
|
+
AwsRegion: userPoolConfig.awsRegion,
|
|
244
|
+
DefaultAction: userPoolConfig.defaultAction,
|
|
245
|
+
UserPoolId: userPoolConfig.userPoolId
|
|
246
|
+
}
|
|
237
247
|
};
|
|
238
248
|
}
|
|
239
249
|
if (lambdaFunction.environment?.variables) {
|
|
240
|
-
template.Resources[AppSyncLambdaFunctionLogicalId].Properties
|
|
241
|
-
|
|
250
|
+
template.Resources[AppSyncLambdaFunctionLogicalId].Properties = {
|
|
251
|
+
...template.Resources[AppSyncLambdaFunctionLogicalId].Properties,
|
|
252
|
+
Environment: {
|
|
253
|
+
Variables: lambdaFunction.environment.variables
|
|
254
|
+
}
|
|
242
255
|
};
|
|
243
256
|
}
|
|
244
257
|
if (customDomain) {
|
|
@@ -294,11 +307,11 @@ var createApiTemplate = ({
|
|
|
294
307
|
};
|
|
295
308
|
}
|
|
296
309
|
return template;
|
|
297
|
-
};
|
|
310
|
+
}, "createApiTemplate");
|
|
298
311
|
|
|
299
312
|
// src/createAppSyncResolverHandler.ts
|
|
300
313
|
var import_graphql_api2 = require("@ttoss/graphql-api");
|
|
301
|
-
var createAppSyncResolverHandler = ({
|
|
314
|
+
var createAppSyncResolverHandler = /* @__PURE__ */__name(({
|
|
302
315
|
...buildSchemaInput
|
|
303
316
|
}) => {
|
|
304
317
|
return async (event, appSyncHandlerContext) => {
|
|
@@ -361,7 +374,7 @@ var createAppSyncResolverHandler = ({
|
|
|
361
374
|
}
|
|
362
375
|
return response;
|
|
363
376
|
};
|
|
364
|
-
};
|
|
377
|
+
}, "createAppSyncResolverHandler");
|
|
365
378
|
// Annotate the CommonJS export names for ESM import in node:
|
|
366
379
|
0 && (module.exports = {
|
|
367
380
|
createApiTemplate,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/appsync-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "A library for building GraphQL APIs for AWS AppSync.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
],
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ttoss/cloudformation": "^0.
|
|
27
|
+
"@ttoss/cloudformation": "^0.11.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"graphql": "^16.6.0",
|
|
31
|
-
"@ttoss/graphql-api": "^0.8.
|
|
31
|
+
"@ttoss/graphql-api": "^0.8.8"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/aws-lambda": "^8.10.
|
|
34
|
+
"@types/aws-lambda": "^8.10.152",
|
|
35
35
|
"graphql": "^16.11.0",
|
|
36
36
|
"graphql-shield": "^7.6.5",
|
|
37
37
|
"jest": "^30.0.4",
|
|
38
38
|
"tsup": "^8.5.0",
|
|
39
|
-
"@ttoss/
|
|
40
|
-
"@ttoss/
|
|
41
|
-
"@ttoss/
|
|
39
|
+
"@ttoss/config": "^1.35.6",
|
|
40
|
+
"@ttoss/graphql-api": "^0.8.8",
|
|
41
|
+
"@ttoss/ids": "^0.3.6"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"api",
|