Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions template-live-data-service/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "16"
}
}
]
],
"plugins": [
"@babel/plugin-transform-runtime"
],
"env": {
"test": {
"plugins": [
"istanbul"
],
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "16"
},
"modules": "umd"
}
]
]
}
}
}
21 changes: 21 additions & 0 deletions template-live-data-service/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true

# Set default charset
[*.{js,ts,css,json}]
charset = utf-8
indent_style = space
indent_size = 2

# Matches the exact files package.json
[{package.json}]
indent_style = space
indent_size = 2
7 changes: 7 additions & 0 deletions template-live-data-service/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
tools/
lib/
coverage/
webpack.config.js
.idea
*.iml
bak
41 changes: 41 additions & 0 deletions template-live-data-service/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
parser: '@babel/eslint-parser',
extends: 'airbnb-base',
plugins: [],
env: {
node: true,
mocha: true,
commonjs: true,
},
parserOptions: {
ecmaVersion: 6,
sourceType: 'module',
},
rules: {
'linebreak-style': 0,
'max-len': [1, 140, 2, { ignoreComments: true, ignoreStrings: true }],
'quote-props': [1, 'consistent-as-needed'],
'no-cond-assign': [2, 'except-parens'],
'space-infix-ops': 0,
'no-unused-vars': [1, { vars: 'local', args: 'none' }],
'default-case': 0,
'no-else-return': 0,
'no-param-reassign': 0,
'comma-dangle': 1,
'indent': 1,
'object-curly-spacing': 1,
'arrow-body-style': 1,
'no-console': 0,
'prefer-template': 1,
'import/no-unresolved': 1,
'import/no-extraneous-dependencies': [2, { devDependencies: ['**/test/**/*.js'] }],
'global-require': 1,
'no-underscore-dangle': 0,
'new-cap': 0,
'no-use-before-define': 0,
'no-useless-escape': 0,
'no-unused-expressions': 0,
'class-methods-use-this': 0,
},
globals: {},
};
8 changes: 8 additions & 0 deletions template-live-data-service/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
.serverless
.webpack
.DS_Store
coverage
.nyc_output
*.log
bak
Empty file.
28 changes: 28 additions & 0 deletions template-live-data-service/.nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"lines": 100,
"statements": 100,
"functions": 100,
"branches": 100,
"include": [
"src/**/*.js"
],
"exclude": [
"test/int/**/*.test.js",
"test/unit/**/*.test.js"
],
"require": [
"@babel/register",
"./test/helper.js"
],
"reporter": [
"text",
"lcov",
"html",
"text-summary"
],
"sourceMap": false,
"instrument": false,
"cache": false,
"check-coverage": true,
"all": true
}
3 changes: 3 additions & 0 deletions template-live-data-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# template-live-data-service

Inspired by: https://www.serverless.com/blog/how-reuters-replaced-websockets-with-amazon-cognito-and-sqs/
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
POST /
content-type: application/x-www-form-urlencoded; charset=utf-8
host: sns.us-west-2.amazonaws.com
body: Action=Subscribe&Attributes.entry.1.key=RawMessageDelivery&Attributes.entry.1.value=true&Attributes.entry.2.key=FilterPolicyScope&Attributes.entry.2.value=MessageBody&Attributes.entry.3.key=FilterPolicy&Attributes.entry.3.value=%7B%22tags%22%3A%7B%22source%22%3A%5B%22template-task-service%22%5D%7D%7D&Endpoint=arn%3Aaws%3Asqs%3Aus-west-2%3A123456789012%3Alvd-stg-sub1&Protocol=sqs&ReturnSubscriptionArn=true&TopicArn=arn%3Aaws%3Asns%3Aus-west-2%3A123456789012%3Atemplate-live-data-service-stg&Version=2010-03-31

HTTP/1.1 200 OK
x-amzn-requestid: 50fd9e93-fc64-5934-9f86-c3fea5b2e0a5
content-type: text/xml
content-length: 380
date: Sat, 02 Sep 2023 15:41:10 GMT

<SubscribeResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
<SubscribeResult>
<SubscriptionArn>arn:aws:sns:us-west-2:123456789012:template-live-data-service-stg:334b60e8-4ccc-4080-af78-9d92588c5761</SubscriptionArn>
</SubscribeResult>
<ResponseMetadata>
<RequestId>50fd9e93-fc64-5934-9f86-c3fea5b2e0a5</RequestId>
</ResponseMetadata>
</SubscribeResponse>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
POST /
content-type: application/x-www-form-urlencoded; charset=utf-8
host: sns.us-west-2.amazonaws.com
body: Action=Unsubscribe&SubscriptionArn=arn%3Aaws%3Asns%3Aus-west-2%3A123456789012%3Atemplate-live-data-service-stg%3Aa21b9690-7190-5b0b-860e-cbfd3cdb5567&Version=2010-03-31

