@plusscommunities/pluss-newsletter-aws 2.0.2-beta.0 → 2.0.3-beta.0
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/package-lock.json +1 -1
- package/package.json +3 -2
- package/serverless.yml +453 -0
package/package-lock.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plusscommunities/pluss-newsletter-aws",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3-beta.0",
|
|
4
4
|
"description": "Extension package to enable newsletter on Pluss Communities Platform",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"gc": "run(){ node ../../tools/inject_config_ext ./ ${1} ${2}; }; run",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"config/*",
|
|
50
50
|
"helper/*",
|
|
51
51
|
"*.js",
|
|
52
|
-
"package*.json"
|
|
52
|
+
"package*.json",
|
|
53
|
+
"serverless.yml"
|
|
53
54
|
]
|
|
54
55
|
}
|
package/serverless.yml
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
service: dev-newsletter
|
|
2
|
+
|
|
3
|
+
frameworkVersion: ">=1.1.0 <2.0.0"
|
|
4
|
+
|
|
5
|
+
provider:
|
|
6
|
+
name: aws
|
|
7
|
+
runtime: nodejs14.x
|
|
8
|
+
region: ap-southeast-2
|
|
9
|
+
profile: dev-serverless-admin
|
|
10
|
+
stage: dev
|
|
11
|
+
deploymentBucket: serverless.deploys.pluss60.${self:custom.client}.${self:provider.region}
|
|
12
|
+
environment:
|
|
13
|
+
tablePrefix: ${self:custom.tablePrefix}
|
|
14
|
+
iamRoleStatements:
|
|
15
|
+
- Effect: Allow
|
|
16
|
+
Action:
|
|
17
|
+
- dynamodb:Query
|
|
18
|
+
- dynamodb:Scan
|
|
19
|
+
- dynamodb:GetItem
|
|
20
|
+
- dynamodb:PutItem
|
|
21
|
+
- dynamodb:UpdateItem
|
|
22
|
+
- dynamodb:DeleteItem
|
|
23
|
+
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/*"
|
|
24
|
+
|
|
25
|
+
plugins:
|
|
26
|
+
- serverless-domain-manager
|
|
27
|
+
- serverless-prune-plugin
|
|
28
|
+
|
|
29
|
+
custom:
|
|
30
|
+
client: dev
|
|
31
|
+
functionPrefix: ""
|
|
32
|
+
tablePrefix: ${self:custom.client}-${self:provider.stage}-
|
|
33
|
+
customDomain:
|
|
34
|
+
domainName: dev.pluss60-api.com
|
|
35
|
+
basePath: newsletter-${self:provider.stage}
|
|
36
|
+
stage: ${self:provider.stage}
|
|
37
|
+
createRoute53Record: true
|
|
38
|
+
securityPolicy: tls_1_2
|
|
39
|
+
prune:
|
|
40
|
+
automatic: true
|
|
41
|
+
number: 1
|
|
42
|
+
|
|
43
|
+
functions:
|
|
44
|
+
addNewsletterEntry:
|
|
45
|
+
handler: addNewsletterEntry.addNewsletterEntry
|
|
46
|
+
tags: newsletter
|
|
47
|
+
memorySize: 1024
|
|
48
|
+
timeout: 30
|
|
49
|
+
events:
|
|
50
|
+
- http:
|
|
51
|
+
path: ${self:custom.functionPrefix}add
|
|
52
|
+
method: post
|
|
53
|
+
cors:
|
|
54
|
+
origin: '*'
|
|
55
|
+
headers:
|
|
56
|
+
- Content-Type
|
|
57
|
+
- authkey
|
|
58
|
+
editNewsletterEntry:
|
|
59
|
+
handler: editNewsletterEntry.editNewsletterEntry
|
|
60
|
+
tags: newsletter
|
|
61
|
+
memorySize: 128
|
|
62
|
+
timeout: 10
|
|
63
|
+
events:
|
|
64
|
+
- http:
|
|
65
|
+
path: ${self:custom.functionPrefix}edit
|
|
66
|
+
method: post
|
|
67
|
+
cors:
|
|
68
|
+
origin: '*'
|
|
69
|
+
headers:
|
|
70
|
+
- Content-Type
|
|
71
|
+
- authkey
|
|
72
|
+
editNewsletterSubmission:
|
|
73
|
+
handler: editNewsletterSubmission.editNewsletterSubmission
|
|
74
|
+
tags: newsletter
|
|
75
|
+
memorySize: 128
|
|
76
|
+
timeout: 10
|
|
77
|
+
events:
|
|
78
|
+
- http:
|
|
79
|
+
path: ${self:custom.functionPrefix}editSubmission
|
|
80
|
+
method: post
|
|
81
|
+
cors:
|
|
82
|
+
origin: '*'
|
|
83
|
+
headers:
|
|
84
|
+
- Content-Type
|
|
85
|
+
- authkey
|
|
86
|
+
getNewsletterEntry:
|
|
87
|
+
handler: getNewsletterEntry.getNewsletterEntry
|
|
88
|
+
tags: newsletter
|
|
89
|
+
memorySize: 128
|
|
90
|
+
timeout: 10
|
|
91
|
+
events:
|
|
92
|
+
- http:
|
|
93
|
+
path: ${self:custom.functionPrefix}get/{id}
|
|
94
|
+
method: get
|
|
95
|
+
cors:
|
|
96
|
+
origin: '*'
|
|
97
|
+
headers:
|
|
98
|
+
- Content-Type
|
|
99
|
+
- authkey
|
|
100
|
+
getNews:
|
|
101
|
+
handler: getNews.getNews
|
|
102
|
+
tags: newsletter
|
|
103
|
+
memorySize: 128
|
|
104
|
+
timeout: 10
|
|
105
|
+
events:
|
|
106
|
+
- http:
|
|
107
|
+
path: ${self:custom.functionPrefix}get2/{action}
|
|
108
|
+
method: get
|
|
109
|
+
cors:
|
|
110
|
+
origin: '*'
|
|
111
|
+
headers:
|
|
112
|
+
- Content-Type
|
|
113
|
+
- authkey
|
|
114
|
+
getNewsletterEntries:
|
|
115
|
+
handler: getNewsletterEntries.getNewsletterEntries
|
|
116
|
+
tags: newsletter
|
|
117
|
+
memorySize: 1024
|
|
118
|
+
timeout: 30
|
|
119
|
+
events:
|
|
120
|
+
- http:
|
|
121
|
+
path: ${self:custom.functionPrefix}get
|
|
122
|
+
method: get
|
|
123
|
+
cors:
|
|
124
|
+
origin: '*'
|
|
125
|
+
headers:
|
|
126
|
+
- Content-Type
|
|
127
|
+
- authkey
|
|
128
|
+
getFeaturedNewsletterEntries:
|
|
129
|
+
handler: getFeaturedNewsletterEntries.getFeaturedNewsletterEntries
|
|
130
|
+
tags: newsletter
|
|
131
|
+
memorySize: 128
|
|
132
|
+
timeout: 10
|
|
133
|
+
events:
|
|
134
|
+
- http:
|
|
135
|
+
path: ${self:custom.functionPrefix}getFeatured
|
|
136
|
+
method: get
|
|
137
|
+
cors:
|
|
138
|
+
origin: '*'
|
|
139
|
+
headers:
|
|
140
|
+
- Content-Type
|
|
141
|
+
- authkey
|
|
142
|
+
getRecentNewsletterEntries:
|
|
143
|
+
handler: getRecentNewsletterEntries.getRecentNewsletterEntries
|
|
144
|
+
tags: newsletter
|
|
145
|
+
memorySize: 128
|
|
146
|
+
timeout: 10
|
|
147
|
+
events:
|
|
148
|
+
- http:
|
|
149
|
+
path: ${self:custom.functionPrefix}recent
|
|
150
|
+
method: get
|
|
151
|
+
cors:
|
|
152
|
+
origin: '*'
|
|
153
|
+
headers:
|
|
154
|
+
- Content-Type
|
|
155
|
+
- authkey
|
|
156
|
+
searchAvailableNews:
|
|
157
|
+
handler: searchAvailableNews.searchAvailableNews
|
|
158
|
+
tags: newsletter
|
|
159
|
+
memorySize: 128
|
|
160
|
+
timeout: 10
|
|
161
|
+
events:
|
|
162
|
+
- http:
|
|
163
|
+
path: ${self:custom.functionPrefix}content/search
|
|
164
|
+
method: get
|
|
165
|
+
cors:
|
|
166
|
+
origin: '*'
|
|
167
|
+
headers:
|
|
168
|
+
- Content-Type
|
|
169
|
+
- authkey
|
|
170
|
+
getAvailableNews:
|
|
171
|
+
handler: getAvailableNews.getAvailableNews
|
|
172
|
+
tags: newsletter
|
|
173
|
+
memorySize: 128
|
|
174
|
+
timeout: 10
|
|
175
|
+
events:
|
|
176
|
+
- http:
|
|
177
|
+
path: ${self:custom.functionPrefix}content/get
|
|
178
|
+
method: get
|
|
179
|
+
cors:
|
|
180
|
+
origin: '*'
|
|
181
|
+
headers:
|
|
182
|
+
- Content-Type
|
|
183
|
+
- authkey
|
|
184
|
+
getPublishedEntries:
|
|
185
|
+
handler: getPublishedEntries.getPublishedEntries
|
|
186
|
+
tags: newsletter
|
|
187
|
+
memorySize: 128
|
|
188
|
+
timeout: 10
|
|
189
|
+
events:
|
|
190
|
+
- http:
|
|
191
|
+
path: ${self:custom.functionPrefix}content/specific
|
|
192
|
+
method: get
|
|
193
|
+
cors:
|
|
194
|
+
origin: '*'
|
|
195
|
+
headers:
|
|
196
|
+
- Content-Type
|
|
197
|
+
- authkey
|
|
198
|
+
getPublishedAvailableNews:
|
|
199
|
+
handler: getPublishedAvailableNews.getPublishedAvailableNews
|
|
200
|
+
tags: newsletter
|
|
201
|
+
memorySize: 128
|
|
202
|
+
timeout: 10
|
|
203
|
+
events:
|
|
204
|
+
- http:
|
|
205
|
+
path: ${self:custom.functionPrefix}content/published
|
|
206
|
+
method: get
|
|
207
|
+
cors:
|
|
208
|
+
origin: '*'
|
|
209
|
+
headers:
|
|
210
|
+
- Content-Type
|
|
211
|
+
- authkey
|
|
212
|
+
deleteNewsletterEntry:
|
|
213
|
+
handler: deleteNewsletterEntry.deleteNewsletterEntry
|
|
214
|
+
tags: newsletter
|
|
215
|
+
memorySize: 128
|
|
216
|
+
timeout: 10
|
|
217
|
+
events:
|
|
218
|
+
- http:
|
|
219
|
+
path: ${self:custom.functionPrefix}remove
|
|
220
|
+
method: post
|
|
221
|
+
cors:
|
|
222
|
+
origin: '*'
|
|
223
|
+
headers:
|
|
224
|
+
- Content-Type
|
|
225
|
+
- authkey
|
|
226
|
+
hasNewsletterAccess:
|
|
227
|
+
handler: hasNewsletterAccess.hasNewsletterAccess
|
|
228
|
+
tags: newsletter
|
|
229
|
+
memorySize: 128
|
|
230
|
+
timeout: 10
|
|
231
|
+
events:
|
|
232
|
+
- http:
|
|
233
|
+
path: ${self:custom.functionPrefix}access
|
|
234
|
+
method: get
|
|
235
|
+
cors:
|
|
236
|
+
origin: '*'
|
|
237
|
+
headers:
|
|
238
|
+
- Content-Type
|
|
239
|
+
- authkey
|
|
240
|
+
getNewsletterSubmissions:
|
|
241
|
+
handler: getNewsletterSubmissions.getNewsletterSubmissions
|
|
242
|
+
tags: newsletter
|
|
243
|
+
memorySize: 128
|
|
244
|
+
timeout: 10
|
|
245
|
+
events:
|
|
246
|
+
- http:
|
|
247
|
+
path: ${self:custom.functionPrefix}submissions/get
|
|
248
|
+
method: get
|
|
249
|
+
cors:
|
|
250
|
+
origin: '*'
|
|
251
|
+
headers:
|
|
252
|
+
- Content-Type
|
|
253
|
+
- authkey
|
|
254
|
+
getNewsletterSubmission:
|
|
255
|
+
handler: getNewsletterSubmission.getNewsletterSubmission
|
|
256
|
+
tags: newsletter
|
|
257
|
+
memorySize: 128
|
|
258
|
+
timeout: 10
|
|
259
|
+
events:
|
|
260
|
+
- http:
|
|
261
|
+
path: ${self:custom.functionPrefix}submissions/get/{id}
|
|
262
|
+
method: get
|
|
263
|
+
cors:
|
|
264
|
+
origin: '*'
|
|
265
|
+
headers:
|
|
266
|
+
- Content-Type
|
|
267
|
+
- authkey
|
|
268
|
+
handleNewsletterSubmission:
|
|
269
|
+
handler: handleNewsletterSubmission.handleNewsletterSubmission
|
|
270
|
+
tags: newsletter
|
|
271
|
+
memorySize: 128
|
|
272
|
+
timeout: 10
|
|
273
|
+
events:
|
|
274
|
+
- http:
|
|
275
|
+
path: ${self:custom.functionPrefix}submissions/handle
|
|
276
|
+
method: post
|
|
277
|
+
cors:
|
|
278
|
+
origin: '*'
|
|
279
|
+
headers:
|
|
280
|
+
- Content-Type
|
|
281
|
+
- authkey
|
|
282
|
+
getSubmissionCount:
|
|
283
|
+
handler: getSubmissionCount.getSubmissionCount
|
|
284
|
+
tags: newsletter
|
|
285
|
+
memorySize: 128
|
|
286
|
+
timeout: 10
|
|
287
|
+
events:
|
|
288
|
+
- http:
|
|
289
|
+
path: ${self:custom.functionPrefix}submissions/count
|
|
290
|
+
method: get
|
|
291
|
+
cors:
|
|
292
|
+
origin: '*'
|
|
293
|
+
headers:
|
|
294
|
+
- Content-Type
|
|
295
|
+
- authkey
|
|
296
|
+
getTaggedNews:
|
|
297
|
+
handler: getTaggedNews.getTaggedNews
|
|
298
|
+
tags: newsletter
|
|
299
|
+
memorySize: 128
|
|
300
|
+
timeout: 10
|
|
301
|
+
events:
|
|
302
|
+
- http:
|
|
303
|
+
path: ${self:custom.functionPrefix}tagged/get
|
|
304
|
+
method: get
|
|
305
|
+
cors:
|
|
306
|
+
origin: '*'
|
|
307
|
+
headers:
|
|
308
|
+
- Content-Type
|
|
309
|
+
- authkey
|
|
310
|
+
newsletterChanged:
|
|
311
|
+
handler: newsletterChanged.newsletterChanged
|
|
312
|
+
memorySize: 2048
|
|
313
|
+
timeout: 30
|
|
314
|
+
events:
|
|
315
|
+
- stream:
|
|
316
|
+
type: dynamodb
|
|
317
|
+
batchSize: 1
|
|
318
|
+
startingPosition: LATEST
|
|
319
|
+
arn:
|
|
320
|
+
Fn::GetAtt:
|
|
321
|
+
- NewsletterEntries
|
|
322
|
+
- StreamArn
|
|
323
|
+
watchNewsletter:
|
|
324
|
+
handler: watchNewsletter.watchNewsletter
|
|
325
|
+
tags: newsletter
|
|
326
|
+
memorySize: 2048
|
|
327
|
+
timeout: 300
|
|
328
|
+
events:
|
|
329
|
+
- schedule:
|
|
330
|
+
rate: cron(1/5 * * * ? *)
|
|
331
|
+
enabled: true
|
|
332
|
+
resources:
|
|
333
|
+
Resources:
|
|
334
|
+
NewsletterEntries:
|
|
335
|
+
Type: "AWS::DynamoDB::Table"
|
|
336
|
+
DeletionPolicy: Retain
|
|
337
|
+
Properties:
|
|
338
|
+
AttributeDefinitions:
|
|
339
|
+
- AttributeName: RowId
|
|
340
|
+
AttributeType: S
|
|
341
|
+
- AttributeName: Site
|
|
342
|
+
AttributeType: S
|
|
343
|
+
- AttributeName: UnixTimestampReverse
|
|
344
|
+
AttributeType: N
|
|
345
|
+
- AttributeName: FeaturedExpiry
|
|
346
|
+
AttributeType: N
|
|
347
|
+
- AttributeName: SourceId
|
|
348
|
+
AttributeType: S
|
|
349
|
+
- AttributeName: UnsentNotification
|
|
350
|
+
AttributeType: S
|
|
351
|
+
- AttributeName: UnixTimestamp
|
|
352
|
+
AttributeType: N
|
|
353
|
+
KeySchema:
|
|
354
|
+
- AttributeName: RowId
|
|
355
|
+
KeyType: HASH
|
|
356
|
+
TableName: ${self:custom.tablePrefix}newsletterentries
|
|
357
|
+
BillingMode: PAY_PER_REQUEST
|
|
358
|
+
PointInTimeRecoverySpecification:
|
|
359
|
+
PointInTimeRecoveryEnabled: true
|
|
360
|
+
StreamSpecification:
|
|
361
|
+
StreamViewType: NEW_AND_OLD_IMAGES
|
|
362
|
+
GlobalSecondaryIndexes:
|
|
363
|
+
- IndexName: NewsletterEntriesSiteTimestampIndex
|
|
364
|
+
KeySchema:
|
|
365
|
+
- AttributeName: Site
|
|
366
|
+
KeyType: HASH
|
|
367
|
+
- AttributeName: UnixTimestampReverse
|
|
368
|
+
KeyType: RANGE
|
|
369
|
+
Projection:
|
|
370
|
+
ProjectionType: ALL
|
|
371
|
+
- IndexName: NewsletterEntriesSiteFeaturedExpiryIndex
|
|
372
|
+
KeySchema:
|
|
373
|
+
- AttributeName: Site
|
|
374
|
+
KeyType: HASH
|
|
375
|
+
- AttributeName: FeaturedExpiry
|
|
376
|
+
KeyType: RANGE
|
|
377
|
+
Projection:
|
|
378
|
+
ProjectionType: ALL
|
|
379
|
+
- IndexName: NewsletterEntriesSiteSourceIdIndex
|
|
380
|
+
KeySchema:
|
|
381
|
+
- AttributeName: Site
|
|
382
|
+
KeyType: HASH
|
|
383
|
+
- AttributeName: SourceId
|
|
384
|
+
KeyType: RANGE
|
|
385
|
+
Projection:
|
|
386
|
+
ProjectionType: ALL
|
|
387
|
+
- IndexName: NewsletterEntriesUnsentNotiIndex
|
|
388
|
+
KeySchema:
|
|
389
|
+
- AttributeName: UnsentNotification
|
|
390
|
+
KeyType: HASH
|
|
391
|
+
- AttributeName: UnixTimestamp
|
|
392
|
+
KeyType: RANGE
|
|
393
|
+
Projection:
|
|
394
|
+
ProjectionType: ALL
|
|
395
|
+
NewsletterSubmissions:
|
|
396
|
+
Type: "AWS::DynamoDB::Table"
|
|
397
|
+
DeletionPolicy: Retain
|
|
398
|
+
Properties:
|
|
399
|
+
AttributeDefinitions:
|
|
400
|
+
- AttributeName: RowId
|
|
401
|
+
AttributeType: S
|
|
402
|
+
- AttributeName: Site
|
|
403
|
+
AttributeType: S
|
|
404
|
+
- AttributeName: UnixTimestampReverse
|
|
405
|
+
AttributeType: N
|
|
406
|
+
KeySchema:
|
|
407
|
+
- AttributeName: RowId
|
|
408
|
+
KeyType: HASH
|
|
409
|
+
TableName: ${self:custom.tablePrefix}newslettersubmissions
|
|
410
|
+
BillingMode: PAY_PER_REQUEST
|
|
411
|
+
PointInTimeRecoverySpecification:
|
|
412
|
+
PointInTimeRecoveryEnabled: true
|
|
413
|
+
StreamSpecification:
|
|
414
|
+
StreamViewType: NEW_AND_OLD_IMAGES
|
|
415
|
+
GlobalSecondaryIndexes:
|
|
416
|
+
- IndexName: NewsletterSubmissionsSiteTimestampIndex
|
|
417
|
+
KeySchema:
|
|
418
|
+
- AttributeName: Site
|
|
419
|
+
KeyType: HASH
|
|
420
|
+
- AttributeName: UnixTimestampReverse
|
|
421
|
+
KeyType: RANGE
|
|
422
|
+
Projection:
|
|
423
|
+
ProjectionType: ALL
|
|
424
|
+
NewsletterUserEntries:
|
|
425
|
+
Type: "AWS::DynamoDB::Table"
|
|
426
|
+
DeletionPolicy: Retain
|
|
427
|
+
Properties:
|
|
428
|
+
AttributeDefinitions:
|
|
429
|
+
- AttributeName: RowId
|
|
430
|
+
AttributeType: S
|
|
431
|
+
- AttributeName: UserId
|
|
432
|
+
AttributeType: S
|
|
433
|
+
- AttributeName: UnixTimestampReverse
|
|
434
|
+
AttributeType: N
|
|
435
|
+
KeySchema:
|
|
436
|
+
- AttributeName: RowId
|
|
437
|
+
KeyType: HASH
|
|
438
|
+
TableName: ${self:custom.tablePrefix}newsletteruserentries
|
|
439
|
+
BillingMode: PAY_PER_REQUEST
|
|
440
|
+
PointInTimeRecoverySpecification:
|
|
441
|
+
PointInTimeRecoveryEnabled: true
|
|
442
|
+
StreamSpecification:
|
|
443
|
+
StreamViewType: NEW_AND_OLD_IMAGES
|
|
444
|
+
GlobalSecondaryIndexes:
|
|
445
|
+
- IndexName: NewsletterUserEntriesUserIdTimestampIndex
|
|
446
|
+
KeySchema:
|
|
447
|
+
- AttributeName: UserId
|
|
448
|
+
KeyType: HASH
|
|
449
|
+
- AttributeName: UnixTimestampReverse
|
|
450
|
+
KeyType: RANGE
|
|
451
|
+
Projection:
|
|
452
|
+
ProjectionType: ALL
|
|
453
|
+
|