@reventlessdev/rescript-pulumi-aws 2.4.0-alpha.43
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/CHANGELOG.md +366 -0
- package/LICENSE +202 -0
- package/README.md +19 -0
- package/package.json +52 -0
- package/rescript.json +27 -0
- package/scripts/bundle-resolvers.mjs +77 -0
- package/src/AWS/Aws_AvailabilityZone.res +9 -0
- package/src/AWS/Aws_AvailabilityZone.res.mjs +9 -0
- package/src/AWS/Aws_AvailabilityZone.resi +9 -0
- package/src/AWS/Aws_Aws.res +29 -0
- package/src/AWS/Aws_Aws.res.mjs +32 -0
- package/src/AWS/Aws_Common.res +2 -0
- package/src/AWS/Aws_Common.res.mjs +2 -0
- package/src/AWS/Aws_Provider.res +10 -0
- package/src/AWS/Aws_Provider.res.mjs +2 -0
- package/src/Acm/Acm.res +5 -0
- package/src/Acm/Acm.res.mjs +12 -0
- package/src/Acm/Acm_Certificate.res +27 -0
- package/src/Acm/Acm_Certificate.res.mjs +2 -0
- package/src/Acm/Acm_CertificateValidation.res +22 -0
- package/src/Acm/Acm_CertificateValidation.res.mjs +2 -0
- package/src/AppSync/AppSync.res +7 -0
- package/src/AppSync/AppSync.res.mjs +18 -0
- package/src/AppSync/AppSync_DataSource.res +93 -0
- package/src/AppSync/AppSync_DataSource.res.mjs +42 -0
- package/src/AppSync/AppSync_Function.res +75 -0
- package/src/AppSync/AppSync_Function.res.mjs +36 -0
- package/src/AppSync/AppSync_GraphQLApi.res +65 -0
- package/src/AppSync/AppSync_GraphQLApi.res.mjs +20 -0
- package/src/AppSync/AppSync_Resolver.res +229 -0
- package/src/AppSync/AppSync_Resolver.res.mjs +113 -0
- package/src/AppSync/AppSync_ResolverRuntime.res +214 -0
- package/src/AppSync/AppSync_ResolverRuntime.res.mjs +15 -0
- package/src/AppSync/AppSync_Resolver_Functions.res +998 -0
- package/src/AppSync/AppSync_Resolver_Functions.res.mjs +913 -0
- package/src/Aws.res +5 -0
- package/src/Aws.res.mjs +16 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_Api.res +92 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_Api.res.mjs +12 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_ChannelNamespace.res +81 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_ChannelNamespace.res.mjs +18 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_Resolver.res +39 -0
- package/src/AwsNative/AppSync/AwsNative_AppSync_Resolver.res.mjs +12 -0
- package/src/AwsNative/AwsNative.res +10 -0
- package/src/AwsNative/AwsNative.res.mjs +13 -0
- package/src/CloudFront/CloudFront.res +5 -0
- package/src/CloudFront/CloudFront.res.mjs +12 -0
- package/src/CloudFront/CloudFront_Distribution.res +81 -0
- package/src/CloudFront/CloudFront_Distribution.res.mjs +2 -0
- package/src/CloudFront/CloudFront_OriginAccessControl.res +20 -0
- package/src/CloudFront/CloudFront_OriginAccessControl.res.mjs +2 -0
- package/src/Cloudwatch/Cloudwatch.res +7 -0
- package/src/Cloudwatch/Cloudwatch.res.mjs +18 -0
- package/src/Cloudwatch/Cloudwatch_EventRule.res +52 -0
- package/src/Cloudwatch/Cloudwatch_EventRule.res.mjs +37 -0
- package/src/Cloudwatch/Cloudwatch_EventTarget.res +28 -0
- package/src/Cloudwatch/Cloudwatch_EventTarget.res.mjs +25 -0
- package/src/Cloudwatch/Cloudwatch_LogGroup.res +14 -0
- package/src/Cloudwatch/Cloudwatch_LogGroup.res.mjs +2 -0
- package/src/Cloudwatch/Cloudwatch_LogMetricFilter.res +28 -0
- package/src/Cloudwatch/Cloudwatch_LogMetricFilter.res.mjs +2 -0
- package/src/Cognito/Cognito.res +8 -0
- package/src/Cognito/Cognito.res.mjs +21 -0
- package/src/Cognito/Cognito_IdentityPool.res +148 -0
- package/src/Cognito/Cognito_IdentityPool.res.mjs +65 -0
- package/src/Cognito/Cognito_IdentityPoolRoleAttachment.res +18 -0
- package/src/Cognito/Cognito_IdentityPoolRoleAttachment.res.mjs +2 -0
- package/src/Cognito/Cognito_UserGroup.res +16 -0
- package/src/Cognito/Cognito_UserGroup.res.mjs +2 -0
- package/src/Cognito/Cognito_UserPool.res +125 -0
- package/src/Cognito/Cognito_UserPool.res.mjs +44 -0
- package/src/Cognito/Cognito_UserPoolClient.res +33 -0
- package/src/Cognito/Cognito_UserPoolClient.res.mjs +2 -0
- package/src/DynamoDb/DynamoDb.res +5 -0
- package/src/DynamoDb/DynamoDb.res.mjs +12 -0
- package/src/DynamoDb/DynamoDb_Stream.res +41 -0
- package/src/DynamoDb/DynamoDb_Stream.res.mjs +2 -0
- package/src/DynamoDb/DynamoDb_Table.res +66 -0
- package/src/DynamoDb/DynamoDb_Table.res.mjs +2 -0
- package/src/EC2/EC2.res +13 -0
- package/src/EC2/EC2.res.mjs +36 -0
- package/src/EC2/EC2_Common.res +13 -0
- package/src/EC2/EC2_Common.res.mjs +22 -0
- package/src/EC2/EC2_DefaultSecurityGroup.res +22 -0
- package/src/EC2/EC2_DefaultSecurityGroup.res.mjs +19 -0
- package/src/EC2/EC2_Eip.res +24 -0
- package/src/EC2/EC2_Eip.res.mjs +18 -0
- package/src/EC2/EC2_InternetGateway.res +25 -0
- package/src/EC2/EC2_InternetGateway.res.mjs +18 -0
- package/src/EC2/EC2_NatGateway.res +30 -0
- package/src/EC2/EC2_NatGateway.res.mjs +18 -0
- package/src/EC2/EC2_RouteTable.res +49 -0
- package/src/EC2/EC2_RouteTable.res.mjs +38 -0
- package/src/EC2/EC2_RouteTableAssociation.res +30 -0
- package/src/EC2/EC2_RouteTableAssociation.res.mjs +18 -0
- package/src/EC2/EC2_SecurityGroup.res +44 -0
- package/src/EC2/EC2_SecurityGroup.res.mjs +49 -0
- package/src/EC2/EC2_Subnet.res +31 -0
- package/src/EC2/EC2_Subnet.res.mjs +19 -0
- package/src/EC2/EC2_Vpc.res +25 -0
- package/src/EC2/EC2_Vpc.res.mjs +18 -0
- package/src/EC2/EC2_VpcEndpoint.res +43 -0
- package/src/EC2/EC2_VpcEndpoint.res.mjs +22 -0
- package/src/ECS/ECS.res +6 -0
- package/src/ECS/ECS.res.mjs +15 -0
- package/src/ECS/ECS_Cluster.res +10 -0
- package/src/ECS/ECS_Cluster.res.mjs +2 -0
- package/src/ECS/ECS_Container.res +58 -0
- package/src/ECS/ECS_Container.res.mjs +2 -0
- package/src/ECS/ECS_TaskDefinition.res +31 -0
- package/src/ECS/ECS_TaskDefinition.res.mjs +2 -0
- package/src/IAM/IAM.res +148 -0
- package/src/IAM/IAM.res.mjs +61 -0
- package/src/IAM/IAM_ManagedPolicies.res +32 -0
- package/src/IAM/IAM_ManagedPolicies.res.mjs +2 -0
- package/src/IAM/PolicyDocument.res +163 -0
- package/src/IAM/PolicyDocument.res.mjs +164 -0
- package/src/Kinesis/Kinesis.res +4 -0
- package/src/Kinesis/Kinesis.res.mjs +9 -0
- package/src/Kinesis/Kinesis_Stream.res +70 -0
- package/src/Kinesis/Kinesis_Stream.res.mjs +9 -0
- package/src/Lambda/EventSourceMapping.res +78 -0
- package/src/Lambda/EventSourceMapping.res.mjs +2 -0
- package/src/Lambda/FunctionUrl.res +41 -0
- package/src/Lambda/FunctionUrl.res.mjs +2 -0
- package/src/Lambda/Lambda.res +270 -0
- package/src/Lambda/Lambda.res.mjs +94 -0
- package/src/Route53/Route53.res +4 -0
- package/src/Route53/Route53.res.mjs +9 -0
- package/src/Route53/Route53_Record.res +36 -0
- package/src/Route53/Route53_Record.res.mjs +2 -0
- package/src/S3/S3.res +10 -0
- package/src/S3/S3.res.mjs +27 -0
- package/src/S3/S3_Bucket.res +236 -0
- package/src/S3/S3_Bucket.res.mjs +2 -0
- package/src/S3/S3_BucketAclV2.res +24 -0
- package/src/S3/S3_BucketAclV2.res.mjs +2 -0
- package/src/S3/S3_BucketObject.res +22 -0
- package/src/S3/S3_BucketObject.res.mjs +2 -0
- package/src/S3/S3_BucketOwnershipControls.res +19 -0
- package/src/S3/S3_BucketOwnershipControls.res.mjs +2 -0
- package/src/S3/S3_BucketPolicy.res +13 -0
- package/src/S3/S3_BucketPolicy.res.mjs +2 -0
- package/src/S3/S3_BucketPublicAccessBlock.res +16 -0
- package/src/S3/S3_BucketPublicAccessBlock.res.mjs +2 -0
- package/src/S3/S3_BucketV2.res +11 -0
- package/src/S3/S3_BucketV2.res.mjs +2 -0
- package/src/SES/SES.bs.js +11 -0
- package/src/SES/SES.res +25 -0
- package/src/SES/SES.res.mjs +12 -0
- package/src/SNS/SNS.res +5 -0
- package/src/SNS/SNS.res.mjs +12 -0
- package/src/SNS/SNS_Topic.res +71 -0
- package/src/SNS/SNS_Topic.res.mjs +2 -0
- package/src/SNS/SNS_TopicSubscription.res +21 -0
- package/src/SNS/SNS_TopicSubscription.res.mjs +2 -0
- package/src/SQS/SQS.res +5 -0
- package/src/SQS/SQS.res.mjs +12 -0
- package/src/SQS/SQS_Queue.res +92 -0
- package/src/SQS/SQS_Queue.res.mjs +19 -0
- package/src/SQS/SQS_QueuePolicy.res +13 -0
- package/src/SQS/SQS_QueuePolicy.res.mjs +2 -0
- package/src/SecretsManager/GetSecretVersion.res +37 -0
- package/src/SecretsManager/GetSecretVersion.res.mjs +23 -0
- package/src/example/CustomDomainExample.res +71 -0
- package/src/example/CustomDomainExample.res.mjs +57 -0
- package/tests/AppSync_Resolver_FunctionsTest.mjs +597 -0
- package/tests/__mocks__/appsync-utils.mjs +26 -0
- package/tests/resolverTestHelper.mjs +46 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/** @pulumi/aws/appsync/Resolver
|
|
2
|
+
see: https://www.pulumi.com/registry/packages/aws/api-docs/appsync/resolver
|
|
3
|
+
*/
|
|
4
|
+
type t = {
|
|
5
|
+
id: Pulumi.Output.t<string>,
|
|
6
|
+
arn: Pulumi.Output.t<string>,
|
|
7
|
+
@as("type") type_: Pulumi.Output.t<string>,
|
|
8
|
+
field: Pulumi.Output.t<string>,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
module Functions = AppSync_Resolver_Functions
|
|
12
|
+
|
|
13
|
+
type pipelineConfig = {functions: array<Pulumi.Input.t<string>>}
|
|
14
|
+
|
|
15
|
+
type kind = UNIT | PIPELINE
|
|
16
|
+
|
|
17
|
+
type runtime = {
|
|
18
|
+
name: string,
|
|
19
|
+
runtimeVersion: string,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** APPSYNC_JS runtime v1.0.0 — use with `code` instead of VTL templates. */
|
|
23
|
+
let appsyncJs: runtime = {name: "APPSYNC_JS", runtimeVersion: "1.0.0"}
|
|
24
|
+
|
|
25
|
+
type args = {
|
|
26
|
+
apiId: Pulumi.Input.t<string>,
|
|
27
|
+
dataSource?: Pulumi.Input.t<string>,
|
|
28
|
+
field: Pulumi.Input.t<string>,
|
|
29
|
+
requestTemplate?: Pulumi.Input.t<string>,
|
|
30
|
+
responseTemplate?: Pulumi.Input.t<string>,
|
|
31
|
+
@as("type") type_: Pulumi.Input.t<string>,
|
|
32
|
+
kind?: kind,
|
|
33
|
+
pipelineConfig?: Pulumi.Input.t<pipelineConfig>,
|
|
34
|
+
/** Bundled JS resolver code (APPSYNC_JS runtime). Replaces requestTemplate/responseTemplate. */
|
|
35
|
+
code?: Pulumi.Input.t<string>,
|
|
36
|
+
/** Runtime config — set to appsyncJs when using code. */
|
|
37
|
+
runtime?: Pulumi.Input.t<runtime>,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@module("@pulumi/aws") @scope("appsync") @new
|
|
41
|
+
external make: (~name: string, ~args: args, ~opts: option<Pulumi.CustomResourceOptions.t>=?) => t =
|
|
42
|
+
"Resolver"
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
|
|
46
|
+
type kind =
|
|
47
|
+
| Unit
|
|
48
|
+
| Pipeline(array(AppSync_Function.t));
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
type kind =
|
|
52
|
+
| Unit
|
|
53
|
+
| Pipeline(array(AppSync_Function.t));
|
|
54
|
+
let makeHelper =
|
|
55
|
+
(
|
|
56
|
+
~name,
|
|
57
|
+
~api: Pulumi.Output.t(PulumiAws.AppSync_GraphQLApi.t),
|
|
58
|
+
~dataSourceName,
|
|
59
|
+
~_type,
|
|
60
|
+
~field,
|
|
61
|
+
~requestTemplate,
|
|
62
|
+
~responseTemplate,
|
|
63
|
+
~kind,
|
|
64
|
+
~opts=?,
|
|
65
|
+
_,
|
|
66
|
+
) => {
|
|
67
|
+
let (kind, pipelineConfig) =
|
|
68
|
+
switch (kind) {
|
|
69
|
+
| Unit => (`UNIT, None)
|
|
70
|
+
| Pipeline(functions) => (
|
|
71
|
+
`PIPELINE,
|
|
72
|
+
Some(
|
|
73
|
+
PipelineConfig.make(
|
|
74
|
+
~functions=
|
|
75
|
+
functions->Array.map(f =>
|
|
76
|
+
f##functionId->Pulumi.Output.asInput
|
|
77
|
+
),
|
|
78
|
+
)
|
|
79
|
+
->Pulumi.Input.make,
|
|
80
|
+
),
|
|
81
|
+
)
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
make(
|
|
85
|
+
~name,
|
|
86
|
+
~args=
|
|
87
|
+
Args.make(
|
|
88
|
+
~apiId=
|
|
89
|
+
api->Pulumi.Output.flatMap(api => api##id)->Pulumi.Output.asInput,
|
|
90
|
+
~dataSource=dataSourceName,
|
|
91
|
+
~field,
|
|
92
|
+
~requestTemplate,
|
|
93
|
+
~responseTemplate,
|
|
94
|
+
~kind,
|
|
95
|
+
~pipelineConfig?,
|
|
96
|
+
~_type,
|
|
97
|
+
(),
|
|
98
|
+
),
|
|
99
|
+
~opts=
|
|
100
|
+
opts->Option.map(opts => {
|
|
101
|
+
let optsWithDelete = Object.assign(Object.make(), opts);
|
|
102
|
+
optsWithDelete##deleteBeforeReplace #= Some(true);
|
|
103
|
+
optsWithDelete;
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
let makeUnitResolver = (
|
|
110
|
+
~name,
|
|
111
|
+
~api: Pulumi.Output.t<PulumiAws.AppSync_GraphQLApi.t>,
|
|
112
|
+
~dataSourceName,
|
|
113
|
+
~type_,
|
|
114
|
+
~field,
|
|
115
|
+
~requestTemplate,
|
|
116
|
+
~responseTemplate,
|
|
117
|
+
~opts: option<Pulumi.CustomResourceOptions.t>=?,
|
|
118
|
+
) =>
|
|
119
|
+
make(
|
|
120
|
+
~name,
|
|
121
|
+
~args={
|
|
122
|
+
apiId: api->Pulumi.Output.flatMap(api => api.id)->Pulumi.Output.asInput,
|
|
123
|
+
dataSource: dataSourceName,
|
|
124
|
+
field,
|
|
125
|
+
requestTemplate,
|
|
126
|
+
responseTemplate,
|
|
127
|
+
kind: UNIT,
|
|
128
|
+
type_,
|
|
129
|
+
},
|
|
130
|
+
~opts=Some(
|
|
131
|
+
switch opts {
|
|
132
|
+
| Some(opts) => {...opts, deleteBeforeReplace: true}
|
|
133
|
+
| None => {deleteBeforeReplace: true}
|
|
134
|
+
},
|
|
135
|
+
),
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
let makePipelineResolver = (
|
|
139
|
+
~name,
|
|
140
|
+
~api: Pulumi.Output.t<PulumiAws.AppSync_GraphQLApi.t>,
|
|
141
|
+
~type_,
|
|
142
|
+
~field,
|
|
143
|
+
~requestTemplate,
|
|
144
|
+
~responseTemplate,
|
|
145
|
+
~functions: array<AppSync_Function.t>,
|
|
146
|
+
~opts: option<Pulumi.CustomResourceOptions.t>=?,
|
|
147
|
+
) =>
|
|
148
|
+
make(
|
|
149
|
+
~name,
|
|
150
|
+
~args={
|
|
151
|
+
apiId: api->Pulumi.Output.flatMap(api => api.id)->Pulumi.Output.asInput,
|
|
152
|
+
field,
|
|
153
|
+
requestTemplate,
|
|
154
|
+
responseTemplate,
|
|
155
|
+
kind: PIPELINE,
|
|
156
|
+
pipelineConfig: {
|
|
157
|
+
functions: functions->Array.map(f => f.functionId->Pulumi.Output.asInput),
|
|
158
|
+
}->Pulumi.Input.make,
|
|
159
|
+
type_,
|
|
160
|
+
},
|
|
161
|
+
~opts=Some(
|
|
162
|
+
switch opts {
|
|
163
|
+
| Some(opts) => {...opts, deleteBeforeReplace: true}
|
|
164
|
+
| None => {deleteBeforeReplace: true}
|
|
165
|
+
},
|
|
166
|
+
),
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
/** Create a unit resolver using the APPSYNC_JS runtime.
|
|
170
|
+
Pass bundled JS code via `~code` instead of VTL request/response templates. */
|
|
171
|
+
let makeUnitJsResolver = (
|
|
172
|
+
~name,
|
|
173
|
+
~api: Pulumi.Output.t<PulumiAws.AppSync_GraphQLApi.t>,
|
|
174
|
+
~dataSourceName,
|
|
175
|
+
~type_,
|
|
176
|
+
~field,
|
|
177
|
+
~code: Pulumi.Input.t<string>,
|
|
178
|
+
~opts: option<Pulumi.CustomResourceOptions.t>=?,
|
|
179
|
+
) =>
|
|
180
|
+
make(
|
|
181
|
+
~name,
|
|
182
|
+
~args={
|
|
183
|
+
apiId: api->Pulumi.Output.flatMap(api => api.id)->Pulumi.Output.asInput,
|
|
184
|
+
dataSource: dataSourceName,
|
|
185
|
+
field,
|
|
186
|
+
code,
|
|
187
|
+
runtime: appsyncJs->Pulumi.Input.make,
|
|
188
|
+
kind: UNIT,
|
|
189
|
+
type_,
|
|
190
|
+
},
|
|
191
|
+
~opts=Some(
|
|
192
|
+
switch opts {
|
|
193
|
+
| Some(opts) => {...opts, deleteBeforeReplace: true}
|
|
194
|
+
| None => {deleteBeforeReplace: true}
|
|
195
|
+
},
|
|
196
|
+
),
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
/** Create a pipeline resolver using the APPSYNC_JS runtime.
|
|
200
|
+
Pass bundled JS code for the before/after steps via `~code`. */
|
|
201
|
+
let makePipelineJsResolver = (
|
|
202
|
+
~name,
|
|
203
|
+
~api: Pulumi.Output.t<PulumiAws.AppSync_GraphQLApi.t>,
|
|
204
|
+
~type_,
|
|
205
|
+
~field,
|
|
206
|
+
~code: Pulumi.Input.t<string>,
|
|
207
|
+
~functions: array<AppSync_Function.t>,
|
|
208
|
+
~opts: option<Pulumi.CustomResourceOptions.t>=?,
|
|
209
|
+
) =>
|
|
210
|
+
make(
|
|
211
|
+
~name,
|
|
212
|
+
~args={
|
|
213
|
+
apiId: api->Pulumi.Output.flatMap(api => api.id)->Pulumi.Output.asInput,
|
|
214
|
+
field,
|
|
215
|
+
code,
|
|
216
|
+
runtime: appsyncJs->Pulumi.Input.make,
|
|
217
|
+
kind: PIPELINE,
|
|
218
|
+
pipelineConfig: {
|
|
219
|
+
functions: functions->Array.map(f => f.functionId->Pulumi.Output.asInput),
|
|
220
|
+
}->Pulumi.Input.make,
|
|
221
|
+
type_,
|
|
222
|
+
},
|
|
223
|
+
~opts=Some(
|
|
224
|
+
switch opts {
|
|
225
|
+
| Some(opts) => {...opts, deleteBeforeReplace: true}
|
|
226
|
+
| None => {deleteBeforeReplace: true}
|
|
227
|
+
},
|
|
228
|
+
),
|
|
229
|
+
)
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Aws from "@pulumi/aws";
|
|
4
|
+
import * as Output$Pulumi from "@reventlessdev/rescript-pulumi-pulumi/src/Output.res.mjs";
|
|
5
|
+
|
|
6
|
+
let appsyncJs = {
|
|
7
|
+
name: "APPSYNC_JS",
|
|
8
|
+
runtimeVersion: "1.0.0"
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function makeUnitResolver(name, api, dataSourceName, type_, field, requestTemplate, responseTemplate, opts) {
|
|
12
|
+
let tmp;
|
|
13
|
+
if (opts !== undefined) {
|
|
14
|
+
let newrecord = {...opts};
|
|
15
|
+
newrecord.deleteBeforeReplace = true;
|
|
16
|
+
tmp = newrecord;
|
|
17
|
+
} else {
|
|
18
|
+
tmp = {
|
|
19
|
+
deleteBeforeReplace: true
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
return new (Aws.appsync.Resolver)(name, {
|
|
23
|
+
apiId: Output$Pulumi.flatMap(api, api => api.id),
|
|
24
|
+
dataSource: dataSourceName,
|
|
25
|
+
field: field,
|
|
26
|
+
requestTemplate: requestTemplate,
|
|
27
|
+
responseTemplate: responseTemplate,
|
|
28
|
+
type: type_,
|
|
29
|
+
kind: "UNIT"
|
|
30
|
+
}, tmp);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function makePipelineResolver(name, api, type_, field, requestTemplate, responseTemplate, functions, opts) {
|
|
34
|
+
let tmp;
|
|
35
|
+
if (opts !== undefined) {
|
|
36
|
+
let newrecord = {...opts};
|
|
37
|
+
newrecord.deleteBeforeReplace = true;
|
|
38
|
+
tmp = newrecord;
|
|
39
|
+
} else {
|
|
40
|
+
tmp = {
|
|
41
|
+
deleteBeforeReplace: true
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return new (Aws.appsync.Resolver)(name, {
|
|
45
|
+
apiId: Output$Pulumi.flatMap(api, api => api.id),
|
|
46
|
+
field: field,
|
|
47
|
+
requestTemplate: requestTemplate,
|
|
48
|
+
responseTemplate: responseTemplate,
|
|
49
|
+
type: type_,
|
|
50
|
+
kind: "PIPELINE",
|
|
51
|
+
pipelineConfig: {
|
|
52
|
+
functions: functions.map(f => f.functionId)
|
|
53
|
+
}
|
|
54
|
+
}, tmp);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function makeUnitJsResolver(name, api, dataSourceName, type_, field, code, opts) {
|
|
58
|
+
let tmp;
|
|
59
|
+
if (opts !== undefined) {
|
|
60
|
+
let newrecord = {...opts};
|
|
61
|
+
newrecord.deleteBeforeReplace = true;
|
|
62
|
+
tmp = newrecord;
|
|
63
|
+
} else {
|
|
64
|
+
tmp = {
|
|
65
|
+
deleteBeforeReplace: true
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return new (Aws.appsync.Resolver)(name, {
|
|
69
|
+
apiId: Output$Pulumi.flatMap(api, api => api.id),
|
|
70
|
+
dataSource: dataSourceName,
|
|
71
|
+
field: field,
|
|
72
|
+
type: type_,
|
|
73
|
+
kind: "UNIT",
|
|
74
|
+
code: code,
|
|
75
|
+
runtime: appsyncJs
|
|
76
|
+
}, tmp);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function makePipelineJsResolver(name, api, type_, field, code, functions, opts) {
|
|
80
|
+
let tmp;
|
|
81
|
+
if (opts !== undefined) {
|
|
82
|
+
let newrecord = {...opts};
|
|
83
|
+
newrecord.deleteBeforeReplace = true;
|
|
84
|
+
tmp = newrecord;
|
|
85
|
+
} else {
|
|
86
|
+
tmp = {
|
|
87
|
+
deleteBeforeReplace: true
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return new (Aws.appsync.Resolver)(name, {
|
|
91
|
+
apiId: Output$Pulumi.flatMap(api, api => api.id),
|
|
92
|
+
field: field,
|
|
93
|
+
type: type_,
|
|
94
|
+
kind: "PIPELINE",
|
|
95
|
+
pipelineConfig: {
|
|
96
|
+
functions: functions.map(f => f.functionId)
|
|
97
|
+
},
|
|
98
|
+
code: code,
|
|
99
|
+
runtime: appsyncJs
|
|
100
|
+
}, tmp);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let Functions;
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
Functions,
|
|
107
|
+
appsyncJs,
|
|
108
|
+
makeUnitResolver,
|
|
109
|
+
makePipelineResolver,
|
|
110
|
+
makeUnitJsResolver,
|
|
111
|
+
makePipelineJsResolver,
|
|
112
|
+
}
|
|
113
|
+
/* @pulumi/aws Not a pure module */
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/** Bindings for @aws-appsync/utils and AppSync JS resolver context types.
|
|
2
|
+
Used in resolver source files compiled to APPSYNC_JS — not Pulumi deploy-time code.
|
|
3
|
+
|
|
4
|
+
Generated JS uses `import * as X from "@aws-appsync/utils"` which is equivalent to
|
|
5
|
+
the named-import form `import { util, runtime } from "@aws-appsync/utils"` since
|
|
6
|
+
AppSync provides the module as an object with named exports. When bundled with
|
|
7
|
+
esbuild (--external:@aws-appsync/utils), the import is preserved for AppSync runtime.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Context types
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
type error = {
|
|
15
|
+
message: string,
|
|
16
|
+
@as("type") type_: string,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
type cognitoIdentity = {
|
|
20
|
+
username: string,
|
|
21
|
+
sub: string,
|
|
22
|
+
sourceIp: array<string>,
|
|
23
|
+
claims: Dict.t<JSON.t>,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
type info = {
|
|
27
|
+
fieldName: string,
|
|
28
|
+
parentTypeName: string,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** AppSync JS resolver context object. 'args, 'source and 'result are parametric. */
|
|
32
|
+
type ctx<'args, 'source, 'result> = {
|
|
33
|
+
args: 'args,
|
|
34
|
+
identity: cognitoIdentity,
|
|
35
|
+
result: 'result,
|
|
36
|
+
source: 'source,
|
|
37
|
+
error: Nullable.t<error>,
|
|
38
|
+
info: info,
|
|
39
|
+
stash: Dict.t<JSON.t>,
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
// DynamoDB attribute types
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
|
|
46
|
+
/** Opaque DynamoDB typed attribute value (e.g. {S: "foo"}, {N: "42"}, {BOOL: true}). */
|
|
47
|
+
type dynamoDbValue
|
|
48
|
+
|
|
49
|
+
/** A map of DynamoDB attribute values — used in keys, attributeValues, etc. */
|
|
50
|
+
type dynamoDbMap = Dict.t<dynamoDbValue>
|
|
51
|
+
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// @aws-appsync/utils — util.dynamodb.*
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
module DynamoDB = {
|
|
57
|
+
/** Auto-detect type and convert a JS value to a DynamoDB attribute value.
|
|
58
|
+
Equivalent to VTL's $util.dynamodb.toDynamoDBJson(val). */
|
|
59
|
+
@module("@aws-appsync/utils") @scope(("util", "dynamodb"))
|
|
60
|
+
external toDynamoDB: 'a => dynamoDbValue = "toDynamoDB"
|
|
61
|
+
|
|
62
|
+
@module("@aws-appsync/utils") @scope(("util", "dynamodb"))
|
|
63
|
+
external toString: string => dynamoDbValue = "toString"
|
|
64
|
+
|
|
65
|
+
@module("@aws-appsync/utils") @scope(("util", "dynamodb"))
|
|
66
|
+
external toNumber: float => dynamoDbValue = "toNumber"
|
|
67
|
+
|
|
68
|
+
@module("@aws-appsync/utils") @scope(("util", "dynamodb"))
|
|
69
|
+
external toBoolean: bool => dynamoDbValue = "toBoolean"
|
|
70
|
+
|
|
71
|
+
@module("@aws-appsync/utils") @scope(("util", "dynamodb"))
|
|
72
|
+
external toNull: unit => dynamoDbValue = "toNull"
|
|
73
|
+
|
|
74
|
+
@module("@aws-appsync/utils") @scope(("util", "dynamodb"))
|
|
75
|
+
external toList: array<dynamoDbValue> => dynamoDbValue = "toList"
|
|
76
|
+
|
|
77
|
+
/** Convert a plain JS object's values to DynamoDB attribute values. */
|
|
78
|
+
@module("@aws-appsync/utils") @scope(("util", "dynamodb"))
|
|
79
|
+
external toMapValues: {..} => dynamoDbMap = "toMapValues"
|
|
80
|
+
|
|
81
|
+
@module("@aws-appsync/utils") @scope(("util", "dynamodb"))
|
|
82
|
+
external toStringSet: array<string> => dynamoDbValue = "toStringSet"
|
|
83
|
+
|
|
84
|
+
@module("@aws-appsync/utils") @scope(("util", "dynamodb"))
|
|
85
|
+
external toNumberSet: array<float> => dynamoDbValue = "toNumberSet"
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ---------------------------------------------------------------------------
|
|
89
|
+
// @aws-appsync/utils — util.*
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
|
|
92
|
+
module Util = {
|
|
93
|
+
/** Throw a resolver error. Calling this terminates the resolver. */
|
|
94
|
+
@module("@aws-appsync/utils") @scope("util")
|
|
95
|
+
external error: (string, ~errorType: string=?) => 'a = "error"
|
|
96
|
+
|
|
97
|
+
/** Throw an unauthorized error. Calling this terminates the resolver. */
|
|
98
|
+
@module("@aws-appsync/utils") @scope("util")
|
|
99
|
+
external unauthorized: unit => 'a = "unauthorized"
|
|
100
|
+
|
|
101
|
+
@module("@aws-appsync/utils") @scope("util")
|
|
102
|
+
external defaultIfNull: (Nullable.t<'a>, 'a) => 'a = "defaultIfNull"
|
|
103
|
+
|
|
104
|
+
@module("@aws-appsync/utils") @scope("util")
|
|
105
|
+
external defaultIfNullOrBlank: (Nullable.t<string>, string) => string = "defaultIfNullOrBlank"
|
|
106
|
+
|
|
107
|
+
@module("@aws-appsync/utils") @scope("util")
|
|
108
|
+
external isNull: Nullable.t<'a> => bool = "isNull"
|
|
109
|
+
|
|
110
|
+
@module("@aws-appsync/utils") @scope("util")
|
|
111
|
+
external isNullOrBlank: Nullable.t<string> => bool = "isNullOrBlank"
|
|
112
|
+
|
|
113
|
+
@module("@aws-appsync/utils") @scope("util")
|
|
114
|
+
external isList: 'a => bool = "isList"
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ---------------------------------------------------------------------------
|
|
118
|
+
// @aws-appsync/utils — runtime.*
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
|
|
121
|
+
module Runtime = {
|
|
122
|
+
/** Return a value early from a resolver pipeline function, skipping remaining functions. */
|
|
123
|
+
@module("@aws-appsync/utils") @scope("runtime")
|
|
124
|
+
external earlyReturn: 'a => 'b = "earlyReturn"
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ---------------------------------------------------------------------------
|
|
128
|
+
// DynamoDB request helpers (typed record shapes accepted by AppSync)
|
|
129
|
+
// ---------------------------------------------------------------------------
|
|
130
|
+
|
|
131
|
+
type expressionQuery = {
|
|
132
|
+
expression: string,
|
|
133
|
+
expressionNames: Dict.t<string>,
|
|
134
|
+
expressionValues: dynamoDbMap,
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
type expressionFilter = {
|
|
138
|
+
expression: string,
|
|
139
|
+
expressionNames: Dict.t<string>,
|
|
140
|
+
expressionValues: dynamoDbMap,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
type getItemRequest = {
|
|
144
|
+
operation: string,
|
|
145
|
+
key: dynamoDbMap,
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
type queryRequest = {
|
|
149
|
+
operation: string,
|
|
150
|
+
query: expressionQuery,
|
|
151
|
+
index?: string,
|
|
152
|
+
limit?: int,
|
|
153
|
+
nextToken?: Nullable.t<string>,
|
|
154
|
+
scanIndexForward?: bool,
|
|
155
|
+
filter?: expressionFilter,
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
type putItemRequest = {
|
|
159
|
+
operation: string,
|
|
160
|
+
key: dynamoDbMap,
|
|
161
|
+
attributeValues: dynamoDbMap,
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
type updateItemRequest = {
|
|
165
|
+
operation: string,
|
|
166
|
+
key: dynamoDbMap,
|
|
167
|
+
update: {
|
|
168
|
+
expression: string,
|
|
169
|
+
expressionNames: Dict.t<string>,
|
|
170
|
+
expressionValues: dynamoDbMap,
|
|
171
|
+
},
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
type deleteItemRequest = {
|
|
175
|
+
operation: string,
|
|
176
|
+
key: dynamoDbMap,
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
type batchGetItemTable = {
|
|
180
|
+
keys: array<dynamoDbMap>,
|
|
181
|
+
consistentRead: bool,
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
type batchGetItemRequest = {
|
|
185
|
+
operation: string,
|
|
186
|
+
tables: Dict.t<batchGetItemTable>,
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
type scanRequest = {
|
|
190
|
+
operation: string,
|
|
191
|
+
limit?: int,
|
|
192
|
+
nextToken?: Nullable.t<string>,
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
type lambdaRequest = {
|
|
196
|
+
operation: string,
|
|
197
|
+
payload: JSON.t,
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
// DynamoDB result helpers
|
|
202
|
+
// ---------------------------------------------------------------------------
|
|
203
|
+
|
|
204
|
+
/** Result shape from a DynamoDB Query or Scan operation. */
|
|
205
|
+
type queryResult<'item> = {
|
|
206
|
+
items: array<'item>,
|
|
207
|
+
nextToken: Nullable.t<string>,
|
|
208
|
+
scannedCount: int,
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** Result shape from a DynamoDB BatchGetItem operation. */
|
|
212
|
+
type batchGetItemResult<'item> = {
|
|
213
|
+
data: Dict.t<array<'item>>,
|
|
214
|
+
}
|