HTTP/1.1 200 OK
x-amzn-requestid: dcb4fac0-b96b-5113-87e4-a7aeb99ea9b0
content-type: text/xml
content-length: 201
date: Sun, 03 Sep 2023 03:34:13 GMT

<UnsubscribeResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
<ResponseMetadata>
<RequestId>dcb4fac0-b96b-5113-87e4-a7aeb99ea9b0</RequestId>
</ResponseMetadata>
</UnsubscribeResponse>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POST /
content-type: application/x-www-form-urlencoded; charset=utf-8
host: sqs.us-west-2.amazonaws.com
body: Action=CreateQueue&Attribute.1.Name=MessageRetentionPeriod&Attribute.1.Value=7200&Attribute.2.Name=Policy&Attribute.2.Value=%7B%22Statement%22%3A%5B%7B%22Effect%22%3A%22Allow%22%2C%22Principal%22%3A%7B%22Service%22%3A%22sns.amazonaws.com%22%7D%2C%22Action%22%3A%22sqs%3ASendMessage%22%2C%22Resource%22%3A%22arn%3Aaws%3Asqs%3Aus-west-2%3A123456789012%3Alvd-stg-sub1%22%2C%22Condition%22%3A%7B%22ArnEquals%22%3A%7B%22aws%3ASourceArn%22%3A%22arn%3Aaws%3Asns%3Aus-west-2%3A123456789012%3Atemplate-live-data-service-stg%22%7D%7D%7D%5D%7D&QueueName=lvd-stg-sub1&Version=2012-11-05

HTTP/1.1 200 OK
x-amzn-requestid: 5c3570ba-e59b-55d4-8982-2dd7abd05119
date: Sat, 02 Sep 2023 14:51:55 GMT
content-type: text/xml
content-length: 332
connection: keep-alive

<?xml version="1.0"?><CreateQueueResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><CreateQueueResult><QueueUrl>https://sqs.us-west-2.amazonaws.com/123456789012/lvd-stg-sub1</QueueUrl></CreateQueueResult><ResponseMetadata><RequestId>5c3570ba-e59b-55d4-8982-2dd7abd05119</RequestId></ResponseMetadata></CreateQueueResponse>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POST /
content-type: application/x-www-form-urlencoded; charset=utf-8
host: sqs.us-west-2.amazonaws.com
body: Action=DeleteMessageBatch&DeleteMessageBatchRequestEntry.1.Id=e9fd559d-ca23-4515-b24a-4adf471799f1&DeleteMessageBatchRequestEntry.1.ReceiptHandle=AQEBvi77N8ma7KK8ad%2BoJZeyPeVmZTo8%2F5nTUEOk5KoJGloQFZwYaREST9w8pC2syAxi%2F6GL1T6wdhjq%2B2gHKhVnTkz6m54qS7sZoSqkoqhpkJj4s1kNLyqztaGYzf7eE1cmDOTWukYiJ%2FTz1F5m00iDBH3wPG4pR1OQcBpDFp%2FUTAy8xGnX5yx9rGZ2HNk2d%2BmyRhFQh0TE0uazP5XSBJAdnpid%2FXuibpuMso1LVGnOxbNh%2B8uivX6SqsWGGT%2FKndx8z3JwdOjLxv18VdvjGWe4s8K5IXo4eZYlm%2F%2BkUhMlQRzd7Te8zXIKC1P%2FYM2Cal4uJ9gurtAYk7gu17Puq4iQqxBS1FB8UHChzbQ%2Fj7E9A%2BhurDi%2BRU3Z40vmC4p9%2B6m3tuKY8%2F3sLCvea8D%2BgSygNQ%3D%3D&QueueUrl=https%3A%2F%2Fsqs.us-west-2.amazonaws.com%2F123456789012%2Flvd-stg-sub1&Version=2012-11-05

HTTP/1.1 200 OK
x-amzn-requestid: d44208d1-368b-592d-aaac-55bc69e379e0
date: Sat, 02 Sep 2023 16:04:56 GMT
content-type: text/xml
content-length: 386
connection: keep-alive

