aws-classify-server 0.1.2 → 0.1.3
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.
|
@@ -250,7 +250,7 @@ class ClassifyServerless {
|
|
|
250
250
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
251
|
if (userId) {
|
|
252
252
|
const data = yield ddbDocClient.query({
|
|
253
|
-
TableName:
|
|
253
|
+
TableName: `classifySessionStore.${process.env.DOMAIN}`,
|
|
254
254
|
KeyConditionExpression: 'userId = :userId',
|
|
255
255
|
IndexName: 'userId',
|
|
256
256
|
ExpressionAttributeValues: {
|
|
@@ -269,7 +269,7 @@ function getSessionData(sessionId, interfaceName = "") {
|
|
|
269
269
|
return __awaiter(this, void 0, void 0, function* () {
|
|
270
270
|
if (sessionId) {
|
|
271
271
|
const data = yield ddbDocClient.get({
|
|
272
|
-
TableName:
|
|
272
|
+
TableName: `classifySessionStore.${process.env.DOMAIN}`,
|
|
273
273
|
Key: { sessionId },
|
|
274
274
|
ConsistentRead: true,
|
|
275
275
|
ProjectionExpression: `interface_${interfaceName}, connectionId, userId, updated`
|
|
@@ -298,7 +298,7 @@ function saveSessionData(sessionId, interfaceName, sessionData, connectionId, us
|
|
|
298
298
|
}
|
|
299
299
|
// First try and out data only if the session id exists
|
|
300
300
|
yield ddbDocClient.update({
|
|
301
|
-
TableName:
|
|
301
|
+
TableName: `classifySessionStore.${process.env.DOMAIN}`,
|
|
302
302
|
Key: { sessionId },
|
|
303
303
|
UpdateExpression: `set ${updateExpressionComponents.join(", ")}`,
|
|
304
304
|
ExpressionAttributeValues: expressionAttributeValues
|
|
@@ -247,7 +247,7 @@ export class ClassifyServerless {
|
|
|
247
247
|
return __awaiter(this, void 0, void 0, function* () {
|
|
248
248
|
if (userId) {
|
|
249
249
|
const data = yield ddbDocClient.query({
|
|
250
|
-
TableName:
|
|
250
|
+
TableName: `classifySessionStore.${process.env.DOMAIN}`,
|
|
251
251
|
KeyConditionExpression: 'userId = :userId',
|
|
252
252
|
IndexName: 'userId',
|
|
253
253
|
ExpressionAttributeValues: {
|
|
@@ -265,7 +265,7 @@ export function getSessionData(sessionId, interfaceName = "") {
|
|
|
265
265
|
return __awaiter(this, void 0, void 0, function* () {
|
|
266
266
|
if (sessionId) {
|
|
267
267
|
const data = yield ddbDocClient.get({
|
|
268
|
-
TableName:
|
|
268
|
+
TableName: `classifySessionStore.${process.env.DOMAIN}`,
|
|
269
269
|
Key: { sessionId },
|
|
270
270
|
ConsistentRead: true,
|
|
271
271
|
ProjectionExpression: `interface_${interfaceName}, connectionId, userId, updated`
|
|
@@ -293,7 +293,7 @@ export function saveSessionData(sessionId, interfaceName, sessionData, connectio
|
|
|
293
293
|
}
|
|
294
294
|
// First try and out data only if the session id exists
|
|
295
295
|
yield ddbDocClient.update({
|
|
296
|
-
TableName:
|
|
296
|
+
TableName: `classifySessionStore.${process.env.DOMAIN}`,
|
|
297
297
|
Key: { sessionId },
|
|
298
298
|
UpdateExpression: `set ${updateExpressionComponents.join(", ")}`,
|
|
299
299
|
ExpressionAttributeValues: expressionAttributeValues
|
package/package.json
CHANGED
|
@@ -82,10 +82,6 @@ Outputs:
|
|
|
82
82
|
CloudFrontId:
|
|
83
83
|
Description: CloudFront Id
|
|
84
84
|
Value: !Ref CloudFrontDistribution
|
|
85
|
-
Export:
|
|
86
|
-
Name: CloudFrontId
|
|
87
85
|
WebsiteUrl:
|
|
88
86
|
Description: Cloudfront URL
|
|
89
|
-
Value: !GetAtt CloudFrontDistribution.DomainName
|
|
90
|
-
Export:
|
|
91
|
-
Name: CloudFrontURL
|
|
87
|
+
Value: !GetAtt CloudFrontDistribution.DomainName
|
|
@@ -2,14 +2,23 @@ Resources:
|
|
|
2
2
|
AWSClassifySessionTable:
|
|
3
3
|
Type: AWS::DynamoDB::Table
|
|
4
4
|
Properties:
|
|
5
|
-
TableName: classifySessionStore
|
|
5
|
+
TableName: classifySessionStore.${self:custom.domainName}
|
|
6
6
|
BillingMode: PAY_PER_REQUEST
|
|
7
7
|
AttributeDefinitions:
|
|
8
8
|
- AttributeName: sessionId
|
|
9
9
|
AttributeType: S
|
|
10
|
+
- AttributeName: userId
|
|
11
|
+
AttributeType: S
|
|
10
12
|
KeySchema:
|
|
11
13
|
- AttributeName: sessionId
|
|
12
14
|
KeyType: HASH
|
|
13
15
|
TimeToLiveSpecification:
|
|
14
16
|
AttributeName: expires
|
|
15
|
-
Enabled: true
|
|
17
|
+
Enabled: true
|
|
18
|
+
GlobalSecondaryIndexes:
|
|
19
|
+
- IndexName: userId
|
|
20
|
+
KeySchema:
|
|
21
|
+
- AttributeName: userId
|
|
22
|
+
KeyType: HASH
|
|
23
|
+
Projection:
|
|
24
|
+
ProjectionType: KEYS_ONLY
|
|
@@ -61,28 +61,10 @@ Resources:
|
|
|
61
61
|
Resource: !Join ["", [!GetAtt S3Bucket.Arn, "/*"]]
|
|
62
62
|
Principal:
|
|
63
63
|
CanonicalUser: !GetAtt CloudFrontOriginAccessIdentity.S3CanonicalUserId
|
|
64
|
-
CustomDNSName:
|
|
65
|
-
Type: AWS::Route53::RecordSetGroup
|
|
66
|
-
Properties:
|
|
67
|
-
HostedZoneName: ${self:custom.hostedZoneName}
|
|
68
|
-
RecordSets:
|
|
69
|
-
- Name: ${self:custom.domainName}
|
|
70
|
-
Type: A
|
|
71
|
-
AliasTarget:
|
|
72
|
-
HostedZoneId: Z2FDTNDATAQYW2 #cloudfront hostedzone id
|
|
73
|
-
DNSName:
|
|
74
|
-
Fn::GetAtt:
|
|
75
|
-
- CloudFrontDistribution
|
|
76
|
-
- DomainName
|
|
77
|
-
|
|
78
64
|
Outputs:
|
|
79
65
|
CloudFrontId:
|
|
80
66
|
Description: CloudFront Id
|
|
81
67
|
Value: !Ref CloudFrontDistribution
|
|
82
|
-
Export:
|
|
83
|
-
Name: CloudFrontId
|
|
84
68
|
WebsiteUrl:
|
|
85
69
|
Description: Cloudfront URL
|
|
86
|
-
Value: !GetAtt CloudFrontDistribution.DomainName
|
|
87
|
-
Export:
|
|
88
|
-
Name: CloudFrontURL
|
|
70
|
+
Value: !GetAtt CloudFrontDistribution.DomainName
|