@casual-simulation/aux-records-aws 3.4.6-alpha.14668890889 → 3.5.0-alpha.15117651144
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/RekognitionModerationJobProvider.js +87 -100
- package/RekognitionModerationJobProvider.js.map +1 -1
- package/S3FileRecordsStore.js +191 -227
- package/S3FileRecordsStore.js.map +1 -1
- package/SimpleEmailServiceAuthMessenger.js +48 -59
- package/SimpleEmailServiceAuthMessenger.js.map +1 -1
- package/TextItAuthMessenger.js +44 -55
- package/TextItAuthMessenger.js.map +1 -1
- package/package.json +4 -4
|
@@ -4,16 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
import { CreateJobCommand, } from '@aws-sdk/client-s3-control';
|
|
7
|
+
import { CreateJobCommand } from '@aws-sdk/client-s3-control';
|
|
17
8
|
import { v4 as uuid } from 'uuid';
|
|
18
9
|
import { traced } from '@casual-simulation/aux-records/tracing/TracingDecorators';
|
|
19
10
|
const TRACE_NAME = 'RekognitionModerationJobProvider';
|
|
@@ -28,104 +19,100 @@ export class RekognitionModerationJobProvider {
|
|
|
28
19
|
this._s3 = options.s3;
|
|
29
20
|
this._filesOptions = options.filesJob;
|
|
30
21
|
}
|
|
31
|
-
startFilesJob(filter) {
|
|
22
|
+
async startFilesJob(filter) {
|
|
32
23
|
var _a, _b;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
jobId: jobId,
|
|
67
|
-
},
|
|
24
|
+
const jobId = uuid();
|
|
25
|
+
const files = await this._filesStore.listAllUploadedFilesMatching(filter);
|
|
26
|
+
if (files.success === false) {
|
|
27
|
+
console.error('Error listing files:', files);
|
|
28
|
+
throw new Error('Error listing files');
|
|
29
|
+
}
|
|
30
|
+
console.log(`[RekognitionModerationJobProvider] Generating manifest for ${files.files.length} files.`);
|
|
31
|
+
let manifest = '';
|
|
32
|
+
for (let file of files.files) {
|
|
33
|
+
const key = this._filesStore.getFileKey(file.recordName, file.fileName);
|
|
34
|
+
manifest += `${(_a = file.bucket) !== null && _a !== void 0 ? _a : this._filesOptions.sourceBucket},${key}\n`;
|
|
35
|
+
}
|
|
36
|
+
const manifestKey = `${jobId}.manifest.csv`;
|
|
37
|
+
const manifestResult = await this._s3.putObject({
|
|
38
|
+
Bucket: this._filesOptions.reportBucket,
|
|
39
|
+
Key: manifestKey,
|
|
40
|
+
Body: manifest,
|
|
41
|
+
});
|
|
42
|
+
console.log(`[RekognitionModerationJobProvider] Manifest uploaded to ${this._filesOptions.reportBucket}/${manifestKey}.`);
|
|
43
|
+
const input = {
|
|
44
|
+
ClientRequestToken: jobId,
|
|
45
|
+
AccountId: this._filesOptions.accountId,
|
|
46
|
+
Priority: this._filesOptions.priority,
|
|
47
|
+
Tags: (_b = this._filesOptions.tags) === null || _b === void 0 ? void 0 : _b.map((t) => ({
|
|
48
|
+
Key: t.key,
|
|
49
|
+
Value: t.value,
|
|
50
|
+
})),
|
|
51
|
+
Operation: {
|
|
52
|
+
LambdaInvoke: {
|
|
53
|
+
FunctionArn: this._filesOptions.lambdaFunctionArn,
|
|
54
|
+
InvocationSchemaVersion: '2.0',
|
|
55
|
+
UserArguments: {
|
|
56
|
+
jobId: jobId,
|
|
68
57
|
},
|
|
69
58
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Spec: {
|
|
76
|
-
Format: 'S3BatchOperations_CSV_20180820',
|
|
77
|
-
Fields: ['Bucket', 'Key'],
|
|
78
|
-
},
|
|
59
|
+
},
|
|
60
|
+
Manifest: {
|
|
61
|
+
Location: {
|
|
62
|
+
ObjectArn: `arn:aws:s3:::${this._filesOptions.reportBucket}/${manifestKey}`,
|
|
63
|
+
ETag: manifestResult.ETag,
|
|
79
64
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
Format: 'Report_CSV_20180820',
|
|
84
|
-
ReportScope: 'AllTasks',
|
|
85
|
-
Prefix: 'reports',
|
|
65
|
+
Spec: {
|
|
66
|
+
Format: 'S3BatchOperations_CSV_20180820',
|
|
67
|
+
Fields: ['Bucket', 'Key'],
|
|
86
68
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
69
|
+
},
|
|
70
|
+
Report: {
|
|
71
|
+
Enabled: true,
|
|
72
|
+
Bucket: `arn:aws:s3:::${this._filesOptions.reportBucket}`,
|
|
73
|
+
Format: 'Report_CSV_20180820',
|
|
74
|
+
ReportScope: 'AllTasks',
|
|
75
|
+
Prefix: 'reports',
|
|
76
|
+
},
|
|
77
|
+
RoleArn: this._filesOptions.roleArn,
|
|
78
|
+
};
|
|
79
|
+
const job = await this._s3Control.send(new CreateJobCommand(input));
|
|
80
|
+
return {
|
|
81
|
+
id: jobId,
|
|
82
|
+
type: 'files',
|
|
83
|
+
createdAtMs: Date.now(),
|
|
84
|
+
updatedAtMs: Date.now(),
|
|
85
|
+
s3Id: job.JobId,
|
|
86
|
+
};
|
|
98
87
|
}
|
|
99
|
-
scanFile(options) {
|
|
88
|
+
async scanFile(options) {
|
|
100
89
|
var _a;
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
Name: file.name,
|
|
108
|
-
},
|
|
90
|
+
const file = await this._filesStore.getS3ObjectInfo(options.recordName, options.fileName);
|
|
91
|
+
const args = {
|
|
92
|
+
Image: {
|
|
93
|
+
S3Object: {
|
|
94
|
+
Bucket: file.bucket,
|
|
95
|
+
Name: file.name,
|
|
109
96
|
},
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
if (typeof this._filesOptions.projectVersionArn === 'string') {
|
|
100
|
+
args.ProjectVersion = this._filesOptions.projectVersionArn;
|
|
101
|
+
}
|
|
102
|
+
if (typeof options.minConfidence === 'number') {
|
|
103
|
+
args.MinConfidence = options.minConfidence;
|
|
104
|
+
}
|
|
105
|
+
const result = await this._rekognition.detectModerationLabels(args);
|
|
106
|
+
return {
|
|
107
|
+
fileName: options.fileName,
|
|
108
|
+
recordName: options.recordName,
|
|
109
|
+
labels: ((_a = result.ModerationLabels) !== null && _a !== void 0 ? _a : []).map((l) => ({
|
|
110
|
+
name: l.Name,
|
|
111
|
+
category: l.ParentName || undefined,
|
|
112
|
+
confidence: l.Confidence,
|
|
113
|
+
})),
|
|
114
|
+
modelVersion: result.ModerationModelVersion,
|
|
115
|
+
};
|
|
129
116
|
}
|
|
130
117
|
}
|
|
131
118
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RekognitionModerationJobProvider.js","sourceRoot":"","sources":["RekognitionModerationJobProvider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RekognitionModerationJobProvider.js","sourceRoot":"","sources":["RekognitionModerationJobProvider.ts"],"names":[],"mappings":";;;;;;AAiCA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,0DAA0D,CAAC;AAGlF,MAAM,UAAU,GAAG,kCAAkC,CAAC;AA0EtD;;GAEG;AACH,MAAM,OAAO,gCAAgC;IAOzC,YAAY,OAAgD;QACxD,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;QACxC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;QACpC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,EAAE,CAAC;QACtB,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC;IAC1C,CAAC;IAGK,AAAN,KAAK,CAAC,aAAa,CACf,MAAgC;;QAEhC,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;QAErB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC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CAAC,QAAQ,CACnB,CAAC;QACF,MAAM,IAAI,GAAuC;YAC7C,KAAK,EAAE;gBACH,QAAQ,EAAE;oBACN,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,IAAI,EAAE,IAAI,CAAC,IAAI;iBAClB;aACJ;SACJ,CAAC;QAEF,IAAI,OAAO,IAAI,CAAC,aAAa,CAAC,iBAAiB,KAAK,QAAQ,EAAE,CAAC;YAC3D,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC;QAC/D,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;YAC5C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC/C,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAEpE,OAAO;YACH,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,MAAM,EAAE,CAAC,MAAA,MAAM,CAAC,gBAAgB,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAChD,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,QAAQ,EAAE,CAAC,CAAC,UAAU,IAAI,SAAS;gBACnC,UAAU,EAAE,CAAC,CAAC,UAAU;aAC3B,CAAC,CAAC;YACH,YAAY,EAAE,MAAM,CAAC,sBAAsB;SAC9C,CAAC;IACN,CAAC;CACJ;AA5HS;IADL,MAAM,CAAC,UAAU,CAAC;qEAuFlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;gEAmClB"}
|
package/S3FileRecordsStore.js
CHANGED
|
@@ -4,26 +4,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
17
|
-
var t = {};
|
|
18
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
-
t[p] = s[p];
|
|
20
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
-
t[p[i]] = s[p[i]];
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
};
|
|
27
7
|
import { signRequest } from '@casual-simulation/aux-records';
|
|
28
8
|
import { PUBLIC_READ_MARKER } from '@casual-simulation/aux-common';
|
|
29
9
|
import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
|
|
@@ -45,22 +25,22 @@ export class S3FileRecordsStore {
|
|
|
45
25
|
this._credentialProvider = credentialProvider;
|
|
46
26
|
this._publicFilesUrl = publicFilesUrl;
|
|
47
27
|
if (this._lookup.listUploadedFiles) {
|
|
48
|
-
this.listUploadedFiles = (recordName, fileName) =>
|
|
49
|
-
const result =
|
|
28
|
+
this.listUploadedFiles = async (recordName, fileName) => {
|
|
29
|
+
const result = await this._lookup.listUploadedFiles(recordName, fileName);
|
|
50
30
|
if (!result.success) {
|
|
51
31
|
return result;
|
|
52
32
|
}
|
|
53
33
|
else {
|
|
54
|
-
const files = result.files.map((
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
34
|
+
const files = result.files.map(({ bucket, ...f }) => ({
|
|
35
|
+
...f,
|
|
36
|
+
url: this._fileUrl(recordName, f.fileName, bucket !== null && bucket !== void 0 ? bucket : this._bucket, isPublicFile(f.markers)).href,
|
|
37
|
+
}));
|
|
58
38
|
return {
|
|
59
39
|
success: true,
|
|
60
40
|
files,
|
|
61
41
|
};
|
|
62
42
|
}
|
|
63
|
-
}
|
|
43
|
+
};
|
|
64
44
|
}
|
|
65
45
|
}
|
|
66
46
|
listAllUploadedFilesMatching(filter) {
|
|
@@ -76,44 +56,11 @@ export class S3FileRecordsStore {
|
|
|
76
56
|
'x-amz-security-token',
|
|
77
57
|
];
|
|
78
58
|
}
|
|
79
|
-
getFileNameFromUrl(fileUrl) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (this._s3Host) {
|
|
83
|
-
|
|
84
|
-
const recordNameAndFileName = fileUrl.slice(this._s3Host.length + 1);
|
|
85
|
-
const firstSlash = recordNameAndFileName.indexOf('/');
|
|
86
|
-
if (firstSlash < 0) {
|
|
87
|
-
return {
|
|
88
|
-
success: false,
|
|
89
|
-
errorCode: 'unacceptable_url',
|
|
90
|
-
errorMessage: 'The URL does not match an expected format.',
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
const recordName = decodeURIComponent(recordNameAndFileName.slice(0, firstSlash));
|
|
94
|
-
const fileName = decodeURIComponent(recordNameAndFileName.slice(firstSlash + 1));
|
|
95
|
-
if (recordName && fileName) {
|
|
96
|
-
return {
|
|
97
|
-
success: true,
|
|
98
|
-
recordName,
|
|
99
|
-
fileName,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
success: false,
|
|
104
|
-
errorCode: 'unacceptable_url',
|
|
105
|
-
errorMessage: 'The URL does not match an expected format.',
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
success: false,
|
|
110
|
-
errorCode: 'unacceptable_url',
|
|
111
|
-
errorMessage: 'The URL does not match an expected format.',
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
const url = new URL(fileUrl);
|
|
115
|
-
if (url.pathname) {
|
|
116
|
-
const recordNameAndFileName = url.pathname.slice(1);
|
|
59
|
+
async getFileNameFromUrl(fileUrl) {
|
|
60
|
+
try {
|
|
61
|
+
if (this._s3Host) {
|
|
62
|
+
if (fileUrl.startsWith(this._s3Host)) {
|
|
63
|
+
const recordNameAndFileName = fileUrl.slice(this._s3Host.length + 1);
|
|
117
64
|
const firstSlash = recordNameAndFileName.indexOf('/');
|
|
118
65
|
if (firstSlash < 0) {
|
|
119
66
|
return {
|
|
@@ -137,207 +84,224 @@ export class S3FileRecordsStore {
|
|
|
137
84
|
errorMessage: 'The URL does not match an expected format.',
|
|
138
85
|
};
|
|
139
86
|
}
|
|
140
|
-
}
|
|
141
|
-
catch (err) {
|
|
142
|
-
console.error('[S3FileRecordsStore] An error occurred while getting file name from URL:', err);
|
|
143
87
|
return {
|
|
144
88
|
success: false,
|
|
145
89
|
errorCode: 'unacceptable_url',
|
|
146
90
|
errorMessage: 'The URL does not match an expected format.',
|
|
147
91
|
};
|
|
148
92
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
presignFileUpload(request) {
|
|
157
|
-
var _a;
|
|
158
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
159
|
-
const credentials = yield this._getCredentials();
|
|
160
|
-
const secretAccessKey = credentials
|
|
161
|
-
? credentials.secretAccessKey
|
|
162
|
-
: null;
|
|
163
|
-
const accessKeyId = credentials ? credentials.accessKeyId : null;
|
|
164
|
-
const now = (_a = request.date) !== null && _a !== void 0 ? _a : new Date();
|
|
165
|
-
const fileUrl = this._fileUrl(request.recordName, request.fileName, this._bucket,
|
|
166
|
-
// Presigned file uploads always have to use an S3 URL
|
|
167
|
-
false);
|
|
168
|
-
const requiredHeaders = {
|
|
169
|
-
'content-type': request.fileMimeType,
|
|
170
|
-
'content-length': request.fileByteLength.toString(),
|
|
171
|
-
'cache-control': 'max-age=31536000',
|
|
172
|
-
'x-amz-acl': s3AclForMarkers(request.markers),
|
|
173
|
-
'x-amz-storage-class': this._storageClass,
|
|
174
|
-
host: fileUrl.host,
|
|
175
|
-
};
|
|
176
|
-
if (credentials && credentials.sessionToken) {
|
|
177
|
-
requiredHeaders['x-amz-security-token'] =
|
|
178
|
-
credentials.sessionToken;
|
|
179
|
-
}
|
|
180
|
-
const result = signRequest({
|
|
181
|
-
method: 'PUT',
|
|
182
|
-
payloadSha256Hex: request.fileSha256Hex,
|
|
183
|
-
headers: Object.assign(Object.assign({}, request.headers), requiredHeaders),
|
|
184
|
-
queryString: {},
|
|
185
|
-
path: fileUrl.pathname,
|
|
186
|
-
}, secretAccessKey, accessKeyId, now, this._region, 's3');
|
|
187
|
-
return {
|
|
188
|
-
success: true,
|
|
189
|
-
uploadUrl: fileUrl.href,
|
|
190
|
-
uploadHeaders: result.headers,
|
|
191
|
-
uploadMethod: result.method,
|
|
192
|
-
};
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
presignFileRead(request) {
|
|
196
|
-
var _a;
|
|
197
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
-
const credentials = yield this._getCredentials();
|
|
199
|
-
const secretAccessKey = credentials
|
|
200
|
-
? credentials.secretAccessKey
|
|
201
|
-
: null;
|
|
202
|
-
const accessKeyId = credentials ? credentials.accessKeyId : null;
|
|
203
|
-
const now = (_a = request.date) !== null && _a !== void 0 ? _a : new Date();
|
|
204
|
-
const fileUrl = this._fileUrl(request.recordName, request.fileName, this._bucket,
|
|
205
|
-
// Presigned file reads always have to use an S3 URL
|
|
206
|
-
false);
|
|
207
|
-
const requiredHeaders = {
|
|
208
|
-
host: fileUrl.host,
|
|
209
|
-
};
|
|
210
|
-
if (credentials && credentials.sessionToken) {
|
|
211
|
-
requiredHeaders['x-amz-security-token'] =
|
|
212
|
-
credentials.sessionToken;
|
|
213
|
-
}
|
|
214
|
-
const result = signRequest({
|
|
215
|
-
method: 'GET',
|
|
216
|
-
payloadSha256Hex: EMPTY_STRING_SHA256_HASH_HEX,
|
|
217
|
-
headers: Object.assign(Object.assign({}, request.headers), requiredHeaders),
|
|
218
|
-
queryString: {
|
|
219
|
-
'response-cache-control': 'max-age=31536000',
|
|
220
|
-
},
|
|
221
|
-
path: fileUrl.pathname,
|
|
222
|
-
}, secretAccessKey, accessKeyId, now, this._region, 's3');
|
|
223
|
-
const url = new URL(fileUrl.href);
|
|
224
|
-
for (let key in result.queryString) {
|
|
225
|
-
url.searchParams.set(key, result.queryString[key]);
|
|
226
|
-
}
|
|
227
|
-
return {
|
|
228
|
-
success: true,
|
|
229
|
-
requestUrl: url.href,
|
|
230
|
-
requestHeaders: result.headers,
|
|
231
|
-
requestMethod: result.method,
|
|
232
|
-
};
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
getFileRecord(recordName, fileName) {
|
|
236
|
-
var _a;
|
|
237
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
238
|
-
try {
|
|
239
|
-
const result = yield this._lookup.getFileRecord(recordName, fileName);
|
|
240
|
-
if (result) {
|
|
241
|
-
const url = this._fileUrl(result.recordName, result.fileName, (_a = result.bucket) !== null && _a !== void 0 ? _a : this._defaultBucket, isPublicFile(result.markers));
|
|
93
|
+
const url = new URL(fileUrl);
|
|
94
|
+
if (url.pathname) {
|
|
95
|
+
const recordNameAndFileName = url.pathname.slice(1);
|
|
96
|
+
const firstSlash = recordNameAndFileName.indexOf('/');
|
|
97
|
+
if (firstSlash < 0) {
|
|
242
98
|
return {
|
|
243
|
-
success:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
description: result.description,
|
|
247
|
-
publisherId: result.publisherId,
|
|
248
|
-
subjectId: result.subjectId,
|
|
249
|
-
sizeInBytes: result.sizeInBytes,
|
|
250
|
-
uploaded: result.uploaded,
|
|
251
|
-
url: url.href,
|
|
252
|
-
markers: result.markers,
|
|
99
|
+
success: false,
|
|
100
|
+
errorCode: 'unacceptable_url',
|
|
101
|
+
errorMessage: 'The URL does not match an expected format.',
|
|
253
102
|
};
|
|
254
103
|
}
|
|
255
|
-
|
|
104
|
+
const recordName = decodeURIComponent(recordNameAndFileName.slice(0, firstSlash));
|
|
105
|
+
const fileName = decodeURIComponent(recordNameAndFileName.slice(firstSlash + 1));
|
|
106
|
+
if (recordName && fileName) {
|
|
256
107
|
return {
|
|
257
|
-
success:
|
|
258
|
-
|
|
259
|
-
|
|
108
|
+
success: true,
|
|
109
|
+
recordName,
|
|
110
|
+
fileName,
|
|
260
111
|
};
|
|
261
112
|
}
|
|
262
|
-
}
|
|
263
|
-
catch (err) {
|
|
264
|
-
console.error(`[S3FileRecordsStore] A server error occurred while getting a file record:`, err);
|
|
265
113
|
return {
|
|
266
114
|
success: false,
|
|
267
|
-
errorCode: '
|
|
268
|
-
errorMessage: '
|
|
115
|
+
errorCode: 'unacceptable_url',
|
|
116
|
+
errorMessage: 'The URL does not match an expected format.',
|
|
269
117
|
};
|
|
270
118
|
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
console.error('[S3FileRecordsStore] An error occurred while getting file name from URL:', err);
|
|
122
|
+
return {
|
|
123
|
+
success: false,
|
|
124
|
+
errorCode: 'unacceptable_url',
|
|
125
|
+
errorMessage: 'The URL does not match an expected format.',
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
success: false,
|
|
130
|
+
errorCode: 'unacceptable_url',
|
|
131
|
+
errorMessage: 'The URL does not match an expected format.',
|
|
132
|
+
};
|
|
277
133
|
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
134
|
+
async presignFileUpload(request) {
|
|
135
|
+
var _a;
|
|
136
|
+
const credentials = await this._getCredentials();
|
|
137
|
+
const secretAccessKey = credentials
|
|
138
|
+
? credentials.secretAccessKey
|
|
139
|
+
: null;
|
|
140
|
+
const accessKeyId = credentials ? credentials.accessKeyId : null;
|
|
141
|
+
const now = (_a = request.date) !== null && _a !== void 0 ? _a : new Date();
|
|
142
|
+
const fileUrl = this._fileUrl(request.recordName, request.fileName, this._bucket,
|
|
143
|
+
// Presigned file uploads always have to use an S3 URL
|
|
144
|
+
false);
|
|
145
|
+
const requiredHeaders = {
|
|
146
|
+
'content-type': request.fileMimeType,
|
|
147
|
+
'content-length': request.fileByteLength.toString(),
|
|
148
|
+
'cache-control': 'max-age=31536000',
|
|
149
|
+
'x-amz-acl': s3AclForMarkers(request.markers),
|
|
150
|
+
'x-amz-storage-class': this._storageClass,
|
|
151
|
+
host: fileUrl.host,
|
|
152
|
+
};
|
|
153
|
+
if (credentials && credentials.sessionToken) {
|
|
154
|
+
requiredHeaders['x-amz-security-token'] =
|
|
155
|
+
credentials.sessionToken;
|
|
156
|
+
}
|
|
157
|
+
const result = signRequest({
|
|
158
|
+
method: 'PUT',
|
|
159
|
+
payloadSha256Hex: request.fileSha256Hex,
|
|
160
|
+
headers: {
|
|
161
|
+
...request.headers,
|
|
162
|
+
...requiredHeaders,
|
|
163
|
+
},
|
|
164
|
+
queryString: {},
|
|
165
|
+
path: decodeURI(fileUrl.pathname),
|
|
166
|
+
}, secretAccessKey, accessKeyId, now, this._region, 's3');
|
|
167
|
+
return {
|
|
168
|
+
success: true,
|
|
169
|
+
uploadUrl: fileUrl.href,
|
|
170
|
+
uploadHeaders: result.headers,
|
|
171
|
+
uploadMethod: result.method,
|
|
172
|
+
};
|
|
282
173
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
174
|
+
async presignFileRead(request) {
|
|
175
|
+
var _a;
|
|
176
|
+
const credentials = await this._getCredentials();
|
|
177
|
+
const secretAccessKey = credentials
|
|
178
|
+
? credentials.secretAccessKey
|
|
179
|
+
: null;
|
|
180
|
+
const accessKeyId = credentials ? credentials.accessKeyId : null;
|
|
181
|
+
const now = (_a = request.date) !== null && _a !== void 0 ? _a : new Date();
|
|
182
|
+
const fileUrl = this._fileUrl(request.recordName, request.fileName, this._bucket,
|
|
183
|
+
// Presigned file reads always have to use an S3 URL
|
|
184
|
+
false);
|
|
185
|
+
const requiredHeaders = {
|
|
186
|
+
host: fileUrl.host,
|
|
187
|
+
};
|
|
188
|
+
if (credentials && credentials.sessionToken) {
|
|
189
|
+
requiredHeaders['x-amz-security-token'] =
|
|
190
|
+
credentials.sessionToken;
|
|
191
|
+
}
|
|
192
|
+
const result = signRequest({
|
|
193
|
+
method: 'GET',
|
|
194
|
+
payloadSha256Hex: EMPTY_STRING_SHA256_HASH_HEX,
|
|
195
|
+
headers: {
|
|
196
|
+
...request.headers,
|
|
197
|
+
...requiredHeaders,
|
|
198
|
+
},
|
|
199
|
+
queryString: {
|
|
200
|
+
'response-cache-control': 'max-age=31536000',
|
|
201
|
+
},
|
|
202
|
+
path: decodeURI(fileUrl.pathname),
|
|
203
|
+
}, secretAccessKey, accessKeyId, now, this._region, 's3');
|
|
204
|
+
const url = new URL(fileUrl.href);
|
|
205
|
+
for (let key in result.queryString) {
|
|
206
|
+
url.searchParams.set(key, result.queryString[key]);
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
success: true,
|
|
210
|
+
requestUrl: url.href,
|
|
211
|
+
requestHeaders: result.headers,
|
|
212
|
+
requestMethod: result.method,
|
|
213
|
+
};
|
|
287
214
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
Bucket: this._bucket,
|
|
295
|
-
Key: key,
|
|
296
|
-
});
|
|
215
|
+
async getFileRecord(recordName, fileName) {
|
|
216
|
+
var _a;
|
|
217
|
+
try {
|
|
218
|
+
const result = await this._lookup.getFileRecord(recordName, fileName);
|
|
219
|
+
if (result) {
|
|
220
|
+
const url = this._fileUrl(result.recordName, result.fileName, (_a = result.bucket) !== null && _a !== void 0 ? _a : this._defaultBucket, isPublicFile(result.markers));
|
|
297
221
|
return {
|
|
298
222
|
success: true,
|
|
223
|
+
recordName: result.recordName,
|
|
224
|
+
fileName: result.fileName,
|
|
225
|
+
description: result.description,
|
|
226
|
+
publisherId: result.publisherId,
|
|
227
|
+
subjectId: result.subjectId,
|
|
228
|
+
sizeInBytes: result.sizeInBytes,
|
|
229
|
+
uploaded: result.uploaded,
|
|
230
|
+
url: url.href,
|
|
231
|
+
markers: result.markers,
|
|
299
232
|
};
|
|
300
233
|
}
|
|
301
|
-
|
|
302
|
-
console.error(`[S3FileRecordsStore] A server error occurred while erasing a file record:`, err);
|
|
234
|
+
else {
|
|
303
235
|
return {
|
|
304
236
|
success: false,
|
|
305
|
-
errorCode: '
|
|
306
|
-
errorMessage: '
|
|
237
|
+
errorCode: 'file_not_found',
|
|
238
|
+
errorMessage: 'The file was not found.',
|
|
307
239
|
};
|
|
308
240
|
}
|
|
309
|
-
}
|
|
241
|
+
}
|
|
242
|
+
catch (err) {
|
|
243
|
+
console.error(`[S3FileRecordsStore] A server error occurred while getting a file record:`, err);
|
|
244
|
+
return {
|
|
245
|
+
success: false,
|
|
246
|
+
errorCode: 'server_error',
|
|
247
|
+
errorMessage: 'An unexpected error occurred.',
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async addFileRecord(recordName, fileName, publisherId, subjectId, sizeInBytes, description, markers) {
|
|
252
|
+
return await this._lookup.addFileRecord(recordName, fileName, publisherId, subjectId, sizeInBytes, description, this._bucket, markers);
|
|
253
|
+
}
|
|
254
|
+
async updateFileRecord(recordName, fileName, markers) {
|
|
255
|
+
return await this._lookup.updateFileRecord(recordName, fileName, markers);
|
|
310
256
|
}
|
|
311
|
-
|
|
312
|
-
return
|
|
313
|
-
|
|
314
|
-
|
|
257
|
+
async setFileRecordAsUploaded(recordName, fileName) {
|
|
258
|
+
return await this._lookup.setFileRecordAsUploaded(recordName, fileName);
|
|
259
|
+
}
|
|
260
|
+
async eraseFileRecord(recordName, fileName) {
|
|
261
|
+
try {
|
|
262
|
+
await this._lookup.eraseFileRecord(recordName, fileName);
|
|
263
|
+
const key = this.getFileKey(recordName, fileName);
|
|
264
|
+
await this._s3.deleteObject({
|
|
265
|
+
Bucket: this._bucket,
|
|
266
|
+
Key: key,
|
|
267
|
+
});
|
|
268
|
+
return {
|
|
269
|
+
success: true,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
catch (err) {
|
|
273
|
+
console.error(`[S3FileRecordsStore] A server error occurred while erasing a file record:`, err);
|
|
274
|
+
return {
|
|
275
|
+
success: false,
|
|
276
|
+
errorCode: 'server_error',
|
|
277
|
+
errorMessage: 'An unexpected error occurred.',
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async _getCredentials() {
|
|
282
|
+
return await this._credentialProvider();
|
|
315
283
|
}
|
|
316
284
|
/**
|
|
317
285
|
* Gets the S3 object info for the given record and file name.
|
|
318
286
|
* @param recordName The name of the record.
|
|
319
287
|
* @param fileName The name of the file.
|
|
320
288
|
*/
|
|
321
|
-
getS3ObjectInfo(recordName, fileName) {
|
|
289
|
+
async getS3ObjectInfo(recordName, fileName) {
|
|
322
290
|
var _a;
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
if (!file) {
|
|
326
|
-
return {
|
|
327
|
-
bucket: this._bucket,
|
|
328
|
-
name: this.getFileKey(recordName, fileName),
|
|
329
|
-
};
|
|
330
|
-
}
|
|
291
|
+
let file = await this._lookup.getFileRecord(recordName, fileName);
|
|
292
|
+
if (!file) {
|
|
331
293
|
return {
|
|
332
|
-
bucket:
|
|
294
|
+
bucket: this._bucket,
|
|
333
295
|
name: this.getFileKey(recordName, fileName),
|
|
334
296
|
};
|
|
335
|
-
}
|
|
297
|
+
}
|
|
298
|
+
return {
|
|
299
|
+
bucket: (_a = file.bucket) !== null && _a !== void 0 ? _a : this._bucket,
|
|
300
|
+
name: this.getFileKey(recordName, fileName),
|
|
301
|
+
};
|
|
336
302
|
}
|
|
337
|
-
getFileInfo(bucket, name) {
|
|
338
|
-
return
|
|
339
|
-
return this.getFileNameFromUrl(`https://${bucket}.s3.amazonaws.com/${name}`);
|
|
340
|
-
});
|
|
303
|
+
async getFileInfo(bucket, name) {
|
|
304
|
+
return this.getFileNameFromUrl(`https://${bucket}.s3.amazonaws.com/${name}`);
|
|
341
305
|
}
|
|
342
306
|
_fileUrl(recordName, fileName, bucket, isPublic) {
|
|
343
307
|
let filePath = this.getFileKey(recordName, fileName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"S3FileRecordsStore.js","sourceRoot":"","sources":["S3FileRecordsStore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAW7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAKnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,0DAA0D,CAAC;AAElF,MAAM,UAAU,GAAG,oBAAoB,CAAC;AACxC,MAAM,CAAC,MAAM,4BAA4B,GACrC,kEAAkE,CAAC;AAEvE;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAY3B,YACI,MAAc,EACd,MAAc,EACd,aAAqB,EACrB,UAA6B,EAC7B,eAAuB,UAAU,EACjC,EAAM,EACN,SAAiB,IAAI,EACrB,qBAAoD,qBAAqB,EAAE,EAC3E,iBAA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QAAQ,EAAE,WAAW,MAAM,mBAAmB,CAAC,CAAC;IACnE,CAAC;IAGD,UAAU,CAAC,UAAkB,EAAE,QAAgB;QAC3C,OAAO,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC;IACvC,CAAC;CACJ;AA1aG;IADC,MAAM,CAAC,UAAU,CAAC;iEAUlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;4DAiGlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;2DA0DlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;yDA4DlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;uDAgDlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;uDAoBlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;0DAWlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;iEAMlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;yDA6BlB;AAGa;IADb,MAAM,CAAC,UAAU,CAAC;yDAOlB;AAQK;IADL,MAAM,CAAC,UAAU,CAAC;yDAqBlB;AAYO;IADP,MAAM,CAAC,UAAU,CAAC;kDAkBlB;AAGD;IADC,MAAM,CAAC,UAAU,CAAC;oDAGlB;AAGL;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAA0B;IACtD,IAAI,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;QACxB,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAA0B;IACnD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,kBAAkB,CAAC,CAAC;AACzD,CAAC"}
|
|
@@ -4,15 +4,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
7
|
import { traced } from '@casual-simulation/aux-records/tracing/TracingDecorators';
|
|
17
8
|
const TRACE_NAME = 'SimpleEmailServiceAuthMessenger';
|
|
18
9
|
export class SimpleEmailServiceAuthMessenger {
|
|
@@ -23,64 +14,62 @@ export class SimpleEmailServiceAuthMessenger {
|
|
|
23
14
|
supportsAddressType(addressType) {
|
|
24
15
|
return Promise.resolve(addressType === 'email');
|
|
25
16
|
}
|
|
26
|
-
sendCode(address, addressType, code) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
async sendCode(address, addressType, code) {
|
|
18
|
+
try {
|
|
19
|
+
const data = {
|
|
20
|
+
code: code,
|
|
21
|
+
address: address,
|
|
22
|
+
addressType: addressType,
|
|
23
|
+
};
|
|
24
|
+
let content;
|
|
25
|
+
if (this._options.content.type === 'template') {
|
|
26
|
+
content = {
|
|
27
|
+
Template: {
|
|
28
|
+
TemplateArn: this._options.content.templateArn,
|
|
29
|
+
TemplateData: JSON.stringify(data),
|
|
30
|
+
},
|
|
33
31
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
else if (this._options.content.type === 'plain') {
|
|
44
|
-
content = {
|
|
45
|
-
Simple: {
|
|
46
|
-
Body: {
|
|
47
|
-
Text: {
|
|
48
|
-
Data: renderString(this._options.content.body, data),
|
|
49
|
-
Charset: 'UTF-8',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
Subject: {
|
|
53
|
-
Data: renderString(this._options.content.subject, data),
|
|
32
|
+
}
|
|
33
|
+
else if (this._options.content.type === 'plain') {
|
|
34
|
+
content = {
|
|
35
|
+
Simple: {
|
|
36
|
+
Body: {
|
|
37
|
+
Text: {
|
|
38
|
+
Data: renderString(this._options.content.body, data),
|
|
54
39
|
Charset: 'UTF-8',
|
|
55
40
|
},
|
|
56
41
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
this._options.content.type);
|
|
62
|
-
}
|
|
63
|
-
yield this._ses.sendEmail({
|
|
64
|
-
Destination: {
|
|
65
|
-
ToAddresses: [address],
|
|
42
|
+
Subject: {
|
|
43
|
+
Data: renderString(this._options.content.subject, data),
|
|
44
|
+
Charset: 'UTF-8',
|
|
45
|
+
},
|
|
66
46
|
},
|
|
67
|
-
FromEmailAddress: this._options.fromAddress,
|
|
68
|
-
Content: content,
|
|
69
|
-
});
|
|
70
|
-
return {
|
|
71
|
-
success: true,
|
|
72
47
|
};
|
|
73
48
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
success: false,
|
|
79
|
-
errorCode: 'server_error',
|
|
80
|
-
errorMessage: 'A server error occurred.',
|
|
81
|
-
};
|
|
49
|
+
else {
|
|
50
|
+
throw new Error('Unable to send email because the content type is not supported: ' +
|
|
51
|
+
this._options.content.type);
|
|
82
52
|
}
|
|
83
|
-
|
|
53
|
+
await this._ses.sendEmail({
|
|
54
|
+
Destination: {
|
|
55
|
+
ToAddresses: [address],
|
|
56
|
+
},
|
|
57
|
+
FromEmailAddress: this._options.fromAddress,
|
|
58
|
+
Content: content,
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
success: true,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (ex) {
|
|
65
|
+
console.log('[SimpleEmailServiceAuthMessenger] Error sending email: ' +
|
|
66
|
+
ex.message, ex);
|
|
67
|
+
return {
|
|
68
|
+
success: false,
|
|
69
|
+
errorCode: 'server_error',
|
|
70
|
+
errorMessage: 'A server error occurred.',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
84
73
|
}
|
|
85
74
|
}
|
|
86
75
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleEmailServiceAuthMessenger.js","sourceRoot":"","sources":["SimpleEmailServiceAuthMessenger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SimpleEmailServiceAuthMessenger.js","sourceRoot":"","sources":["SimpleEmailServiceAuthMessenger.ts"],"names":[],"mappings":";;;;;;AA0BA,OAAO,EAAE,MAAM,EAAE,MAAM,0DAA0D,CAAC;AAElF,MAAM,UAAU,GAAG,iCAAiC,CAAC;AA2BrD,MAAM,OAAO,+BAA+B;IAIxC,YAAY,GAAU,EAAE,OAA+C;QACnE,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC5B,CAAC;IAGD,mBAAmB,CAAC,WAAwB;QACxC,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,KAAK,OAAO,CAAC,CAAC;IACpD,CAAC;IAGK,AAAN,KAAK,CAAC,QAAQ,CACV,OAAe,EACf,WAAwB,EACxB,IAAY;QAEZ,IAAI,CAAC;YACD,MAAM,IAAI,GAAG;gBACT,IAAI,EAAE,IAAI;gBACV,OAAO,EAAE,OAAO;gBAChB,WAAW,EAAE,WAAW;aAC3B,CAAC;YACF,IAAI,OAAwB,CAAC;YAC7B,IAAI,IAAI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O,EAAE,KAAK;gBACd,SAAS,EAAE,cAAc;gBACzB,YAAY,EAAE,0BAA0B;aAC3C,CAAC;QACN,CAAC;IACL,CAAC;CACJ;AA5EG;IADC,MAAM,CAAC,UAAU,CAAC;0EAGlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;+DAuElB;AAGL;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,GAAQ;IAC9C,OAAO,GAAG,CAAC,OAAO,CACd,iBAAiB,EACjB,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CACvD,CAAC;AACN,CAAC"}
|
package/TextItAuthMessenger.js
CHANGED
|
@@ -4,15 +4,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
7
|
import { traced } from '@casual-simulation/aux-records/tracing/TracingDecorators';
|
|
17
8
|
import axios from 'axios';
|
|
18
9
|
const TRACE_NAME = 'TextItAuthMessenger';
|
|
@@ -27,54 +18,52 @@ export class TextItAuthMessenger {
|
|
|
27
18
|
supportsAddressType(addressType) {
|
|
28
19
|
return Promise.resolve(addressType === 'email' || addressType === 'phone');
|
|
29
20
|
}
|
|
30
|
-
sendCode(address, addressType, code) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (err.response) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
}
|
|
21
|
+
async sendCode(address, addressType, code) {
|
|
22
|
+
if (addressType !== 'email' && addressType !== 'phone') {
|
|
23
|
+
return {
|
|
24
|
+
success: false,
|
|
25
|
+
errorCode: 'address_type_not_supported',
|
|
26
|
+
errorMessage: `${addressType} addresses are not supported`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const result = await axios.post('https://textit.com/api/v2/flow_starts.json', {
|
|
31
|
+
flow: this._flowId,
|
|
32
|
+
urns: [
|
|
33
|
+
addressType === 'email'
|
|
34
|
+
? `mailto:${address}`
|
|
35
|
+
: `tel:${address}`,
|
|
36
|
+
],
|
|
37
|
+
params: {
|
|
38
|
+
code: code,
|
|
39
|
+
},
|
|
40
|
+
restart_participants: true,
|
|
41
|
+
}, {
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: `Token ${this._apiKey}`,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
success: true,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
if (err.response) {
|
|
52
|
+
if (err.response.status === 400) {
|
|
53
|
+
return {
|
|
54
|
+
success: false,
|
|
55
|
+
errorCode: 'unacceptable_address',
|
|
56
|
+
errorMessage: 'The given address is invalid.',
|
|
57
|
+
};
|
|
69
58
|
}
|
|
70
|
-
console.error('[TextItAuthMessenger] A server error ocurred:', err);
|
|
71
|
-
return {
|
|
72
|
-
success: false,
|
|
73
|
-
errorCode: 'server_error',
|
|
74
|
-
errorMessage: 'A server error occurred.',
|
|
75
|
-
};
|
|
76
59
|
}
|
|
77
|
-
|
|
60
|
+
console.error('[TextItAuthMessenger] A server error ocurred:', err);
|
|
61
|
+
return {
|
|
62
|
+
success: false,
|
|
63
|
+
errorCode: 'server_error',
|
|
64
|
+
errorMessage: 'A server error occurred.',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
78
67
|
}
|
|
79
68
|
}
|
|
80
69
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextItAuthMessenger.js","sourceRoot":"","sources":["TextItAuthMessenger.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextItAuthMessenger.js","sourceRoot":"","sources":["TextItAuthMessenger.ts"],"names":[],"mappings":";;;;;;AAsBA,OAAO,EAAE,MAAM,EAAE,MAAM,0DAA0D,CAAC;AAClF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,GAAG,qBAAqB,CAAC;AAEzC;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAI5B,YAAY,MAAc,EAAE,MAAc;QACtC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAGD,mBAAmB,CAAC,WAAwB;QACxC,OAAO,OAAO,CAAC,OAAO,CAClB,WAAW,KAAK,OAAO,IAAI,WAAW,KAAK,OAAO,CACr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ADC,MAAM,CAAC,UAAU,CAAC;8DAKlB;AAGK;IADL,MAAM,CAAC,UAAU,CAAC;mDAwDlB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casual-simulation/aux-records-aws",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0-alpha.15117651144",
|
|
4
4
|
"description": "AWS Store implementations for the CasualOS Records System.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "Casual Simulation, Inc.",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"@aws-sdk/client-sesv2": "^3.620.1",
|
|
45
45
|
"@aws-sdk/credential-providers": "^3.620.1",
|
|
46
46
|
"@aws-sdk/types": "^3.609.0",
|
|
47
|
-
"@casual-simulation/aux-common": "^3.
|
|
48
|
-
"@casual-simulation/aux-records": "^3.
|
|
47
|
+
"@casual-simulation/aux-common": "^3.5.0-alpha.15117651144",
|
|
48
|
+
"@casual-simulation/aux-records": "^3.5.0-alpha.15117651144",
|
|
49
49
|
"axios": "1.7.7",
|
|
50
50
|
"uuid": "10.0.0"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "3e2803698d7c87343fb3b3c29a2f27f4b9efe942"
|
|
53
53
|
}
|