<?xml version="1.0"?><DeleteMessageBatchResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><DeleteMessageBatchResult><DeleteMessageBatchResultEntry><Id>e9fd559d-ca23-4515-b24a-4adf471799f1</Id></DeleteMessageBatchResultEntry></DeleteMessageBatchResult><ResponseMetadata><RequestId>d44208d1-368b-592d-aaac-55bc69e379e0</RequestId></ResponseMetadata></DeleteMessageBatchResponse>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POST /
content-type: application/x-www-form-urlencoded; charset=utf-8
host: sqs.us-west-2.amazonaws.com
body: Action=DeleteQueue&QueueUrl=https%3A%2F%2Fsqs.us-west-2.amazonaws.com%2F123456789012%2Flvd-stg-sub1&Version=2012-11-05

HTTP/1.1 200 OK
x-amzn-requestid: a6924889-88c3-5f98-a1fc-15e558bd9bcd
date: Sat, 02 Sep 2023 05:55:10 GMT
content-type: text/xml
content-length: 211
connection: keep-alive

<?xml version="1.0"?><DeleteQueueResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><ResponseMetadata><RequestId>a6924889-88c3-5f98-a1fc-15e558bd9bcd</RequestId></ResponseMetadata></DeleteQueueResponse>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POST /
content-type: application/x-www-form-urlencoded; charset=utf-8
host: sqs.us-west-2.amazonaws.com
body: Action=ReceiveMessage&QueueUrl=https%3A%2F%2Fsqs.us-west-2.amazonaws.com%2F20533475447%2Flvd-stg-sub1&Version=2012-11-05&WaitTimeSeconds=20

HTTP/1.1 200 OK
x-amzn-requestid: ece626b6-aedc-5402-80cb-7bda6760adf0
date: Sat, 02 Sep 2023 05:26:40 GMT
content-type: text/xml
content-length: 240
connection: keep-alive

<?xml version="1.0"?><ReceiveMessageResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><ReceiveMessageResult/><ResponseMetadata><RequestId>ece626b6-aedc-5402-80cb-7bda6760adf0</RequestId></ResponseMetadata></ReceiveMessageResponse>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
POST /
content-type: application/x-www-form-urlencoded; charset=utf-8
host: sqs.us-west-2.amazonaws.com
body: Action=ReceiveMessage&QueueUrl=https%3A%2F%2Fsqs.us-west-2.amazonaws.com%2F123456789012%2Flvd-stg-sub1&Version=2012-11-05&WaitTimeSeconds=20

HTTP/1.1 200 OK
x-amzn-requestid: 92931273-5c81-5409-a41b-4f1e0780dbe6
date: Sat, 02 Sep 2023 15:46:09 GMT
content-type: text/xml
content-length: 1162
connection: keep-alive

<?xml version="1.0"?><ReceiveMessageResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><ReceiveMessageResult><Message><MessageId>e9fd559d-ca23-4515-b24a-4adf471799f1</MessageId><ReceiptHandle>AQEBvi77N8ma7KK8ad+oJZeyPeVmZTo8/5nTUEOk5KoJGloQFZwYaREST9w8pC2syAxi/6GL1T6wdhjq+2gHKhVnTkz6m54qS7sZoSqkoqhpkJj4s1kNLyqztaGYzf7eE1cmDOTWukYiJ/Tz1F5m00iDBH3wPG4pR1OQcBpDFp/UTAy8xGnX5yx9rGZ2HNk2d+myRhFQh0TE0uazP5XSBJAdnpid/XuibpuMso1LVGnOxbNh+8uivX6SqsWGGT/Kndx8z3JwdOjLxv18VdvjGWe4s8K5IXo4eZYlm/+kUhMlQRzd7Te8zXIKC1P/YM2Cal4uJ9gurtAYk7gu17Puq4iQqxBS1FB8UHChzbQ/j7E9A+hurDi+RU3Z40vmC4p9+6m3tuKY8/3sLCvea8D+gSygNQ==</ReceiptHandle><MD5OfBody>dd755e97573e3862b4a7505d5ed8f687</MD5OfBody><Body>{&quot;id&quot;:&quot;1&quot;,&quot;type&quot;:&quot;task-updated&quot;,&quot;tags&quot;:{&quot;source&quot;:&quot;template-task-service&quot;},&quot;raw&quot;:{&quot;new&quot;:{&quot;id&quot;:&quot;1&quot;,&quot;type&quot;:&quot;t0&quot;,&quot;status&quot;:&quot;s1&quot;,&quot;timestamp&quot;:1693236475001}}}</Body></Message></ReceiveMessageResult><ResponseMetadata><RequestId>92931273-5c81-5409-a41b-4f1e0780dbe6</RequestId></ResponseMetadata></ReceiveMessageResponse>
Loading